Skip to content

so3: terminate the faulting user process on an EL0 abort instead of panicking#301

Open
daniel-rossier wants to merge 1 commit into
mainfrom
fix/el0-abort-kill-process
Open

so3: terminate the faulting user process on an EL0 abort instead of panicking#301
daniel-rossier wants to merge 1 commit into
mainfrom
fix/el0-abort-kill-process

Conversation

@daniel-rossier

Copy link
Copy Markdown
Contributor

Problem

A synchronous abort taken from EL0 — a fault in the running user process, e.g. a NULL-pointer dereference — used to fall through trap_handle()'s default path to trap_handle_error() + kernel_panic(), bringing down the whole kernel (infinite loop, IRQs off). A single buggy user program hangs the system.

Fix

Handle EL0 aborts (ESR_ELx_EC_DABT_LOW / ESR_ELx_EC_IABT_LOW) in a new user_fault() (arch/arm64/traps.c):

  • report which process faulted and where (process "<name>" (pid N) faulted at address 0x… (pc=0x…, ESR=0x…));
  • sys_do_exit_group() to terminate only that process; the parent's wait4() reaps it and the shell reprints its prompt.

Kernel-mode (EL1) aborts use a different exception class (DABT/IABT "current EL") and still reach the fatal path, so real kernel bugs still panic. Scoped to !CONFIG_AVZ (AVZ keeps its mmio-decode / s3c_crash path).

Verification

Built + run in QEMU (virt64, standalone). A user process that dereferences a NULL pointer now prints e.g.:

[SO3] process "/crashme.elf" (pid 3) faulted at address 0x8c (pc=0x400238, ESR=0x92000046) - terminating it.
/ %

and the shell stays alive (ls afterwards works), instead of the previous ### ERROR CAUGHT … kernel_panic() hang.

…anicking

A data/instruction abort taken from EL0 (ESR_ELx_EC_DABT_LOW / IABT_LOW) is a
fault in the running user process — typically a NULL-pointer dereference. It
used to fall through to trap_handle_error() + kernel_panic(), bringing down the
whole kernel. Handle it in a new user_fault(): report which process faulted and
where, then sys_do_exit_group() to kill only that process so the shell regains
control. Kernel-mode (EL1) aborts use a different exception class and still
reach the fatal path. Scoped to !CONFIG_AVZ (AVZ keeps its mmio-decode /
s3c_crash path).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant