casaroli opened a new pull request, #20950:
URL: https://github.com/apache/nuttx/pull/20950

   ## Summary
   
   On armv7-a, a data abort, a prefetch abort or an undefined instruction of 
user code caused a panic of the whole system, also in the kernel build. On 
arm64, RISC-V and x86_64 the same fault ends only the process.
   
   With this change armv7-a does the same. The new `arm_fault_kill()` 
(`arm_userfault.c`) makes the exception return to `_exit(SIGSEGV)` in SYS mode, 
on the kernel stack of the task if it has one. A fault of the kernel, also in a 
system call, is fatal as before.
   
   ## Impact
   
   armv7-a kernel build: a fault in user mode ends the process, and `wait()` 
gives exit status 11 (as on arm64 and RISC-V). As on arm64, the process ends 
without a call to its `SIGSEGV` handler, also when it ignores or blocks 
`SIGSEGV`. The flat build runs all tasks in SYS mode, so `arm_fault_kill()` 
returns false and nothing changes there. `CONFIG_LEGACY_PAGING` keeps its own 
path.
   
   ## Testing
   
   Test program `segvchild.c`: the program starts itself with `posix_spawn()`, 
the child stores to address 0, and the parent waits and prints how the child 
ended. Three rounds.
   
   `qemu-armv7a:knsh` (kernel build, QEMU 11, Arm GNU 13.2) with 
`CONFIG_SCHED_CHILD_STATUS`:
   
   | | master | this PR |
   |---|---|---|
   | `segvchild` | the first fault stops the system: `arm_dataabort: Data 
abort. PC: 800001e8 DFAR: 00000000`, then `Assertion failed panic: at file: 
armv7-a/arm_dataabort.c:174` | `arm_fault_kill: Segmentation fault in 
/system/bin/getprime (PID 5: ...)`, the parent gets "child exited with 11" and 
goes on: PASS 3 of 3 |
   | `ostest` in the same boot | (system reset by the panic) | `Exiting with 
status 0` |
   
   A child that ignores or blocks `SIGSEGV` also ends with exit status 11. A 
`SIGSEGV` handler does not run: the task ends at once, as on arm64 and RISC-V.
   
   `qemu-armv8a:knsh` (kernel) and `qemu-armv8a:nsh` (flat): `ostest` exits 
with status 0 (QEMU with HVF). `qemu-armv7a:nsh` (flat, armv7-a) builds.
   
   `tools/checkpatch.sh -c -u -m -g` passes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to