Merge ~halves/ubuntu/+source/sudo:lp1895757 into ubuntu/+source/sudo:ubuntu/bionic-devel

Proposed by Heitor Alves de Siqueira
Status: Needs review
Proposed branch: ~halves/ubuntu/+source/sudo:lp1895757
Merge into: ubuntu/+source/sudo:ubuntu/bionic-devel
Diff against target: 108 lines (+86/-0)
3 files modified
debian/changelog (+7/-0)
debian/patches/0001-In-pty_close-close-the-slave-and-remove-any-events-a.patch (+78/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Eric Desrochers Pending
git-ubuntu developers Pending
Review via email: mp+391237@code.launchpad.net
To post a comment you must log in.

Unmerged commits

802f9d8... by Heitor Alves de Siqueira

Update d/changelog

dd72a5a... by Heitor Alves de Siqueira

LP: #1895757

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index 23f3972..6055a4a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
1sudo (1.8.21p2-3ubuntu1.3) bionic; urgency=medium
2
3 * d/p/0001-In-pty_close-close-the-slave-and-remove-any-events-a.patch:
4 - fix sudo hangs when IO logging is enabled (LP: #1895757)
5
6 -- Heitor Alves de Siqueira <halves@canonical.com> Wed, 23 Sep 2020 14:59:35 +0000
7
1sudo (1.8.21p2-3ubuntu1.2) bionic-security; urgency=medium8sudo (1.8.21p2-3ubuntu1.2) bionic-security; urgency=medium
29
3 * SECURITY UPDATE: buffer overflow in sudo when pwfeedback is enabled10 * SECURITY UPDATE: buffer overflow in sudo when pwfeedback is enabled
diff --git a/debian/patches/0001-In-pty_close-close-the-slave-and-remove-any-events-a.patch b/debian/patches/0001-In-pty_close-close-the-slave-and-remove-any-events-a.patch
4new file mode 10064411new file mode 100644
index 0000000..3a884be
--- /dev/null
+++ b/debian/patches/0001-In-pty_close-close-the-slave-and-remove-any-events-a.patch
@@ -0,0 +1,78 @@
1From c4523c6c798464e6a4bdf03d715d04d90c8114d5 Mon Sep 17 00:00:00 2001
2From: Heitor Alves de Siqueira <halves@canonical.com>
3Date: Wed, 23 Sep 2020 11:23:43 -0300
4Subject: [PATCH] In pty_close() close the slave and remove any events associated
5
6with it. Fixes a potential hang when performing the final flush
7on non-BSD systems.
8
9Origin: backport, https://github.com/sudo-project/sudo/commit/4df454310dae
10Bug-ubuntu: https://bugs.launchpad.net/bugs/1895757
11---
12 src/exec_pty.c | 20 ++++++++++++++++++--
13 1 file changed, 18 insertions(+), 2 deletions(-)
14
15Index: sudo/src/exec_pty.c
16===================================================================
17--- sudo.orig/src/exec_pty.c
18+++ sudo/src/exec_pty.c
19@@ -680,12 +680,19 @@ io_buf_new(int rfd, int wfd,
20 }
21
22 static void
23-pty_close(struct command_status *cstat)
24+pty_close(struct sudo_event_base *evbase, struct command_status *cstat)
25 {
26 struct io_buffer *iob;
27 int n;
28 debug_decl(pty_close, SUDO_DEBUG_EXEC);
29
30+ /* Close the pty slave first so reads from the master don't block. */
31+ if (io_fds[SFD_SLAVE] != -1) {
32+ ev_free_by_fd(evbase, io_fds[SFD_SLAVE]);
33+ close(io_fds[SFD_SLAVE]);
34+ io_fds[SFD_SLAVE] = -1;
35+ }
36+
37 /* Flush any remaining output (the plugin already got it). */
38 if (io_fds[SFD_USERTTY] != -1) {
39 n = fcntl(io_fds[SFD_USERTTY], F_GETFL, 0);
40@@ -713,6 +720,11 @@ pty_close(struct command_status *cstat)
41 /* Update utmp */
42 if (utmp_user != NULL)
43 utmp_logout(slavename, cstat->type == CMD_WSTATUS ? cstat->val : 0);
44+
45+ /* Close pty master. */
46+ if (io_fds[SFD_MASTER] != -1)
47+ close(io_fds[SFD_MASTER]);
48+
49 debug_return;
50 }
51
52@@ -1409,7 +1421,7 @@ exec_pty(struct command_details *details
53 }
54
55 /* Flush any remaining output, free I/O bufs and events, do logout. */
56- pty_close(cstat);
57+ pty_close(ec.evbase, cstat);
58
59 /* Free things up. */
60 free_exec_closure_pty(&ec);
61@@ -1509,6 +1521,8 @@ del_io_events(bool nonblocking)
62 }
63 }
64 }
65+ sudo_debug_printf(SUDO_DEBUG_INFO,
66+ "%s: flushing remaining I/O buffers (nonblocking)", __func__);
67 (void) sudo_ev_loop(evbase, SUDO_EVLOOP_NONBLOCK);
68
69 /*
70@@ -1534,6 +1548,8 @@ del_io_events(bool nonblocking)
71 }
72 }
73 }
74+ sudo_debug_printf(SUDO_DEBUG_INFO,
75+ "%s: flushing remaining write buffers (blocking)", __func__);
76 (void) sudo_ev_loop(evbase, 0);
77
78 /* We should now have flushed all write buffers. */
diff --git a/debian/patches/series b/debian/patches/series
index dfbedfc..64115a9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@ keep_home_by_default.patch
5CVE-2019-14287.patch5CVE-2019-14287.patch
6CVE-2019-14287-2.patch6CVE-2019-14287-2.patch
7CVE-2019-18634.patch7CVE-2019-18634.patch
80001-In-pty_close-close-the-slave-and-remove-any-events-a.patch

Subscribers

People subscribed via source and target branches