|
Message-Id: <A19A4EED-F081-47A3-831F-3A7E5F5173C3@cognitive-electronics.com> Date: Mon, 3 Nov 2014 09:06:10 -0500 From: Richard Gorton <rcgorton@...nitive-electronics.com> To: "musl@...ts.openwall.com" <musl@...ts.openwall.com> Subject: small patches for src/env Attached is a small patch, mostly comments for a couple of files in src/env Regards, Richard rcgorton@...-e.com Index: __init_tls.c =================================================================== --- __init_tls.c (revision 47) +++ __init_tls.c (working copy) @@ -22,7 +22,8 @@ #ifndef SHARED -static long long builtin_tls[(sizeof(struct pthread) + 64)/sizeof(long long)]; +#define SMALL_NUM_TLS_VARS 16 +static long long builtin_tls[(sizeof(struct pthread) + (sizeof(uintptr_t) * SMALL_NUM_TLS_VARS))/sizeof(long long)]; struct tls_image { void *image; @@ -60,6 +61,10 @@ typedef Elf64_Phdr Phdr; #endif +/* + * See ELF Handling for Thread-Local Storage: + * http://www.akkadia.org/drepper/tls.pdf + */ void __init_tls(size_t *aux) { unsigned char *p; Index: __stack_chk_fail.c =================================================================== --- __stack_chk_fail.c (revision 47) +++ __stack_chk_fail.c (working copy) @@ -4,6 +4,12 @@ uintptr_t __stack_chk_guard; +/* + * The objective is to have some additional entropy for the canary. + * The value (1103515245) is an LCG: Linear Congruential Generator + * http://en.wikipedia.org/wiki/Linear_congruential_generator + * and matches the value used elsewhere in musl (src/prng) for pseudo-random number generation + */ void __init_ssp(void *entropy) { if (entropy) memcpy(&__stack_chk_guard, entropy, sizeof(uintptr_t)); Index: __libc_start_main.c =================================================================== --- __libc_start_main.c (revision 47) +++ __libc_start_main.c (working copy) @@ -23,6 +23,16 @@ extern size_t __hwcap, __sysinfo; extern char *__progname, *__progname_full; +/* + * The initial process stack for ELF executables is described in the System V Application Binary Interface + * Architecture processor supplement, such as the one for AMD64 == x86_64: + * http://refspecs.linux-foundation.org/elf/x86_64-abi-0.95.pdf + * Search for "Initial Process Stack" + * + * Basically, the order of content is: + * argc, argv[] (null terminated), envp[] (null terminated), auxv (null terminated) + * + */ #ifndef SHARED static #endif
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.