Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141106154305.GB22465@brightrain.aerifal.cx>
Date: Thu, 6 Nov 2014 10:43:05 -0500
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: fixing -fPIE + -fstack-protector-all

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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.