* small patches for src/env
@ 2014-11-03 14:06 Richard Gorton
0 siblings, 0 replies; only message in thread
From: Richard Gorton @ 2014-11-03 14:06 UTC (permalink / raw)
To: musl
Attached is a small patch, mostly comments for a couple of files in src/env
Regards,
Richard
rcgorton@cog-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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-11-03 14:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-03 14:06 small patches for src/env Richard Gorton
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).