Skip to content

arch/arm64: handle fatal user exception#18490

Merged
anchao merged 1 commit intoapache:masterfrom
tiiuae:arm64_user_exception
Mar 5, 2026
Merged

arch/arm64: handle fatal user exception#18490
anchao merged 1 commit intoapache:masterfrom
tiiuae:arm64_user_exception

Conversation

@jnippula
Copy link
Contributor

@jnippula jnippula commented Mar 4, 2026

Summary

Add handler to arm64 for unhandled user exception. Print exception reason class and description and dump registers. The exception info collection is moved to separate function to avoid duplicate code.

Impact

When user application/module panics the system does not halt, but only the user process exits.

Testing

Tested with custom target by adding null pointer reference into one of the user modules to generate user exception.
When panic occurs, following is printed into the console:

[CPU0] arm64_fatal_handler: PANIC: Unhandled user exception in PID 23: commander
[CPU0] arm64_fatal_handler: Reason: DABT (lower EL) - Data Abort from a lower Exception level, that might be using AArch32 or AArch64
[CPU0] up_dump_register: stack = 0x809a2500
[CPU0] up_dump_register: x0:   0x0                 x1:   0xc0032cd8
[CPU0] up_dump_register: x2:   0x0                 x3:   0x0
[CPU0] up_dump_register: x4:   0x8000000000000000  x5:   0x0
[CPU0] up_dump_register: x6:   0x80                x7:   0xff62686d606ffefe
[CPU0] up_dump_register: x8:   0x7f7f7f7f7f7fffff  x9:   0x0
[CPU0] up_dump_register: x10:  0x101010101010101   x11:  0x38
[CPU0] up_dump_register: x12:  0x101010101010101   x13:  0x8
[CPU0] up_dump_register: x14:  0xffffffffffffffe   x15:  0x10
[CPU0] up_dump_register: x16:  0x17                x17:  0x0
[CPU0] up_dump_register: x18:  0x0                 x19:  0xc200aee0
[CPU0] up_dump_register: x20:  0x1                 x21:  0xc200af5a
[CPU0] up_dump_register: x22:  0xc200aed8          x23:  0xc0031810
[CPU0] up_dump_register: x24:  0xc00317df          x25:  0xa
[CPU0] up_dump_register: x26:  0x9                 x27:  0x2
[CPU0] up_dump_register: x28:  0x0                 x29:  0x0
[CPU0] up_dump_register: x30:  0xc000d704        
[CPU0] up_dump_register: 
[CPU0] up_dump_register: STATUS Registers:
[CPU0] up_dump_register: SPSR:      0x0               
[CPU0] up_dump_register: ELR:       0xc000d70c        
[CPU0] up_dump_register: SP_EL0:    0xc200ad80        
[CPU0] up_dump_register: SP_ELX:    0x809a2840        
[CPU0] up_dump_register: EXE_DEPTH: 0xffffffffffffffc4
[CPU0] up_dump_register: SCTLR_EL1: 0x30d0180d

After the register dump the user process exits and the nsh shell is still alive and usable.

@github-actions github-actions bot added Arch: arm64 Issues related to ARM64 (64-bit) architecture Size: M The size of the change in this PR is medium labels Mar 4, 2026
jerpelea
jerpelea previously approved these changes Mar 4, 2026
Print user exception reason class and description
Print register dump

Signed-off-by: Jari Nippula <jari.nippula@tii.ae>
@jnippula jnippula requested a review from jerpelea March 5, 2026 07:07
@anchao anchao merged commit 5cd57fa into apache:master Mar 5, 2026
13 checks passed
@jnippula jnippula deleted the arm64_user_exception branch March 5, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm64 Issues related to ARM64 (64-bit) architecture Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants