From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/6398 Path: news.gmane.org!not-for-mail From: Richard Gorton Newsgroups: gmane.linux.lib.musl.general Subject: magic constants in some startup code Date: Fri, 31 Oct 2014 09:31:37 -0400 Message-ID: <45BFC4C3-FA51-49B5-8C58-1C1FC075BD28@cognitive-electronics.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1414762323 18478 80.91.229.3 (31 Oct 2014 13:32:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 31 Oct 2014 13:32:03 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-6411-gllmg-musl=m.gmane.org@lists.openwall.com Fri Oct 31 14:31:56 2014 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1XkCJ1-00048G-L1 for gllmg-musl@m.gmane.org; Fri, 31 Oct 2014 14:31:55 +0100 Original-Received: (qmail 24198 invoked by uid 550); 31 Oct 2014 13:31:54 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 24187 invoked from network); 31 Oct 2014 13:31:53 -0000 X-Mailer: Apple Mail (2.1510) Xref: news.gmane.org gmane.linux.lib.musl.general:6398 Archived-At: 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 =3D (uintptr_t)&__stack_chk_guard * = 1103515245; =20 the number equates to 0x41c64e6d. Called from __init_libc as: __init_ssp((void *)aux[AT_RANDOM]);=20 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