From owner-svn-src-all@FreeBSD.ORG Thu May 7 17:39:23 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC6F4106564A; Thu, 7 May 2009 17:39:23 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB0938FC17; Thu, 7 May 2009 17:39:23 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n47HdNmc063138; Thu, 7 May 2009 17:39:23 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n47HdNjl063137; Thu, 7 May 2009 17:39:23 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200905071739.n47HdNjl063137@svn.freebsd.org> From: Ed Schouten Date: Thu, 7 May 2009 17:39:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191893 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 May 2009 17:39:24 -0000 Author: ed Date: Thu May 7 17:39:23 2009 New Revision: 191893 URL: http://svn.freebsd.org/changeset/base/191893 Log: If we have a regular rint handler, never go into rint_bypass mode. It turns out if we called cfmakeraw() on a TTY with only a rint handler in place, it could inject data into the TTY, even though it should be redirected. Always take a look at the hooks before looking at the termios flags. Modified: head/sys/kern/tty_ttydisc.c Modified: head/sys/kern/tty_ttydisc.c ============================================================================== --- head/sys/kern/tty_ttydisc.c Thu May 7 17:05:03 2009 (r191892) +++ head/sys/kern/tty_ttydisc.c Thu May 7 17:39:23 2009 (r191893) @@ -560,12 +560,15 @@ ttydisc_optimize(struct tty *tp) { tty_lock_assert(tp, MA_OWNED); - if ((!CMP_FLAG(i, ICRNL|IGNCR|IMAXBEL|INLCR|ISTRIP|IXON) && + if (ttyhook_hashook(tp, rint_bypass)) { + tp->t_flags |= TF_BYPASS; + } else if (ttyhook_hashook(tp, rint)) { + tp->t_flags &= ~TF_BYPASS; + } else if (!CMP_FLAG(i, ICRNL|IGNCR|IMAXBEL|INLCR|ISTRIP|IXON) && (!CMP_FLAG(i, BRKINT) || CMP_FLAG(i, IGNBRK)) && (!CMP_FLAG(i, PARMRK) || CMP_FLAG(i, IGNPAR|IGNBRK) == (IGNPAR|IGNBRK)) && - !CMP_FLAG(l, ECHO|ICANON|IEXTEN|ISIG|PENDIN)) || - ttyhook_hashook(tp, rint_bypass)) { + !CMP_FLAG(l, ECHO|ICANON|IEXTEN|ISIG|PENDIN)) { tp->t_flags |= TF_BYPASS; } else { tp->t_flags &= ~TF_BYPASS;