so3: terminate the faulting user process on an EL0 abort instead of panicking#301
Open
daniel-rossier wants to merge 1 commit into
Open
so3: terminate the faulting user process on an EL0 abort instead of panicking#301daniel-rossier wants to merge 1 commit into
daniel-rossier wants to merge 1 commit into
Conversation
…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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 totrap_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 newuser_fault()(arch/arm64/traps.c):process "<name>" (pid N) faulted at address 0x… (pc=0x…, ESR=0x…));sys_do_exit_group()to terminate only that process; the parent'swait4()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.:
and the shell stays alive (
lsafterwards works), instead of the previous### ERROR CAUGHT … kernel_panic()hang.