[PATCH 1/3] Add inhibit_stack_protector to ifuncmain9 [BZ #25680]
H.J. Lu
hjl.tools@gmail.com
Fri Mar 12 19:55:18 GMT 2021
On Fri, Mar 12, 2021 at 10:29 AM Adhemerval Zanella via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
>
>
> On 12/03/2021 05:52, Siddhesh Poyarekar wrote:
> > On 3/10/21 6:20 PM, Adhemerval Zanella via Libc-alpha wrote:
> >>
> >>
> >> On 10/03/2021 07:13, Siddhesh Poyarekar via Libc-alpha wrote:
> >>> From: David Hughes <davidhughes205@gmail.com>
> >>>
> >>> Enabling --enable-stack-protector=all causes the following tests to fail:
> >>>
> >>> FAIL: elf/ifuncmain9picstatic
> >>> FAIL: elf/ifuncmain9static
> >>>
> >>> Nick Alcock (who committed the stack protector code) marked the IFUNC
> >>> resolvers with inhibit_stack_protector when he done the original work and
> >>> suggested doing so again @ BZ #25680. This patch adds
> >>> inhibit_stack_protector to ifuncmain9.
> >>>
> >>> After patch is applied, --enable-stack-protector=all does not fail the
> >>> above tests.
> >>
> >> The BZ#25680 report makes me wonder if would be better to just disable
> >> --enable-stack-protector=all on architecture with IFUNC for now.
> >> This fix the issue on glibc testsuite, but it might still trigger
> >> by users if this same trick is not used (as noted by Sergei).
> >
> > The general problem is that it is at best pointless to add stack protector prologue/epilogue to ifunc resolver functions in static binaries. On x86_64 it is visible because it results in a crash due to TLS segment register %fs not being set up but elsewhere, the stack chk guard is zero, which makes the dereference safe, but useless. On ppc64le, the TLS setup happens first, thus avoiding the crash and behaving like the other non-TLS stack_chk_guard architectures.
> >
> > One way to make it not crash on x86_64 could be to delay ifunc resolution (which would then mean making sure that TLS doesn't use ifunc'd functions, e.g. memcpy) and bring it on par with the rest of the architectures.
>
> Is it something preventing us to make x86 follows other architectures in this
> regard?
>
On x86-64, IFUNC was disabled in ld.so before. Now IFUNC is selectly
enabled in ld.so.
If you want to disable one specific IFUNC in ld.so on x86-64, please
open a glibc bug and
CC me.
--
H.J.
More information about the Libc-alpha
mailing list