Skip to content

arch/x86_64: fix kernel build issues found with LTP - #19791

Merged
xiaoxiang781216 merged 3 commits into
apache:masterfrom
raiden00pl:fix-x86_64-kernel-signals
Aug 11, 2026
Merged

arch/x86_64: fix kernel build issues found with LTP#19791
xiaoxiang781216 merged 3 commits into
apache:masterfrom
raiden00pl:fix-x86_64-kernel-signals

Conversation

@raiden00pl

Copy link
Copy Markdown
Member

Summary

  • arch/x86_64: restore the kernel stack when a signal handler returns
  • arch/x86_64: run the signal trampoline on the thread kernel stack
  • arch/x86_64: align the user signal frame and skip the ABI red zone

Impact

intel64 kernel build fixes

Testing

intel64 qemu in kernel build with LTP.

LTP tests without and with these commits:

image

SYS_signal_handler_return restored RSP from saved_rsp, which is not
written when a task signals itself: synchronous dispatch skips
up_schedule_sigaction(), so the kernel stack pointer was set to zero
and the next push faulted. Save the kernel stack pointer at dispatch
in xcp.kstkptr, as risc-v does, and restore that.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
For a thread interrupted in user mode the trampoline ran on the user
stack, where the signal handler then grows over its frame. Run it on
the thread kernel stack, unused while the thread is in user mode. The
stack cannot be selected from the saved CS: up_initial_state() records
the caller CS, a kernel selector even for user threads.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
The signal frame was built inside the 128 byte red zone of the
interrupted user code and inherited its stack alignment, so a leaf
function could lose live data to the siginfo copy and the handler
could fault on an SSE access. Build the frame below the red zone,
16 byte aligned; the naked trampoline calls the handler itself and
its call provides the return address slot.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
@github-actions github-actions Bot added Arch: x86_64 Issues related to the x86_64 architecture Size: S The size of the change in this PR is small labels Aug 11, 2026
@github-actions

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

@xiaoxiang781216
xiaoxiang781216 merged commit 481d169 into apache:master Aug 11, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: x86_64 Issues related to the x86_64 architecture Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants