From owner-cvs-all@FreeBSD.ORG Thu Dec 20 21:21:53 2007 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDEBB16A418; Thu, 20 Dec 2007 21:21:53 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from speedfactory.net (mail6.speedfactory.net [66.23.216.219]) by mx1.freebsd.org (Postfix) with ESMTP id 6B06213C459; Thu, 20 Dec 2007 21:21:53 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.8q) with ESMTP id 225332239-1834499 for multiple; Thu, 20 Dec 2007 16:19:48 -0500 Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.8/8.13.8) with ESMTP id lBKLLXah078157; Thu, 20 Dec 2007 16:21:35 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: src-committers@freebsd.org Date: Thu, 20 Dec 2007 16:20:53 -0500 User-Agent: KMail/1.9.6 References: <200712202110.lBKLA62l076058@repoman.freebsd.org> In-Reply-To: <200712202110.lBKLA62l076058@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200712201620.53949.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Thu, 20 Dec 2007 16:21:35 -0500 (EST) X-Virus-Scanned: ClamAV 0.91.2/5195/Thu Dec 20 14:25:28 2007 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: cvs-src@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/lib/libutil pty.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2007 21:21:54 -0000 On Thursday 20 December 2007 04:10:06 pm John Baldwin wrote: > jhb 2007-12-20 21:10:06 UTC > > FreeBSD src repository > > Modified files: > lib/libutil pty.c > Log: > Invoke revoke(2) on the slave pty in the pts(4) case (new_openpty()) to > kick off any other users on the device line before using it since > openpty(3) is documented to do this. Note that grantpt(3) does not > call revoke(2), it only adjusts permissions and ownership. > > MFC after: 3 days For a cute demonstration do something like this: 1) ssh foo in one window 2) ssh foo in another window note that pty in this window is /dev/pts/1 or some such end the ssh session 3) cat /dev/pts/1 in the first window (it should still be owned by your user) 4) ssh foo again in second window 5) note that the 'cat' didn't terminate.. now when you type in chars to your second window they will go to one of the two windows (seems to roughly ping-pong) 6) logout from window two, and the 'cat' in window one will die with ENXIO (presumbly due to a revoke(2) being done in sshd when the pty is closed) With this fix, the 'cat' in 3) gets terminated with ENXIO during 4). Note that the pty(4) case already gets this correct (which is what <= 7.x use). (In general cat on a slave pty you are already using in another window is a bit of an odd experience.) -- John Baldwin