cirosantilli / linux-kernel-module-cheat

The perfect emulation setup to study and develop the Linux kernel v5.4.3, kernel modules, QEMU, gem5 and x86_64, ARMv7 and ARMv8 userland and baremetal assembly, ANSI C, C++ and POSIX. GDB step debug and KGDB just work. Powered by Buildroot and crosstool-NG. Highly automated. Thoroughly documented. Automated tests. "Tested" in an Ubuntu 24.04 host.
https://cirosantilli.com/linux-kernel-module-cheat
GNU General Public License v3.0
4.21k stars 605 forks source link

gem5 syscall emulation aarch64 dynamic linking fails on nostartfiles/exit.S with panic: Page table fault when accessing virtual address 0 #107

Open cirosantilli opened 5 years ago

cirosantilli commented 5 years ago

gem5 bcf041f257623e5c9e77d35b7531bae59edc0423 LKMC 62930b6acf85defffc76ca27dce3ec2f516830c0 just after dynamic linking was added:

./run -aA -eg -u userland/arch/aarch64/nostartfiles/exit.S --gem5-worktree master --trace ExecAll,-ExecSymbol 

Failure happens in dynamic loader itself.

We can see what code the trace corresponds to with (we easily guess that dynloader goes at offset 0x4000000000):

aarch64-linux-gnu-objdump -S /work/linux-kernel-module-cheat/out/buildroot/build/default/aarch64/staging/lib/ld-2.27.so  | s