[openssh-commits] [openssh] 03/03: upstream: clear io_want/io_ready flags at start of poll() cycle;

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Apr 12 09:36:04 AEST 2022


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

djm pushed a commit to branch master
in repository openssh.

commit cd1f70009860a154b51230d367c55ea5f9a4504e
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Mon Apr 11 22:52:08 2022 +0000

    upstream: clear io_want/io_ready flags at start of poll() cycle;
    
    avoids plausible spin during rekeying if channel io_want flags are reused
    across cycles. ok markus@ deraadt@
    
    OpenBSD-Commit-ID: 91034f855b7c73cd2591657c49ac30f10322b967
---
 channels.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/channels.c b/channels.c
index ee3c7879..d47af791 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.c,v 1.415 2022/03/30 21:10:25 djm Exp $ */
+/* $OpenBSD: channels.c,v 1.416 2022/04/11 22:52:08 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -2601,7 +2601,12 @@ channel_prepare_poll(struct ssh *ssh, struct pollfd **pfdp, u_int *npfd_allocp,
 	u_int i, oalloc, p, npfd = npfd_reserved;
 
 	channel_before_prepare_io(ssh); /* might create a new channel */
-
+	/* clear out I/O flags from last poll */
+	for (i = 0; i < sc->channels_alloc; i++) {
+		if (sc->channels[i] == NULL)
+			continue;
+		sc->channels[i]->io_want = sc->channels[i]->io_ready = 0;
+	}
 	/* Allocate 4x pollfd for each channel (rfd, wfd, efd, sock) */
 	if (sc->channels_alloc >= (INT_MAX / 4) - npfd_reserved)
 		fatal_f("too many channels"); /* shouldn't happen */

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


More information about the openssh-commits mailing list