Fix suspending a sudo-run shell in ptrace intercept mode with no pty.

When ptracing a process, we receive the signal-delivery-stop signal
before the group-stop signal.  If sudo is running the command in
the same terminal, we need to wait until the stop signal is actually
delivered to the command before we can suspend sudo itself.  If we
suspend sudo before receiving the group-stop, the command will be
restarted with PTRACE_LISTEN too late and will miss the SIGCONT
from sudo.
This commit is contained in:
Todd C. Miller
2022-05-17 14:26:03 -06:00
parent 0bcfe6184f
commit a52e3776f0
5 changed files with 24 additions and 18 deletions

View File

@@ -147,7 +147,7 @@ bool utmp_logout(const char *line, int status);
char **sudo_preload_dso(char *envp[], const char *dso_file, int intercept_fd);
/* exec_ptrace.c */
bool exec_ptrace_handled(pid_t pid, int status, void *intercept);
bool exec_ptrace_stopped(pid_t pid, int status, void *intercept);
bool set_exec_filter(void);
int exec_ptrace_seize(pid_t child);