From: "Anthony G. Basile" <basile@opensource.dyc.edu>
To: musl@lists.openwall.com
Subject: Re: fixing -fPIE + -fstack-protector-all
Date: Thu, 06 Nov 2014 07:11:43 -0500 [thread overview]
Message-ID: <545B657F.8060805@opensource.dyc.edu> (raw)
In-Reply-To: <20141105180140.5d98fee9@vostro>
On 11/05/14 11:01, Timo Teras wrote:
> On Wed, 05 Nov 2014 16:25:03 +0100
> John Spencer <maillist-musl@barfooze.de> wrote:
>
>> using -fPIE + -fstack-protector-all is currently broken for a number
>> of architectures (most notably i386) in the default gcc setup
>> (including the musl-cross patches), as it depends on a
>> libssp_nonshared.a which provides __stack_chk_fail_local().
>
> In Alpine Linux we are patching gcc to unconditionally to have
> -lssp_nonshared:
> http://git.alpinelinux.org/cgit/aports/tree/main/gcc/gcc-4.8-musl-libssp.patch
The piepatches do not need to link in anything on glibc or uclibc,
whereas in your approach they need to pick up the symbol from
libc_unshared. It also doesn't depend on whether its a cross compile or
native attempt to boostrap into a hardened system (gentoo style) form a
non-hardened musl i686. In both cases it will fail unless you provide
__stack_chk_fail_local by some "hack".
>
> And making musl package provide that library:
> http://git.alpinelinux.org/cgit/aports/tree/main/musl/__stack_chk_fail_local.c
> http://git.alpinelinux.org/cgit/aports/tree/main/musl/APKBUILD#n60
>
> This is for two reasons:
>
> 1. gcc bootstrap is broken if it's to be compiled with
> -fstack-protector otherwise
>
> 2. Linking without "-fstack-protector" flag with .a or .o files that
> have been compiled with SSP would break.
>
> 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.
> Agreeably gcc should emit 'hlt' or similar instead of that function
> call. Or at least provide implementation for that function with 'once'
> linking.
>
> /Timo
>
--
Anthony G. Basile, Ph. D.
Chair of Information Technology
D'Youville College
Buffalo, NY 14201
(716) 829-8197
next prev parent reply other threads:[~2014-11-06 12:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-05 15:25 John Spencer
2014-11-05 15:43 ` Rich Felker
2014-11-05 16:01 ` John Spencer
2014-11-05 16:20 ` Rich Felker
2014-11-06 1:34 ` Andy Lutomirski
2014-11-06 1:44 ` Rich Felker
2014-11-06 11:45 ` Anthony G. Basile
2014-11-06 12:36 ` John Spencer
2014-11-07 12:25 ` Anthony G. Basile
2014-11-07 2:10 ` Andy Lutomirski
2014-11-07 12:16 ` Anthony G. Basile
2014-11-05 16:01 ` Timo Teras
2014-11-06 12:11 ` Anthony G. Basile [this message]
2014-11-06 15:43 ` Rich Felker
2014-11-06 12:40 ` John Spencer
2014-11-06 12:47 ` Timo Teras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=545B657F.8060805@opensource.dyc.edu \
--to=basile@opensource.dyc.edu \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).