From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753478Ab3KSRUG (ORCPT ); Tue, 19 Nov 2013 12:20:06 -0500 Received: from mail-bk0-f49.google.com ([209.85.214.49]:63929 "EHLO mail-bk0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751720Ab3KSRUE (ORCPT ); Tue, 19 Nov 2013 12:20:04 -0500 Date: Tue, 19 Nov 2013 20:19:52 +0300 From: Heorhi Valakhanovich To: Peter Hurley Cc: One Thousand Gnomes , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, gregkh@linuxfoundation.org Subject: Re: [PATCH] tty: Only hangup once Message-ID: <20131119201952.2d63b8ce@tormoz-pc> In-Reply-To: <528B6BB3.7020303@hurleysoftware.com> References: <1375293945-4087-1-git-send-email-peter@hurleysoftware.com> <20131117203850.46df2124@tormoz-pc> <20131118134211.17861db3@alan.etchedpixels.co.uk> <528A5043.6030901@hurleysoftware.com> <528A797B.6020807@hurleysoftware.com> <20131119000923.5ca40e51@tormoz-pc> <528B6BB3.7020303@hurleysoftware.com> X-Mailer: Claws Mail 3.9.0 (GTK+ 2.24.17; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 19 Nov 2013 08:46:27 -0500 Peter Hurley wrote: > Would you please test the patch below and confirm the fix? > > --->%--- > Subject: [PATCH] tty: Reset hupped state on open > > A common security idiom is to hangup the current tty (via vhangup()) > after forking but before execing a root shell. This hangs up any > existing opens which other processes may have and ensures subsequent > opens have the necessary permissions to open the root shell tty/pty. > > Reset the TTY_HUPPED state after the driver has successfully > returned the opened tty (perform the reset while the tty is locked > to avoid racing with concurrent hangups). > > Reported-by: Heorhi Valakhanovich > Signed-off-by: Peter Hurley > --- > drivers/tty/tty_io.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c > index 3a1a01a..c74a00a 100644 > --- a/drivers/tty/tty_io.c > +++ b/drivers/tty/tty_io.c > @@ -2086,6 +2086,7 @@ retry_open: > filp->f_op = &tty_fops; > goto retry_open; > } > + clear_bit(TTY_HUPPED, &tty->flags); > tty_unlock(tty); > > It looks like this patch works. It solves my problem. Thanks. Will wait for such fix in mainline. Heorhi.