[PATCH 0/1] MR11071: ntdll: Ignore hardware breakpoint traps inside the signal stack.
Ignore hardware-breakpoint traps raised to avoid recursively dispatching a trap through the Unix signal handler when user code installs a hardware breakpoint that is also reached from Wine's signal-handling path. This is split up from https://gitlab.winehq.org/wine/wine/-/merge_requests/11069 as asked. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11071
From: Soham Nandy <soham.nandy2006@gmail.com> Ignore hardware-breakpoint traps raised to avoid recursively dispatching a trap through the Unix signal handler when user code installs a hardware breakpoint that is also reached from Wine's signal-handling path --- dlls/ntdll/unix/signal_x86_64.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 41293fe5607..c48636ee194 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -2149,9 +2149,12 @@ static BOOL handle_syscall_trap( struct thread_data *data, ucontext_t *sigcontex R10_sig( sigcontext ) = RCX_sig( sigcontext ); fixup_frame_fpu_state( frame, sigcontext ); } - else if (siginfo->si_code == 4 /* TRAP_HWBKPT */ && is_inside_syscall( data, RSP_sig(sigcontext) )) + else if (siginfo->si_code == 4 /* TRAP_HWBKPT */ && + (is_inside_syscall( data, RSP_sig(sigcontext) ) || + is_inside_signal_stack( data, (void *)RSP_sig(sigcontext) ))) { - TRACE_(seh)( "ignoring HWBKPT in syscall rip=%p\n", (void *)RIP_sig(sigcontext) ); + TRACE_(seh)( "ignoring HWBKPT in syscall/signal stack rip=%p\n", + (void *)RIP_sig(sigcontext) ); return TRUE; } else return FALSE; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11071
For traceability, the application in question sets R/W breakpoints on several locations in the USD, including ProcessorFeatures[PF_RDWRFSGSBASE_AVAILABLE]. The application takes a SEGV and then the SEGV handler trips the breakpoint. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11071#note_142238
Paul Gofman (@gofman) commented about dlls/ntdll/unix/signal_x86_64.c:
R10_sig( sigcontext ) = RCX_sig( sigcontext ); fixup_frame_fpu_state( frame, sigcontext ); } - else if (siginfo->si_code == 4 /* TRAP_HWBKPT */ && is_inside_syscall( data, RSP_sig(sigcontext) )) + else if (siginfo->si_code == 4 /* TRAP_HWBKPT */ && + (is_inside_syscall( data, RSP_sig(sigcontext) ) || + is_inside_signal_stack( data, (void *)RSP_sig(sigcontext) ))) { - TRACE_(seh)( "ignoring HWBKPT in syscall rip=%p\n", (void *)RIP_sig(sigcontext) ); + TRACE_(seh)( "ignoring HWBKPT in syscall/signal stack rip=%p\n", + (void *)RIP_sig(sigcontext) );
```suggestion else if (siginfo->si_code == 4 /* TRAP_HWBKPT */ && (is_inside_syscall( data, RSP_sig(sigcontext) ) || is_inside_signal_stack( data, (void *)RSP_sig(sigcontext) ))) { TRACE_(seh)( "ignoring HWBKPT rip=%p\n", (void *)RIP_sig(sigcontext) ); return TRUE; } ``` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11071#note_142240
Also it is probably best to do exactly the same in signal_i386.c at once. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11071#note_142241
Oh hey! I guess we spoke on #winehackers yesterday. Should I upload the logs here? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11071#note_142243
On Thu Jun 4 21:09:00 2026 +0000, Paul Gofman wrote:
Also it is probably best to do exactly the same in signal_i386.c at once. I will rebase and mirror the changes to i386
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/11071#note_142244
participants (4)
-
Elizabeth Figura (@zfigura) -
Paul Gofman (@gofman) -
Soham Nandy -
Soham Nandy (@natimerry)