From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/6460 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: fixing -fPIE + -fstack-protector-all Date: Thu, 6 Nov 2014 10:43:05 -0500 Message-ID: <20141106154305.GB22465@brightrain.aerifal.cx> References: <545A414F.8000407@barfooze.de> <20141105180140.5d98fee9@vostro> <545B657F.8060805@opensource.dyc.edu> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1415288606 11144 80.91.229.3 (6 Nov 2014 15:43:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 6 Nov 2014 15:43:26 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-6473-gllmg-musl=m.gmane.org@lists.openwall.com Thu Nov 06 16:43:19 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 1XmPDT-0006zS-9Q for gllmg-musl@m.gmane.org; Thu, 06 Nov 2014 16:43:19 +0100 Original-Received: (qmail 8140 invoked by uid 550); 6 Nov 2014 15:43:18 -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 8132 invoked from network); 6 Nov 2014 15:43:17 -0000 Content-Disposition: inline In-Reply-To: <545B657F.8060805@opensource.dyc.edu> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:6460 Archived-At: On Thu, Nov 06, 2014 at 07:11:43AM -0500, Anthony G. Basile wrote: > >Basically, __stack_chk_fail_local symbol should be provided always. > > Agreed. The symbol is there on both x86_64 and i386 in > libc_nonshared.a (glibc). > > What I've never understood is why this appears only as an issue in > i686 and not x86_64 for musl. I haven't had time to dig into gcc > internals to find out why. __stack_chk_fail_local is needed on any arch/ABI where calls through the PLT require a valid GOT pointer to be setup by the caller. GCC always makes a local call for SSP violations so that it doesn't impose GOT pointer initialization on every single function; the GOT pointer initialization is deferred to the local function, which is then able to safely call the non-local function __stack_chk_fail. On x86_64, a GOT pointer is needed because the ISA supports direct PC-relative addressing which can be used by the PLT to jump to get the actual function address from the GOT. I'm not sure if there are others that have this nice property. Rich