From: David Drysdale <drysdale@google.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Kees Cook <keescook@chromium.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Meredydd Luff <meredydd@senatehouse.org>,
Will Drewry <wad@chromium.org>,
Jorge Lucangeli Obes <jorgelo@google.com>,
Ricky Zhou <rickyz@google.com>, Lee Campbell <leecam@google.com>,
Julien Tinnes <jln@google.com>,
Mike Depinet <mdepinet@google.com>,
James Morris <james.l.morris@oracle.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Paul Moore <paul@paul-moore.com>,
Christoph Hellwig <hch@infradead.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Linux API <linux-api@vger.kernel.org>,
LSM List <linux-security-module@vger.kernel.org>
Subject: Re: [PATCH 1/3] fs: add O_BENEATH flag to openat(2)
Date: Mon, 3 Nov 2014 17:37:37 +0000 [thread overview]
Message-ID: <CAHse=S9AGNF84cLYszPSM2q7-78+KfuTCoap7eYyMEcbx97Zyw@mail.gmail.com> (raw)
In-Reply-To: <CALCETrWmivJCvAAZPQo9Jf5gDiSbpWKesjZWfqEQRXPOBSPY9g@mail.gmail.com>
On Mon, Nov 3, 2014 at 3:42 PM, Andy Lutomirski <luto@amacapital.net> wrote:
> On Mon, Nov 3, 2014 at 7:20 AM, Al Viro <viro@zeniv.linux.org.uk> wrote:
>> On Mon, Nov 03, 2014 at 11:48:23AM +0000, David Drysdale wrote:
>>> Add a new O_BENEATH flag for openat(2) which restricts the
>>> provided path, rejecting (with -EACCES) paths that are not beneath
>>> the provided dfd. In particular, reject:
>>> - paths that contain .. components
>>> - paths that begin with /
>>> - symlinks that have paths as above.
>>
>> Yecch... The degree of usefulness aside (and I'm not convinced that it
>> is non-zero),
>
> This is extremely useful in conjunction with seccomp.
Yes, that was my understanding of how the Chrome[OS] folk wanted
to use it.
>> WTF pass one bit out of nameidata->flags in a separate argument?
I'll shift to using nd->flags; not sure what I was thinking of there.
(It *might* have made more sense in the full patchset this was extracted
from but it certainly doesn't look sensible in this narrower context.)
>> Through the mutual recursion, no less... And then you are not even attempting
>> to detect symlinks that are not followed by interpretation of _any_ pathname.
>
> How many symlinks like that are there? Is there anything except
> nd_jump_link users? All of those are in /proc. Arguably O_BENEATH
> should prevent traversal of all of those links.
>
> --Andy
On a quick search, the 2 users of nd_jump_link (namely proc_pid_follow_link
and proc_ns_follow_link) seem to be the only implementations of
inode_operations->follow_link that don't just call nd_set_link(). So
disallowing that for O_BENEATH might give sensible behaviour.
next prev parent reply other threads:[~2014-11-03 17:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-03 11:48 [PATCH 0/3] fs: add O_BENEATH flag to openat(2) David Drysdale
[not found] ` <1415015305-15494-1-git-send-email-drysdale-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2014-11-03 11:48 ` [PATCH 1/3] " David Drysdale
2014-11-03 15:20 ` Al Viro
[not found] ` <20141103152036.GA7996-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2014-11-03 15:42 ` Andy Lutomirski
2014-11-03 17:22 ` Eric W.Biederman
2014-11-04 9:40 ` David Drysdale
2014-11-05 17:21 ` David Drysdale
[not found] ` <CAHse=S8ZmYLkOb9hmOMPkvHabqXH1sCUBTJWVO-++PMJXES=sg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-05 17:28 ` Andy Lutomirski
2014-11-03 17:37 ` David Drysdale [this message]
2014-11-03 18:26 ` Julien Tinnes
[not found] ` <CAKyRK=hRX1xk_0cRNhZ341HwU9Nim5_vhpM5twJHUOt8fH29=w@mail.gmail.com>
2014-11-03 18:29 ` Andy Lutomirski
2014-11-03 11:48 ` [PATCH 2/3] selftests: Add test of O_BENEATH & openat(2) David Drysdale
2014-11-03 11:48 ` [PATCH man-pages 3/3] open.2: describe O_BENEATH flag David Drysdale
2014-11-03 11:56 ` Paolo Bonzini
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='CAHse=S9AGNF84cLYszPSM2q7-78+KfuTCoap7eYyMEcbx97Zyw@mail.gmail.com' \
--to=drysdale@google.com \
--cc=ebiederm@xmission.com \
--cc=gregkh@linuxfoundation.org \
--cc=hch@infradead.org \
--cc=james.l.morris@oracle.com \
--cc=jln@google.com \
--cc=jorgelo@google.com \
--cc=keescook@chromium.org \
--cc=leecam@google.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mdepinet@google.com \
--cc=meredydd@senatehouse.org \
--cc=paul@paul-moore.com \
--cc=pbonzini@redhat.com \
--cc=rickyz@google.com \
--cc=viro@zeniv.linux.org.uk \
--cc=wad@chromium.org \
/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;
as well as URLs for NNTP newsgroup(s).