raiden00pl opened a new pull request, #21489: URL: https://github.com/apache/nuttx/pull/21489
## Summary
SYSRET loads SS from the STAR SYSRET base plus 8. The Intel SDM forces the
RPL of SS to 3 (`SS.Selector := (IA32_STAR[63:48]+8) OR 3`); AMD CPUs load
the selector as computed. NuttX sets the base to `X86_GDT_USERDATA_SEL -
8`
(0x28, RPL 0), so on AMD user code runs with SS 0x30. The next interrupt
from
user mode saves that SS, and the iretq back to user mode fails with
#GP(0x30),
which panics the kernel:
x86_64_fault_panic_isr: Exception 13 occurred with error code 48:
Assertion failed panic: at file:
/arch/x86_64/src/intel64/intel64_irq.c:503 task: fstl
Add the user RPL to the base. SS is then 0x33 on both vendors; CS stays
0x3b.
## Impact
x86_64 kernel builds (CONFIG_BUILD_KERNEL). No change in behaviour on
Intel,
which ignores these bits. Flat builds do not return to user mode with
SYSRET.
## Testing
qemu-intel64 kernel build (init and programs loaded over virtio 9P), KVM,
a file system test run with two user threads writing at once:
- GitHub-hosted runners, master: panic in 2 of 2 runs
- GitHub-hosted runners, this change: 3 of 3 runs pass, whole test set
(77 passed)
- Intel host (Core Ultra 9 285K): no panic with or without this change
(hundreds of runs of the same test)
--
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]
