From: Greg KH <gregkh@linuxfoundation.org>
To: Heorhi Valakhanovich <valahanovich@tut.by>
Cc: Peter Hurley <peter@hurleysoftware.com>,
One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH] tty: Only hangup once
Date: Tue, 19 Nov 2013 09:40:32 -0800 [thread overview]
Message-ID: <20131119174032.GB22604@kroah.com> (raw)
In-Reply-To: <20131119201952.2d63b8ce@tormoz-pc>
On Tue, Nov 19, 2013 at 08:19:52PM +0300, Heorhi Valakhanovich wrote:
> On Tue, 19 Nov 2013 08:46:27 -0500
> Peter Hurley <peter@hurleysoftware.com> 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 <valahanovich@tut.by>
> > Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
> > ---
> > 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.
I'll queue this up after 3.13-rc1 is out.
It should be backported to 3.12, and any other kernels?
thanks,
greg k-h
next prev parent reply other threads:[~2013-11-19 17:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-31 18:05 [PATCH] tty: Only hangup once Peter Hurley
2013-08-02 3:46 ` Greg Kroah-Hartman
2013-08-02 23:02 ` Peter Hurley
2013-11-17 17:38 ` Heorhi Valakhanovich
2013-11-18 13:42 ` One Thousand Gnomes
2013-11-18 17:37 ` Peter Hurley
2013-11-18 20:32 ` Peter Hurley
2013-11-18 21:09 ` Heorhi Valakhanovich
2013-11-19 13:46 ` Peter Hurley
2013-11-19 17:19 ` Heorhi Valakhanovich
2013-11-19 17:40 ` Greg KH [this message]
2013-11-19 21:34 ` Peter Hurley
2013-11-19 23:05 ` Greg KH
2013-11-18 23:03 ` One Thousand Gnomes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131119174032.GB22604@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=peter@hurleysoftware.com \
--cc=valahanovich@tut.by \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox