You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "casaroli (via GitHub)" <gi...@apache.org> on 2026/10/08 09:54:52 UTC

[PR] arch/arm64: Report a recovered user fault as a segmentation fault. [nuttx]

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

   ## Summary
   
   On arm64, a user fault that the kernel recovers from looks like a kernel failure. `arm64_fatal_handler()` prints "PANIC: Unhandled user exception" and a full register dump, but it then only kills the offending task with SIGSEGV. This change prints "Segmentation fault in <process> (PID n: <thread>)", the same message as risc-v, and keeps the register dump for the fatal path.
   
   `arm64_el1_undef()` also reads the words around ELR. For an exception from EL0 these are user addresses that can be in an unmapped page. A fault there is a nested exception that trips the DEBUGASSERT in `arm64_fatal_handler()`. This change skips the dump for EL0 and keeps it for EL1.
   
   The first commit fixes an older nxstyle error in `arm64_fatal.c`, because CI checks every file that a change touches. It changes whitespace only.
   
   ## Impact
   
   Only the console output changes, for faults from EL0, which happen in kernel builds. Recovery behaviour does not change. Kernel faults still panic with the register dump.
   
   ## Testing
   
   QEMU, `qemu-armv8a:knsh` with apps `examples/sandbox` and `ostest`, Arm GNU Toolchain 14.2.rel1 (aarch64-none-elf).
   
   Before (master), `sandbox 0x40000000`:
   
   ```
   arm64_exception_handler: ESR_ELn: 0x9200000e
   arm64_fatal_handler: PANIC: Unhandled user exception in PID 10: sandbox
   arm64_fatal_handler: Reason: DABT (lower EL) - Data Abort from a lower Exception level, that might be using AArch32 or AArch64
   up_dump_register: stack = 0x402dfcc0
   up_dump_register: x0:   0x0                 x1:   0x7ffffffe
   ...
   sandbox: the offender exited with status 2816
   ```
   
   After:
   
   ```
   arm64_exception_handler: ESR_ELn: 0x9200000e
   arm64_fatal_handler: Segmentation fault in sandbox (PID 10: sandbox)
   arm64_fatal_handler: Reason: DABT (lower EL) - Data Abort from a lower Exception level, that might be using AArch32 or AArch64
   sandbox: the offender exited with status 2816
   sandbox: CONTAINED - 1 target(s), every check passed
   ```
   
   An undefined instruction at EL0 (a local test probe, not part of this PR) now prints the following, and the shell survives:
   
   ```
   arm64_el1_undef: Undefined instruction at 0xc00023bc
   arm64_fatal_handler: Segmentation fault in sandbox (PID 21: sandbox)
   ```
   
   On today's master I could not make the dump read an unmapped page: the word before the start of the text was mapped. The skip for EL0 prevents that case.
   
   `ostest` exits with status 0 before and after this change.
   
   `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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] arch/arm64: Report a recovered user fault as a segmentation fault. [nuttx]

Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis merged PR #20510:
URL: https://github.com/apache/nuttx/pull/20510


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] arch/arm64: Report a recovered user fault as a segmentation fault. [nuttx]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20510:
URL: https://github.com/apache/nuttx/pull/20510#issuecomment-6059553287

   <!-- membrowse-pr-comment -->
   ## <img src="https://membrowse.com/membrowse-logo.svg" height="24" align="top"> MemBrowse Memory Report
   
   ### [qemu-armv8a](https://membrowse.com/public/apache/nuttx/target/qemu-armv8a/compare?head=d51a87198c57bf7523974b351e062c6f544d7da2&base=9cf38e7fbeb054aecd21086cfb673361589bb72f)
     - **Code**: .text.arm64_fatal_handler -12 B (-0.0%, 346,972 B)
   *No memory changes detected for:*
   - [arduino-mega2560](https://membrowse.com/public/apache/nuttx/target/arduino-mega2560/compare?head=d51a87198c57bf7523974b351e062c6f544d7da2&base=9cf38e7fbeb054aecd21086cfb673361589bb72f)
   - [esp32-devkitc](https://membrowse.com/public/apache/nuttx/target/esp32-devkitc/compare?head=d51a87198c57bf7523974b351e062c6f544d7da2&base=9cf38e7fbeb054aecd21086cfb673361589bb72f)
   - [hifive1-revb](https://membrowse.com/public/apache/nuttx/target/hifive1-revb/compare?head=d51a87198c57bf7523974b351e062c6f544d7da2&base=9cf38e7fbeb054aecd21086cfb673361589bb72f)
   - [mirtoo](https://membrowse.com/public/apache/nuttx/target/mirtoo/compare?head=d51a87198c57bf7523974b351e062c6f544d7da2&base=9cf38e7fbeb054aecd21086cfb673361589bb72f)
   - [qemu-intel64](https://membrowse.com/public/apache/nuttx/target/qemu-intel64/compare?head=d51a87198c57bf7523974b351e062c6f544d7da2&base=9cf38e7fbeb054aecd21086cfb673361589bb72f)
   - [rx65n-rsk2mb](https://membrowse.com/public/apache/nuttx/target/rx65n-rsk2mb/compare?head=d51a87198c57bf7523974b351e062c6f544d7da2&base=9cf38e7fbeb054aecd21086cfb673361589bb72f)
   - [s698pm-dkit](https://membrowse.com/public/apache/nuttx/target/s698pm-dkit/compare?head=d51a87198c57bf7523974b351e062c6f544d7da2&base=9cf38e7fbeb054aecd21086cfb673361589bb72f)
   - [stm32-nucleo-f103rb](https://membrowse.com/public/apache/nuttx/target/stm32-nucleo-f103rb/compare?head=d51a87198c57bf7523974b351e062c6f544d7da2&base=9cf38e7fbeb054aecd21086cfb673361589bb72f)
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org