From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12243 Path: news.gmane.org!.POSTED!not-for-mail From: Nicholas Wilson Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] split __libc_start_main.c into two files (Wasm) Date: Fri, 15 Dec 2017 11:34:10 +0000 Message-ID: References: <20171207170356.GX1627@brightrain.aerifal.cx>,<20171215041925.GG1627@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1513337668 13190 195.159.176.226 (15 Dec 2017 11:34:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 15 Dec 2017 11:34:28 +0000 (UTC) To: "musl@lists.openwall.com" Original-X-From: musl-return-12259-gllmg-musl=m.gmane.org@lists.openwall.com Fri Dec 15 12:34:25 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1ePoG0-0003Cy-HF for gllmg-musl@m.gmane.org; Fri, 15 Dec 2017 12:34:24 +0100 Original-Received: (qmail 14142 invoked by uid 550); 15 Dec 2017 11:34:28 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 14124 invoked from network); 15 Dec 2017 11:34:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=realvnc.onmicrosoft.com; s=selector1-realvnc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=duCdzVAJn+GGJPKjgnRgwbt336FLy8z+XBVM3685zRw=; b=ohKvzhPI8oqwKbUtjpGX+xpHmOwIqXR9P9T9zBwp172uAAx8AnnRR/asTIIL8N4knfAjCHCu+zCHzgAZ8h38zQ2NGVMGQ2pWy3mavLx44FWNBLOV2lnSYBgzPyM0ptrftzmUw38cCUgyfeP8ubf0a+cAzAcir+mVLQBPDMujDj4= Thread-Topic: [musl] [PATCH] split __libc_start_main.c into two files (Wasm) Thread-Index: AQHTb2pBP8VsOCdulkepcQ6wgWaD9qM4G+cAgAu9DICAAHLZ/w== In-Reply-To: <20171215041925.GG1627@brightrain.aerifal.cx> Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=nicholas.wilson@realvnc.com; x-originating-ip: [2a02:390:a001:192:d6be:d9ff:fe9c:1892] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;HE1PR0502MB3882;6:AHDptOMB6aKVMwQhssA5AptiGOciJMM57VEYXYyaKwFfehZtj4Dy6CAUpJS+vwo7IXJP/ngKfgmx8IxVZQAGKl5QLn7k6Yx+U20/K8Yk4zF/7G7vuhrftIgojlFSxd9Pyb8mrFJqbhyaFR7tpdyv00nIra7ckxIOovIOMbcwmAy8N3NvqQV26qDgAJjfdXLMGySN/HenMOmQizw/X1YxkkWdEhYZJ8jR9edx9KsQXq68VEXnZHNIfaf6+KUXik+kILLxNL02TaNj42PRUmhRUtbrXka3utcaulZprG9O7QaadlZFkZDck4iOYcVbqfVuE/GVH/v0/5zmayyblImvCS5j2UK7qdxK7pQx2xvY9Cg=;5:DI+BBxM7qOcyRnpim3btSYrihfuOamG0PGUr9x+4dOWijkkvX3czYcnJ0yxz7+HUsZC1u4sXx0iBIqengEkPL7O5Qi2k/wuV3S0rcICzLM6GMj6XDWYRb8xlTWD5tCmsOPkID6XkSlP7SqHbZBH6TGksYCg+MG2lkFN3Uf0utdU=;24:tnKBpQ1G+bq8VRQibU8brrswG7A7xZKVwGoRmKDdmqb0kocTD2dInHevZXNTZ1BVg6CfhZEIWBnPwgoyazlEhpd6Fw6VU98zI6i4qwek4lU=;7:YkCFsspaD88aHQ7YcQsd6+Auaz5Le6n1Q2TLzWYbRq6+C7DbqIv6wN+1kBfA1a9TIWCnMCF3qEwQ09SZzQbRlVRV/V0l gxL7XLMSw22h8Us9c6r/FGo6dwBRL8+QSNRCLJeyoOEbSfKZ/ArLO7AeLLybvrrlLh8+GT0R9Ofx5DSU2tq7WvxLsvVMEZTCFE x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: d1a11638-76be-4325-72c4-08d543afc26d x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(5600026)(4604075)(4534020)(4602075)(4603075)(4627115)(201702281549075)(2017052603307);SRVR:HE1PR0502MB3882; x-ms-traffictypediagnostic: HE1PR0502MB3882: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231023)(6041248)(20161123555025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(2016111802025)(20161123560025)(20161123564025)(20161123562025)(6072148)(6043046)(201708071742011);SRVR:HE1PR0502MB3882;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:HE1PR0502MB3882; x-forefront-prvs: 05220145DE x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(346002)(376002)(39840400004)(396003)(51914003)(199004)(189003)(24454002)(105586002)(3280700002)(305945005)(33656002)(55016002)(5640700003)(9686003)(7736002)(7696005)(106356001)(2351001)(8676002)(6436002)(53936002)(14454004)(478600001)(2900100001)(25786009)(6246003)(5250100002)(2501003)(68736007)(81166006)(74316002)(81156014)(2906002)(1730700003)(8936002)(3660700001)(102836003)(5660300001)(2950100002)(97736004)(6916009)(316002)(76176011)(53546011)(6506007)(6116002)(86362001)(99286004)(229853002);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR0502MB3882;H:HE1PR0502MB3883.eurprd05.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: realvnc.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM X-MS-Exchange-CrossTenant-Network-Message-Id: d1a11638-76be-4325-72c4-08d543afc26d X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2017 11:34:10.1052 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9ad766d3-c6a5-4458-8c58-244e7c118728 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0502MB3882 X-OriginatorOrg: realvnc.com Xref: news.gmane.org gmane.linux.lib.musl.general:12243 Archived-At: Hi Rich, I've only just noticed your replies - sorry! (Some went in my spam, oops, m= aybe because of "dalias@aerifal.cx on behalf of dalias@libc.org".) Thanks for the feedback, on this and the other patches. On Thu, Dec 07, 2017 at 12:03:56PM -0500, Rich Felker wrote: > __libc_start_init is intentionally not a public interface but part of > musl internals. There is no reason to assume it will continue to exist > with the same name or interface in future versions of musl. The public > interface for the entry point is __libc_start_main. That's right - it's a Musl internal. What I was planning to do though was t= o call it from within Musl, in the arch/wasm code. When I said it's a "publ= ic" symbol I meant "non-static/non-local" ie a symbol exposed for use withi= n Musl. > exit() is literally 9 instructions on x86_64, and likely comparably > small elsewhere. I don't see how trying to optimize it out makes > sense. The bulk of the code that runs at exit() when there's > nontrivial work to do at exit time is linked through dependencies from > other sources like stdio and atexit, and would be linked even if you > succeeded in optimizing exit out. To clarify, it's not exit() itself that's a problem. Remember we're using s= tatically-linked syscalls, so linking in exit() introduces a dependency on = SYS_exit_group/SYS_exit, which Wasm pulls in as external dependencies in th= e host emulation environment. It would be nice to avoid linking in syscalls= that aren't actually used, especially ones like SYS_exit that are a bit ug= ly to emulate. On Fri, Dec 15, 2017 at 04:19, Rich Felker wrote: > Another bug I overlooked here was that, by moving the code to a new > file, it would no longer be affected by $(NOSSP_SRCS) in Makefile, > thereby breaking builds with -fstack-protector or where the compiler > has it on by default. That could have been fixed if needed; I just > bring it up to show that there are subtle possibilities for breakage > like this that we should really either document rig up some sort of > static assertion to catch if there's a regression. Good point, I noticed that as well when splitting the file; I should have m= entioned it. I misunderstood how the stack-protection stuff worked, and I l= ooked at __init_libc and __libc_start_init and thought "these functions hav= e normal/valid stack usage, no need to turn off the protection for these". = But now I realise that it has to be turned off for all functions before __i= nit_ssp. Nick