On 2021/05/18 6:21, 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.

Note that I am seeing similar problems on RISC-V NOMMU builds with the latest
buildroot/busybox 1.33. I had no time to explore the reason for it yet though.
It sounds like it may be a similar problem as yours.

> 
> The segfault appear very early in __uClibc_main while starting any binaries,
> an issue located in crt1.S (powerpc)[2].

Same early segfault I am seeing on init shell startup (used as init process in
my case).

> 
> 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.
> 
> 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=810ba387bec3c5b6904e8893fb4cb6f9d3717466
> [2]
> https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libc/sysdeps/linux/powerpc/crt1.S?id=2bf4991c4dd7b50b74656011dea9c40464ff390c#n47
> [3]
> https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/Rules.mak?id=2bf4991c4dd7b50b74656011dea9c40464ff390c#n486
> [4]
> https://sourceware.org/git/?p=glibc.git;a=commit;h=59261ad3eb345e0d7b9f5c73e1a09d046991cea5
> 
> Best regards,
> Romain
> _______________________________________________
> devel mailing list
> devel@uclibc-ng.org
> https://mailman.uclibc-ng.org/cgi-bin/mailman/listinfo/devel
> 


-- 
Damien Le Moal
Western Digital Research
_______________________________________________
devel mailing list
devel@uclibc-ng.org
https://mailman.uclibc-ng.org/cgi-bin/mailman/listinfo/devel

Reply via email to