pete
pete copied to clipboard
Prevent unsupported signal injection
Currently, every Tracee carries a pending field, which can be modified. It should only be modified for signal-delivery-stops. This can lead to user confusion, as per the man page:
Restarting ptrace commands issued in ptrace-stops other than
signal-delivery-stop are not guaranteed to inject a signal, even
if sig is nonzero. No error is reported; a nonzero sig may simply
be ignored. Ptrace users should not try to "create a new signal"
this way: use [tgkill(2)](https://man7.org/linux/man-pages/man2/tgkill.2.html) instead.
It would be nice to omit the signal in the event API, and especially to making it impossible to attempt setting it unless a stop was a signal-delivery-stop. At a minimum, we should return an error when attempting to set it.