mailing list of musl libc
 help / color / mirror / code / Atom feed
* magic constants in some startup code
@ 2014-10-31 13:31 Richard Gorton
  2014-10-31 14:18 ` Rich Felker
  0 siblings, 1 reply; 12+ messages in thread
From: Richard Gorton @ 2014-10-31 13:31 UTC (permalink / raw)
  To: musl

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@cog-e.com




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-11-02 19:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-31 13:31 magic constants in some startup code Richard Gorton
2014-10-31 14:18 ` Rich Felker
2014-10-31 14:31   ` Richard Gorton
2014-10-31 16:09     ` Rich Felker
2014-10-31 20:19       ` Andy Lutomirski
2014-10-31 21:05         ` Rich Felker
2014-10-31 21:29           ` Andy Lutomirski
2014-10-31 21:39             ` Rich Felker
2014-10-31 22:27               ` Andy Lutomirski
2014-10-31 23:14                 ` Rich Felker
2014-11-02 17:17                   ` Szabolcs Nagy
2014-11-02 19:10                     ` Andy Lutomirski

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).