[openssh-commits] [openssh] 05/09: upstream: reap the [net] child if it hangs up while writing privsep

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Jun 11 11:27:03 AEST 2024


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 41987efd356d3fc30139aeab4b09374acf8f91a0
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Tue Jun 11 00:44:52 2024 +0000

    upstream: reap the [net] child if it hangs up while writing privsep
    
    message payloads, not just the message header
    
    OpenBSD-Commit-ID: 24dbd400aa381ac96be7ed2dd49018487dfef6ce
---
 monitor_wrap.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/monitor_wrap.c b/monitor_wrap.c
index b0a5a5cf..2b543852 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor_wrap.c,v 1.132 2024/06/11 00:40:21 djm Exp $ */
+/* $OpenBSD: monitor_wrap.c,v 1.133 2024/06/11 00:44:52 djm Exp $ */
 /*
  * Copyright 2002 Niels Provos <provos at citi.umich.edu>
  * Copyright 2002 Markus Friedl <markus at openbsd.org>
@@ -175,7 +175,7 @@ mm_request_receive(int sock, struct sshbuf *m)
 {
 	u_char buf[4], *p = NULL;
 	u_int msg_len;
-	int r;
+	int oerrno, r;
 
 	debug3_f("entering");
 
@@ -193,8 +193,13 @@ mm_request_receive(int sock, struct sshbuf *m)
 	sshbuf_reset(m);
 	if ((r = sshbuf_reserve(m, msg_len, &p)) != 0)
 		fatal_fr(r, "reserve");
-	if (atomicio(read, sock, p, msg_len) != msg_len)
-		fatal_f("read: %s", strerror(errno));
+	if (atomicio(read, sock, p, msg_len) != msg_len) {
+		oerrno = errno;
+		error_f("read: %s", strerror(errno));
+		if (oerrno == EPIPE)
+			mm_reap();
+		cleanup_exit(255);
+	}
 }
 
 void

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list