gvisor/pkg/sentry/platform/ptrace
newmanwang de5a590ee2 Avoid reuse of pending SignalInfo objects
runApp.execute -> Task.SendSignal -> sendSignalLocked -> sendSignalTimerLocked
-> pendingSignals.enqueue assumes that it owns the arch.SignalInfo returned
from platform.Context.Switch.

On the other hand, ptrace.context.Switch assumes that it owns the returned
SignalInfo and can safely reuse it on the next call to Switch. The KVM platform
always returns a unique SignalInfo.

This becomes a problem when the returned signal is not immediately delivered,
allowing a future signal in Switch to change the previous pending SignalInfo.

This is noticeable in #38 when external SIGINTs are delivered from the PTY
slave FD. Note that the ptrace stubs are in the same process group as the
sentry, so they are eligible to receive the PTY signals. This should probably
change, but is not the only possible cause of this bug.

Updates #38

Original change by newmanwang <wcs1011@gmail.com>, updated by Michael Pratt
<mpratt@google.com>.

Change-Id: I5383840272309df70a29f67b25e8221f933622cd
PiperOrigin-RevId: 213071072
2018-09-14 17:39:25 -07:00
..
BUILD stateify: support explicit annotation mode; convert refs and stack packages. 2018-07-27 10:17:21 -07:00
ptrace.go Avoid reuse of pending SignalInfo objects 2018-09-14 17:39:25 -07:00
ptrace_unsafe.go Check in gVisor. 2018-04-28 01:44:26 -04:00
stub_amd64.s Check in gVisor. 2018-04-28 01:44:26 -04:00
stub_unsafe.go Check in gVisor. 2018-04-28 01:44:26 -04:00
subprocess.go Remove error return from AddressSpace.Release() 2018-05-11 12:24:15 -07:00
subprocess_amd64.go Check in gVisor. 2018-04-28 01:44:26 -04:00
subprocess_linux.go Add CPUID faulting for ptrace and KVM. 2018-07-16 22:02:58 -07:00
subprocess_linux_amd64_unsafe.go Check in gVisor. 2018-04-28 01:44:26 -04:00
subprocess_unsafe.go Check in gVisor. 2018-04-28 01:44:26 -04:00