diff --git a/SOURCES/sudo-1.8.19p2-iolog-zombie.patch b/SOURCES/sudo-1.8.19p2-iolog-zombie.patch new file mode 100644 index 0000000..ad10dc8 --- /dev/null +++ b/SOURCES/sudo-1.8.19p2-iolog-zombie.patch @@ -0,0 +1,60 @@ +diff -up sudo-1.8.19p2/src/exec.c.iolog-zombie sudo-1.8.19p2/src/exec.c +--- sudo-1.8.19p2/src/exec.c.iolog-zombie 2018-05-28 09:01:13.488647060 +0200 ++++ sudo-1.8.19p2/src/exec.c 2018-05-28 09:01:13.526646940 +0200 +@@ -534,7 +534,7 @@ sudo_execute(struct command_details *det + + if (log_io) { + /* Flush any remaining output and free pty-related memory. */ +- pty_close(cstat); ++ pty_close(ec.evbase,cstat); + } + + #ifdef HAVE_SELINUX +diff -up sudo-1.8.19p2/src/exec_pty.c.iolog-zombie sudo-1.8.19p2/src/exec_pty.c +--- sudo-1.8.19p2/src/exec_pty.c.iolog-zombie 2018-05-28 09:01:13.518646965 +0200 ++++ sudo-1.8.19p2/src/exec_pty.c 2018-05-28 09:01:13.527646937 +0200 +@@ -919,12 +919,19 @@ fork_pty(struct command_details *details + } + + void +-pty_close(struct command_status *cstat) ++pty_close(struct sudo_event_base *evbase, struct command_status *cstat) + { + struct io_buffer *iob; + 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) { ++ ev_free_by_fd(evbase, io_fds[SFD_SLAVE]); ++ close(io_fds[SFD_SLAVE]); ++ io_fds[SFD_SLAVE] = -1; ++ } ++ + /* Flush any remaining output (the plugin already got it). */ + if (io_fds[SFD_USERTTY] != -1) { + n = fcntl(io_fds[SFD_USERTTY], F_GETFL, 0); +@@ -965,6 +972,11 @@ pty_close(struct command_status *cstat) + } + } + utmp_logout(slavename, cstat->type == CMD_WSTATUS ? cstat->val : 0); /* XXX - only if CD_SET_UTMP */ ++ ++ /* Close pty master. */ ++ if (io_fds[SFD_MASTER] != -1) ++ close(io_fds[SFD_MASTER]); ++ + debug_return; + } + +diff -up sudo-1.8.19p2/src/sudo_exec.h.iolog-zombie sudo-1.8.19p2/src/sudo_exec.h +--- sudo-1.8.19p2/src/sudo_exec.h.iolog-zombie 2017-01-14 05:30:15.000000000 +0100 ++++ sudo-1.8.19p2/src/sudo_exec.h 2018-05-28 09:01:13.527646937 +0200 +@@ -93,7 +93,7 @@ void handler(int s, siginfo_t *info, voi + #else + void handler(int s); + #endif +-void pty_close(struct command_status *cstat); ++void pty_close(struct sudo_event_base *evbase, struct command_status *cstat); + void pty_setup(uid_t uid, const char *tty, const char *utmp_user); + void terminate_command(pid_t pid, bool use_pgrp); + diff --git a/SPECS/sudo.spec b/SPECS/sudo.spec index 01af92f..c8d2f64 100644 --- a/SPECS/sudo.spec +++ b/SPECS/sudo.spec @@ -1,7 +1,7 @@ Summary: Allows restricted root access for specified users Name: sudo Version: 1.8.19p2 -Release: 13%{?dist} +Release: 14%{?dist} License: ISC Group: Applications/System URL: http://www.courtesan.com/sudo/ @@ -75,6 +75,8 @@ Patch22: sudo-1.8.19p2-manpage-use_pty.patch Patch23: sudo-1.8.19p2-sudo-l-sssd.patch # 1518104 - sudo crashed: double free or corruption (fasttop) Patch24: sudo-1.8.19p2-sssd-double-free.patch +# 1560657 - sudo blocks in poll() for /dev/ptmx with iolog enabled +Patch25: sudo-1.8.19p2-iolog-zombie.patch %description Sudo (superuser do) allows a system administrator to give certain @@ -123,6 +125,7 @@ plugins that use %{name}. %patch22 -p1 -b .manpage %patch23 -p1 -b .sudo-l %patch24 -p1 -b .double-free +%patch25 -p1 -b .iolog-zombie %build autoreconf -I m4 -fv --install @@ -257,6 +260,10 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man8/sudo_plugin.8* %changelog +* Mon May 28 2018 Daniel Kopecek - 1.8.19p2-14 +- Fixed deadlocking after command termination when iolog is enabled + Resolves: rhbz#1582155 + * Thu Nov 30 2017 Radovan Sroka 1.8.19p2-13 - RHEL 7.5 erratum - Fixed sudo -l checking results whether user should be authenticated