[PATCH 0/1] MR5227: ntdll: Respect red zone in usr1_handler() on x64.
Fixes a regression introduced by efd3d31082645fab83c6a4994705654edafa9163 ("ntdll: Don't copy xstate from / to syscall frame in usr1_handler()."). SysV x64 ABI assumes 128 byte red zone below stack pointer (for optimizing leaf functions by using the space below rsp saving some stack allocation instructions). I stomped on that red zone is used for real in win32u Unix lib leaf functions causing random crashes inside win32u syscalls when sigusr1 clobbers that zone. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5227
From: Paul Gofman <pgofman(a)codeweavers.com> Fixes a regression introduced by efd3d31082645fab83c6a4994705654edafa9163. --- dlls/ntdll/unix/signal_x86_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index fb1bca99f3d..d071120af85 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -2152,7 +2152,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) ULONG64 saved_compaction = 0; struct xcontext *context; - context = (struct xcontext *)(((ULONG_PTR)RSP_sig(ucontext) - sizeof(*context)) & ~15); + context = (struct xcontext *)(((ULONG_PTR)RSP_sig(ucontext) - 128 /* red zone */ - sizeof(*context)) & ~15); if ((char *)context < (char *)ntdll_get_thread_data()->kernel_stack) { ERR_(seh)( "kernel stack overflow.\n" ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/5227
participants (2)
-
Paul Gofman -
Paul Gofman (@gofman)