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
F107351803: D18487.diff
Sun, Jan 12, 9:58 PM
Unknown Object (File)
Mon, Dec 23, 10:12 PM
Unknown Object (File)
Nov 30 2024, 11:01 PM
Unknown Object (File)
Nov 18 2024, 8:34 PM
Unknown Object (File)
Nov 11 2024, 10:45 AM
Unknown Object (File)
Oct 7 2024, 2:27 AM
Unknown Object (File)
Sep 17 2024, 1:23 PM
Unknown Object (File)
Sep 17 2024, 12:57 AM
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

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 21452
Build 20772: arc lint + arc unit