On 2021/05/20 19:30, Romain Naour wrote:
Hello Damien,
Le 18/05/2021 à 00:03, Damien Le Moal a écrit :
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 upstream Buildroot project only support RISC-V with MMU (BR2_ARCH_HAS_MMU_MANDATORY).
I have a series of patches for building bootable images for boards based on the Canaan Kendryte K210 SoC. These boards use NOMMU builds that the patch series enables. I also have elf2flt fixed and the kernel flatbin loader is already fixed in 5.13-rc. The crash on startup I am seeing with the latest buildroot/busybox is blocking me from posting the patch series though.
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).
When a binary segfault like this, it can be anythings related to the compiler, linker, assembler or the libc.
Agreed. I have not had time to debug yet. Busy on the kernel side. Your bug report did however give me one hint that it may be good to check that this relocation issue does not exist on riscv, since I tweaked elf2flt relocation code...
Will try to find some time to debug next week.
Cheers.