[fiddler] Forward signals to child process in secwrap Not doing this was causing signals to be swallowed. Bug: b/496884373 Change-Id: If3275e47b7ad501ccc92f3b942a2db37c8afc0b5 Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/1210076 Auto-Submit: Eric Boren <borenet@google.com> Commit-Queue: Eric Boren <borenet@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/fiddlek/go/fiddle_secwrap/main.go b/fiddlek/go/fiddle_secwrap/main.go index 22909b7..1b0782a 100644 --- a/fiddlek/go/fiddle_secwrap/main.go +++ b/fiddlek/go/fiddle_secwrap/main.go
@@ -640,7 +640,14 @@ } } - if err := unix.PtraceSyscall(wpid, 0); err != nil { + // If the child process received a signal other than SIGTRAP (which + // ptrace itself uses to pause the process), forward that signal to + // the child process. + var signal int + if status.Stopped() && status.StopSignal() != unix.SIGTRAP { + signal = int(status.StopSignal()) + } + if err := unix.PtraceSyscall(wpid, signal); err != nil && err != unix.ESRCH { fmt.Fprintf(os.Stderr, "failed ptrace: %s\n", err) } }