mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: Andrew Lutomirski <luto@mit.edu>
Cc: alan@lxorguk.ukuu.org.uk, miklos@szeredi.hu,
	akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] vfs: new O_NODE open flag
Date: Mon, 07 Dec 2009 16:50:58 +0100	[thread overview]
Message-ID: <E1NHfrW-0003YW-Rn@pomaz-ex.szeredi.hu> (raw)
In-Reply-To: <cb0375e10912070703j4e5769c7tec6090378248a187@mail.gmail.com> (message from Andrew Lutomirski on Mon, 7 Dec 2009 10:03:33 -0500)

On Mon, 7 Dec 2009, Andrew Lutomirski wrote:
> On Mon, Dec 7, 2009 at 9:13 AM, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> > First obvious attack: get an O_NODE handle to a device you have assigned
> > to your ownership
> >
> >        while(1)
> >                fchmod(fd, 0666);
> >
> > wait for device to unload, reload and be intended for another user
> > Race udev to a real open. You have a similar problem with vhangup() and
> > ttys.
> 
> Huh?  I would've thought that udev would (and already does?), on
> device unload, chown to 0:0, then chmod to 0000, then unlink, in which
> case that attack doesn't work.

Git version of udev does:

	chmod(filename, 0000);
	chown(filename, 0, 0);
	err = unlink(filename);

It should probably do it the other way round, which is how it was
originally, until this commit messed it up:

  commit 39087d3bdd0b5195c2570a4f858b88a82d42a066
  Author: Kay Sievers <kay.sievers@vrfy.org>
  Date:   Sat Aug 29 16:10:24 2009 +0200
  
      util_unlink_secure(): chmod() before chown()
  
      Suggested by Florian Zumbiehl <florz@florz.de>.

And the thread where it came from:

  http://markmail.org/thread/ozwcbju52yb3qs5d

where the poster actually warned Kay that it was wrong...

> Would you be okay with a patch that prevented opening
> /proc/self/fd/xxx on O_NODE handles?

We can't sanely do that.

Thanks,
Miklos

  reply	other threads:[~2009-12-07 15:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-02 16:16 Miklos Szeredi
2009-12-02 19:15 ` Alan Cox
2009-12-02 20:13   ` Miklos Szeredi
2009-12-02 20:48     ` Alan Cox
2009-12-03  5:46       ` Miklos Szeredi
2009-12-05 14:42         ` Andy Lutomirski
2009-12-05 19:40           ` Miklos Szeredi
2009-12-05 20:28             ` Alan Cox
2009-12-05 20:35               ` Miklos Szeredi
2009-12-05 23:13                 ` Alan Cox
2009-12-07  6:08                   ` Miklos Szeredi
2009-12-07 12:23                     ` Alan Cox
2009-12-07 12:41                       ` Miklos Szeredi
2009-12-07 12:47                         ` Miklos Szeredi
2009-12-07 13:03                           ` Alan Cox
2009-12-07 13:08                             ` Miklos Szeredi
2009-12-07 13:15                               ` Alan Cox
2009-12-07 13:16                                 ` Miklos Szeredi
2009-12-07 14:13                                   ` Alan Cox
2009-12-07 14:25                                     ` Miklos Szeredi
2009-12-07 14:46                                       ` Alan Cox
2009-12-07 15:11                                         ` Miklos Szeredi
2009-12-07 17:40                                           ` Alan Cox
2009-12-07 15:03                                     ` Andrew Lutomirski
2009-12-07 15:50                                       ` Miklos Szeredi [this message]
2009-12-07 17:16                                       ` Alan Cox
2009-12-10  7:39                         ` Pavel Machek
2009-12-06  8:46 ` Pavel Machek

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=E1NHfrW-0003YW-Rn@pomaz-ex.szeredi.hu \
    --to=miklos@szeredi.hu \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@mit.edu \
    /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

all inboxes | Powered by JetHome®