Hi Romain,
Romain Naour wrote,
Hello,
Recently in Buildroot the option BR2_PIC_PIE has been enabled by default along
with other hardening features [1]. Since then some ppc defconfig such
qemu_ppc_e500mc_defconfig are failing to boot due to a segfault in init program.
The segfault appear very early in __uClibc_main while starting any binaries,
an issue located in crt1.S (powerpc)[2].
After some trial and error, removing HAVE_ASM_PPC_REL16 from CFLAGS [3]
allow to generate a working system again. But this is actually wrong since
instead we should consider HAVE_ASM_PPC_REL16 always true nowadays.
What if the assembly inside HAVE_ASM_PPC_REL16 isn't pie safe?
Indeed, Glibc removed HAVE_ASM_PPC_REL16 since version
2.22 [4] since "the
minimum binutils supports rel16 relocs". Binutils 2.22 supports R_PPC_REL16 as
default.
uClibc-ng should remove HAVE_ASM_PPC_REL16 but keep the code as it was defined.
But this doesn't fix the initial issue.
Any idea ?
[1]
https://git.buildroot.net/buildroot/commit/?id=810ba387bec3c5b6904e8893fb4c…
[2]
https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libc/sysdeps/linux/p…
[3]
https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/Rules.mak?id=2bf4991…
[4]
https://sourceware.org/git/?p=glibc.git;a=commit;h=59261ad3eb345e0d7b9f5c73…
best regards
Waldemar