Date: Fri, 31 Oct 2014 09:31:37 -0400 From: Richard Gorton <rcgorton@...nitive-electronics.com> To: musl@...ts.openwall.com Subject: magic constants in some startup code We're using musl for our processor architecture; as part of doing the bring-up work, I need to fully understand process launching and thread creation. As I'm reading through the source code, I see (more than one) 'magic' constants that I do not fully understand (musl 1.1.5), and would like to know 'how and why': src/env/__init_tls.c: static long long builtin_tls[(sizeof(struct pthread) + 64)/sizeof(long long)]; I'm guessing that 64 is an arbitrary 'small' default amount of TLS? Or is this to hold another specific bit of data? ---- src/env/__stack_chk_fail.c else __stack_chk_guard = (uintptr_t)&__stack_chk_guard * 1103515245; the number equates to 0x41c64e6d. Called from __init_libc as: __init_ssp((void *)aux[AT_RANDOM]); The kernel is putting a random number into aux[AT_RANDOM] at process initialization. Why not just put a predictable arbitrary number into __stack_chk_guard? Regards, Richard rcgorton@...-e.com
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.