Re: sudo waits on poll forever after SIGCHILD

Radovan Sroka <[email protected]> Fri, 29 Jun 2018 14:34:26 +0200
Newsgroups gmane.comp.tools.sudo.devel
Message-ID <CAD_08=_PUEsSai_hY0_WN6g0zM3s3ORWzcETWEtgXbSQzd65sg@mail.gmail.com>
Hi Todd,

I've verified that your patch is resolving my problem.

Thank you.

On Thu, Jun 28, 2018 at 5:40 PM Todd C. Miller <[email protected]> wrote:

> 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;
>  }
>
> --
--
---------------------------------------------------------

Radovan Sroka
Associate Software Engineer | Security Technologies | Red hat, Inc.
____________________________________________________________
sudo-workers mailing list <[email protected]>
For list information, options, or to unsubscribe, visit:
https://www.sudo.ws/mailman/listinfo/sudo-workers