diff options
author | 2020-07-20 14:34:16 +0000 | |
---|---|---|
committer | 2020-07-20 14:34:16 +0000 | |
commit | 2df268a15789180a6dc2e6ac48bb86caa4610545 (patch) | |
tree | 9c8ff0ad32ec9a3cfaa8205d5ef76931abaa583f | |
parent | Switch the default pager from "more -s" to "less". (diff) | |
download | wireguard-openbsd-2df268a15789180a6dc2e6ac48bb86caa4610545.tar.xz wireguard-openbsd-2df268a15789180a6dc2e6ac48bb86caa4610545.zip |
Sigh. Only the ptyc case should tsleep in ttyretype, since others can
arrive in the wrong context. Found by jcs.
-rw-r--r-- | sys/kern/tty.c | 12 | ||||
-rw-r--r-- | sys/kern/tty_pty.c | 5 |
2 files changed, 7 insertions, 10 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c index e71ca0e4fb4..33f6c4baf71 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.160 2020/07/15 02:29:26 deraadt Exp $ */ +/* $OpenBSD: tty.c,v 1.161 2020/07/20 14:34:16 deraadt Exp $ */ /* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */ /*- @@ -228,8 +228,8 @@ ttyclose(struct tty *tp) /* - * Process input of a single character received on a tty. Returns 0 for - * simple operations, 1 for costly ones (ptcwrite needs to know). + * Process input of a single character received on a tty. Returns 0 normally, + * 1 if a costly operation was reached. */ int ttyinput(int c, struct tty *tp) @@ -2019,11 +2019,7 @@ ttyretype(struct tty *tp) tp->t_rocount = tp->t_rawq.c_cc; tp->t_rocol = 0; - /* - * Yield because of expense, or possible ptcwrite() injection flood. - * Also check for interrupt, and return upwards. - */ - return tsleep(tp, TTIPRI | PCATCH, "ttyretype", 1); + return (1); } /* diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index 11cfb3c2aad..32cec54fb74 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_pty.c,v 1.102 2020/07/14 14:33:03 deraadt Exp $ */ +/* $OpenBSD: tty_pty.c,v 1.103 2020/07/20 14:34:16 deraadt Exp $ */ /* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */ /* @@ -564,7 +564,8 @@ again: wakeup(&tp->t_rawq); goto block; } - if ((*linesw[tp->t_line].l_rint)(*cp++, tp) == EINTR) + if ((*linesw[tp->t_line].l_rint)(*cp++, tp) == 1 && + tsleep(tp, TTIPRI | PCATCH, "ttyretype", 1) == EINTR) goto interrupt; cnt++; cc--; |