Skip to content

_Ux86_64_setcontext should not read from stack after adjusting %rsp#1

Open
ngbronson-openai wants to merge 1 commit intomasterfrom
signal_safe_Ux86_64_setcontext
Open

_Ux86_64_setcontext should not read from stack after adjusting %rsp#1
ngbronson-openai wants to merge 1 commit intomasterfrom
signal_safe_Ux86_64_setcontext

Conversation

@ngbronson-openai
Copy link
Owner

@ngbronson-openai ngbronson-openai commented Nov 20, 2025

This diff changes _Ux86_64_setcontext so that it it doesn't read from its ucontext_t argument after adjusting %rsp, in case the ucontext_t is allocated on a portion of the stack that is inactive after that adjustment. This fixes a bug where signal delivery during c++ exception unwinding can trigger a segfault.

See libunwind#927 for a longer explanation and a repro, which was used to test this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant