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 x86 boot fails with: "Assertion `locked && curr_frag_id == 0' failed" #64

Closed cirosantilli closed 5 years ago

cirosantilli commented 5 years ago

At e6963b1938cdff9e7818118dba73270f254fe9ec bisected down to gem5 commit https://github.com/gem5/gem5/commit/c58cb8c9dbeef377da180f1fdaaa1c0eadf85550

system.terminal is empty.

stdout:

c58cb8c9dbeef377da180f1fdaaa1c0eadf85550
./run -eg --gem5-build-id bisect
+ cat << 'EOF' > /home/ciro/bak/git/linux-kernel-module-cheat/out/run/gem5/x86_64/0/readfile
/home/ciro/bak/git/linux-kernel-module-cheat/out/run/gem5/x86_64/0/readfile
EOF
+ M5_PATH=/home/ciro/bak/git/linux-kernel-module-cheat/out/gem5/bisect/system \
  M5_OVERRIDE_PY_SOURCE=true \
  /home/ciro/bak/git/linux-kernel-module-cheat/out/gem5/bisect/build/X86/gem5.opt \
  --debug-file trace.txt \
  --listener-mode on \
  --outdir /home/ciro/bak/git/linux-kernel-module-cheat/out/run/gem5/x86_64/0/m5out \
  /home/ciro/bak/git/linux-kernel-module-cheat/submodules/gem5/configs/example/fs.py \
  --disk-image /home/ciro/bak/git/linux-kernel-module-cheat/out/buildroot/build/default/x86_64/images/rootfs.ext2 \
  --kernel /home/ciro/bak/git/linux-kernel-module-cheat/out/linux/default/x86_64/vmlinux \
  --mem-size 256MB \
  --num-cpus 1 \
  --script /home/ciro/bak/git/linux-kernel-module-cheat/out/run/gem5/x86_64/0/readfile \
  --command-line 'earlyprintk=ttyS0 lpj=7999923 root=/dev/sda console_msg_format=syslog nokaslr norandmaps panic=-1 printk.devkmsg=on printk.time=y rw console=ttyS0 - lkmc_home=/lkmc' \
;
gem5 Simulator System.  http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.

gem5 compiled May 19 2019 21:03:33
gem5 started May 19 2019 21:06:11
gem5 executing on ciro-p51, pid 32172
command line: /home/ciro/bak/git/linux-kernel-module-cheat/out/gem5/bisect/build/X86/gem5.opt --debug-file trace.txt --listener-mode on --outdir /home/ciro/bak/git/linux-kernel-module-cheat/out/run/gem5/x86_64/0/m5out /home/ciro/bak/git/linux-kernel-module-cheat/submodules/gem5/configs/example/fs.py --disk-image /home/ciro/bak/git/linux-kernel-module-cheat/out/buildroot/build/default/x86_64/images/rootfs.ext2 --kernel /home/ciro/bak/git/linux-kernel-module-cheat/out/linux/default/x86_64/vmlinux --mem-size 256MB --num-cpus 1 --script /home/ciro/bak/git/linux-kernel-module-cheat/out/run/gem5/x86_64/0/readfile --command-line 'earlyprintk=ttyS0 lpj=7999923 root=/dev/sda console_msg_format=syslog nokaslr norandmaps panic=-1 printk.devkmsg=on printk.time=y rw console=ttyS0 - lkmc_home=/lkmc'

Global frequency set at 1000000000000 ticks per second
warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (256 Mbytes)
info: kernel located at: /home/ciro/bak/git/linux-kernel-module-cheat/out/linux/default/x86_64/vmlinux
system.pc.com_1.device: Listening for connections on port 3456
0: system.remote_gdb: listening for remote gdb on port 7000
warn: Reading current count from inactive timer.
**** REAL SIMULATION ****
info: Entering event queue @ 0.  Starting simulation...
warn: x86 cpuid family 0x0000: unimplemented function 6
warn: x86 cpuid family 0x0000: unimplemented function 6
warn: x86 cpuid family 0x0000: unimplemented function 6
gem5.opt: /home/ciro/bak/git/linux-kernel-module-cheat/out/gem5/bisect/build/X86/cpu/simple/atomic.cc:544: virtual Fault AtomicSimpleCPU::writeMem(uint8_t*, unsigned int, Addr, Request::Flags, uint64_t*, const std::vector<bool>&): Assertion `locked && curr_frag_id == 0' failed.
Program aborted at tick 3570071000
--- BEGIN LIBC BACKTRACE ---
/home/ciro/bak/git/linux-kernel-module-cheat/out/gem5/bisect/build/X86/gem5.opt(_Z15print_backtracev+0x2c)[0x55a930dbce9c]
/home/ciro/bak/git/linux-kernel-module-cheat/out/gem5/bisect/build/X86/gem5.opt(_Z12abortHandleri+0x4a)[0x55a930dccbfa]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x13f40)[0x7f2655bf2f40]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7f2655152ed7]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x121)[0x7f2655134535]
/lib/x86_64-linux-gnu/libc.so.6(+0x2540f)[0x7f265513440f]
/lib/x86_64-linux-gnu/libc.so.6(+0x35012)[0x7f2655144012]
/home/ciro/bak/git/linux-kernel-module-cheat/out/gem5/bisect/build/X86/gem5.opt(_ZN15AtomicSimpleCPU8writeMemEPhjm5FlagsImEPmRKSt6vectorIbSaIbEE+0x825)[0x55a930cf5a25]
/home/ciro/bak/git/linux-kernel-module-cheat/out/gem5/bisect/build/X86/gem5.opt(_ZN17SimpleExecContext8writeMemEPhjm5FlagsImEPmRKSt6vectorIbSaIbEE+0x63)[0x55a930d044e3]
/home/ciro/bak/git/linux-kernel-module-cheat/out/gem5/bisect/build/X86/gem5.opt(+0xb7b331)[0x55a930c11331]
/home/ciro/bak/git/linux-kernel-module-cheat/out/gem5/bisect/build/X86/gem5.opt(_ZNK10X86ISAInst4Stul7executeEP11ExecContextPN5Trace10InstRecordE+0x202)[0x55a930c3cb02]
/home/ciro/bak/git/linux-kernel-module-cheat/out/gem5/bisect/build/X86/gem5.opt(_ZN15AtomicSimpleCPU4tickEv+0x4dc)[0x55a930cf386c]
/home/ciro/bak/git/linux-kernel-module-cheat/out/gem5/bisect/build/X86/gem5.opt(_ZN10EventQueue10serviceOneEv+0x8c)[0x55a930dc342c]
/home/ciro/bak/git/linux-kernel-module-cheat/out/gem5/bisect/build/X86/gem5.opt(_Z9doSimLoopP10EventQueue+0x108)[0x55a930ddac28]
/home/ciro/bak/git/linux-kernel-module-cheat/out/gem5/bisect/build/X86/gem5.opt(_Z8simulatem+0xa5a)[0x55a930ddb97a]
/home/ciro/bak/git/linux-kernel-module-cheat/out/gem5/bisect/build/X86/gem5.opt(+0x13d63e0)[0x55a93146c3e0]
/home/ciro/bak/git/linux-kernel-module-cheat/out/gem5/bisect/build/X86/gem5.opt(+0x5b1c50)[0x55a930647c50]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x60f2)[0x7f2655d160a2]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x732)[0x7f2655d0f852]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x62e9)[0x7f2655d16299]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x732)[0x7f2655d0f852]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x62e9)[0x7f2655d16299]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x732)[0x7f2655d0f852]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x62e9)[0x7f2655d16299]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x732)[0x7f2655d0f852]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCode+0x19)[0x7f2655d0fe69]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x6992)[0x7f2655d16942]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x732)[0x7f2655d0f852]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x62e9)[0x7f2655d16299]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x732)[0x7f2655d0f852]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCode+0x19)[0x7f2655d0fe69]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyRun_StringFlags+0x76)[0x7f2655ce8286]
--- END LIBC BACKTRACE ---
time 00:00:02
cirosantilli commented 5 years ago

Fixed on gem5 update 3527c8d