mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: David Herrmann <dh.herrmann@gmail.com>
Cc: Andy Lutomirski <luto@amacapital.net>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	"Theodore Ts'o" <tytso@mit.edu>
Subject: Re: [RFC 2/2] fs,proc: Respect FMODE_WRITE when opening /proc/pid/fd/N
Date: Tue, 22 Apr 2014 16:31:52 +0200	[thread overview]
Message-ID: <20140422143152.GA23716@amd.pavel.ucw.cz> (raw)
In-Reply-To: <CANq1E4T1P-g+wA6bZQe6=79-+QLmXReu4namcPifw-SZViqW-Q@mail.gmail.com>

Hi!

> On Mon, Apr 21, 2014 at 6:22 PM, Andy Lutomirski <luto@amacapital.net> wrote:
> > This patch does this:
> 
> I can see _what_ the patch does, but your patch lacks any discussion
> _why_ it is needed. Can you provide at least one real example where
> this fixes a security issue?

Such as here?

http://www.securityfocus.com/archive/1/507386

> > This may break userspace.  If so, I would guess that anything broken
> > by it is either an actual exploit or is so broken that it doesn't
> > deserve to continue working.  If it breaks something important, then
> > maybe it will need a sysctl.
> 
> This patch breaks the following use-case:
> 
> fd = open("/run", O_RDWR | O_TMPFILE);
> sprintf(path, "/proc/self/fd/%d", fd);
> fd2 = open(buf, O_RDONLY);

You meant open(path, ) here?

> sprintf(path, "/proc/self/fd/%d", fd2);
> linkat(AT_FDCWD, path, AT_FDCWD, "/run/some_lock_file", AT_FOLLOW_SYMLINK);
> 
> I mean I explicitly create the object as _writable_ but then keep a
> read-only descriptor for debugging purposes (to make sure that the
> program no longer writes to the file). This is no security feature,
> but only a safety feature in case something goes wrong. But I still
> want to be able to create hard-links (I _do_ have write-permissions on
> the object/inode).

Does some real code do it? I believe this deserves to be broken -- you
explicitely opened that read-only...

     	  							Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  parent reply	other threads:[~2014-04-22 14:31 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-21 16:22 [RFC 0/2] Fix permission checks on open("/proc/self/fd/N", O_RDWR) Andy Lutomirski
2014-04-21 16:22 ` [RFC 1/2] fs,proc: Pass nameidata to proc_get_link implementations Andy Lutomirski
2014-04-21 16:29   ` Al Viro
2014-04-21 16:22 ` [RFC 2/2] fs,proc: Respect FMODE_WRITE when opening /proc/pid/fd/N Andy Lutomirski
2014-04-21 16:30   ` Al Viro
2014-04-21 17:00     ` Andy Lutomirski
2014-04-21 17:04       ` Andy Lutomirski
2014-04-21 17:48         ` Andy Lutomirski
2014-04-22 12:44   ` David Herrmann
2014-04-22 13:49     ` Andy Lutomirski
2014-04-22 14:17       ` David Herrmann
2014-04-22 14:33         ` Andy Lutomirski
2014-04-22 15:03           ` David Herrmann
2014-04-22 15:20             ` Andy Lutomirski
2014-04-22 14:40         ` Pavel Machek
2014-04-22 14:31     ` Pavel Machek [this message]
2014-04-22 15:19       ` David Herrmann
2014-04-22 15:24         ` Andy Lutomirski
2014-04-22 16:44           ` David Herrmann
2014-04-22 17:05             ` Andy Lutomirski
2014-04-22 18:58         ` Pavel Machek
2014-04-22 21:31           ` David Herrmann
2014-04-22 21:34             ` Andy Lutomirski
2014-04-22 22:12             ` 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=20140422143152.GA23716@amd.pavel.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=dh.herrmann@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    /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®