Page MenuHomeFreeBSD

Don't report stale signal information for non-signal events in ptrace_lwpinfo.
ClosedPublic

Authored by jhb on Dec 9 2018, 12:39 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 25 2024, 10:07 PM
Unknown Object (File)
Mar 10 2024, 3:01 AM
Unknown Object (File)
Dec 22 2023, 10:36 PM
Unknown Object (File)
Nov 28 2023, 10:16 AM
Unknown Object (File)
Oct 27 2023, 6:57 AM
Unknown Object (File)
Sep 16 2023, 7:49 AM
Unknown Object (File)
Sep 1 2023, 4:46 PM
Unknown Object (File)
Sep 1 2023, 4:45 PM
Subscribers

Details

Summary

Once a signal's siginfo was copied to 'td_si' as part of the signal
exchange in issignal(), it was never cleared. This caused future
thread events that are reported as SIGTRAP events without signal
information to report the stale siginfo in 'td_si'. For example, if a
debugger created a new process and used SIGSTOP to stop it after
PT_ATTACH, future system call entry / exit events would set PL_FLAG_SI
with the SIGSTOP siginfo in pl_siginfo. This broke 'catch syscall' in
current versions of gdb as it assumed PL_FLAG_SI with SIGTRAP
indicates a breakpoint or single step trap.

Test Plan
  • the test fails without the patch and passes with it
  • do 'gdb /bin/ls', 'catch syscall write', 'run'. Without the patch, gdb reports a spurious SIGTRAP on each system call entry/exit. With the patch gdb properly ignores syscall events for syscalls that aren't write and reports syscall events for write.
  • I do have a patch for gdb as well that I plan to upstream where it requires pl_flags == PL_FLAG_SI instead of pl_flags & PL_FLAG_SI when checking SIGTRAP events for breakpoints and single step traps, but wanted to also fix the kernel.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable