Skip to content

gem5 syscall emulation does not handle unhandled signals gracefully and fails e.g. with "panic: Page table fault when accessing virtual address 0x400" #101

Open
@cirosantilli

Description

@cirosantilli

LKMC 6936bd6 and gem5 master 8549ee4a6dfc86a941cee0a478c01f6f2c146c3c

By that we mean that the simulation prints a bunch of "crap" at the end, making it harder to see the assertion failed message. E.g.:

./run --arch aarch64 --emulator gem5 --static \
  --userland userland/c/assert_fail.c --gem5-worktree master

exits with:

assert_fail.out: /path/to/linux-kernel-module-cheat/userland/c/assert_fail.c:15: main: Assertion `0' failed.
warn: ignoring syscall rt_sigprocmask(...)
      (further warnings will be suppressed)
warn: ignoring syscall rt_sigaction(...)
panic: Page table fault when accessing virtual address 0x400
Memory Usage: 728556 KBytes
Program aborted at tick 5866500

followed by a stack trace, and:

./run --arch x86_64 --emulator gem5 --static \
  --userland userland/c/assert_fail.c --gem5-worktree master

has:


assert_fail.out: /path/to/linux-kernel-module-cheat/userland/c/assert_fail.c:15: main: Assertion `0' failed.
warn: ignoring syscall rt_sigprocmask(...)
      (further warnings will be suppressed)
warn: ignoring syscall rt_sigaction(...)
      (further warnings will be suppressed)
Exiting @ tick 18446744073709551615 because simulate() limit reached
error: simulation error detected by parsing logs

QEMU on the other hand produces crystal clear output, and that is what gem5 should do too:

assert_fail.out: /path/to/linux-kernel-module-cheat/userland/c/assert_fail.c:15: main: Assertion `0' failed.
qemu: uncaught target signal 6 (Aborted) - core dumped

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions