[sudo-workers] sudo waits on poll forever after SIGCHILD

Todd C. Miller Todd.Miller at sudo.ws
Thu Jun 28 09:40:52 MDT 2018


Fedora is still shipping sudo 1.8.22 so is missing the following fix.
It should backport to 1.8.19 easily.

 - todd

diff -r 39b58e206a15 src/exec_pty.c
--- a/src/exec_pty.c	Mon Jan 15 10:31:53 2018 -0700
+++ b/src/exec_pty.c	Thu Jun 28 09:35:53 2018 -0600
@@ -754,6 +754,10 @@ pty_close(struct command_status *cstat)
     int n;
     debug_decl(pty_close, SUDO_DEBUG_EXEC);
 
+    /* Close the pty slave first so reads from the master don't block. */
+    if (io_fds[SFD_SLAVE] != -1)
+	close(io_fds[SFD_SLAVE]);
+
     /* Flush any remaining output (the plugin already got it). */
     if (io_fds[SFD_USERTTY] != -1) {
 	n = fcntl(io_fds[SFD_USERTTY], F_GETFL, 0);
@@ -781,6 +785,11 @@ pty_close(struct command_status *cstat)
     /* Update utmp */
     if (utmp_user != NULL)
 	utmp_logout(slavename, cstat->type == CMD_WSTATUS ? cstat->val : 0);
+
+    /* Close pty master. */
+    if (io_fds[SFD_MASTER] != -1)
+	close(io_fds[SFD_MASTER]);
+
     debug_return;
 }
 


More information about the sudo-workers mailing list