From: Greg Kurz <groug@kaod.org>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, "Daniel P. Berrange" <berrange@redhat.com>,
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Subject: Re: [Qemu-devel] [PATCH] 9pfs: fix vulnerability in openat_dir() and local_unlinkat_common()
Date: Fri, 3 Mar 2017 20:08:21 +0100 [thread overview]
Message-ID: <20170303200821.70ea87e8@bahia.lan> (raw)
In-Reply-To: <ef91a081-c25f-881e-eb60-90798df36a5a@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1486 bytes --]
On Fri, 3 Mar 2017 12:14:10 -0600
Eric Blake <eblake@redhat.com> wrote:
> On 03/03/2017 11:25 AM, Greg Kurz wrote:
> > We should pass O_NOFOLLOW otherwise openat() will follow symlinks and make
> > QEMU vulnerable.
> >
> > O_PATH was used as an optimization: the fd returned by openat_dir() is only
> > passed to openat() actually, so we don't really need to reach the underlying
> > filesystem.
> >
> > O_NOFOLLOW | O_PATH isn't an option: if name is a symlink, openat() will
> > return a fd, forcing us to do some other syscall to detect we have a
> > symlink. Also, O_PATH doesn't exist in glibc 2.13 and older.
>
> But the very next use of openat(fd, ) should fail with EBADF if fd is
> not a directory, so you don't need any extra syscalls. I agree that we
> _need_ O_NOFOLLOW, but I'm not yet convinced that we must avoid O_PATH
> where it works.
>
You may have a point indeed.
> I'm in the middle of writing a test program to probe kernel behavior and
> demonstrate (at least to myself) whether there are scenarios where
> O_PATH makes it possible to open something where omitting it did not,
> while at the same time validating that O_NOFOLLOW doesn't cause problems
> if a symlink-fd is returned instead of a directory fd, based on our
> subsequent use of that fd in a *at call.
>
I must leave right now, but please share the result of your experiment.
Thanks for your support on helping to fix 9p, Eric :)
Cheers.
--
Greg
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
next prev parent reply other threads:[~2017-03-03 19:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-03 17:25 [Qemu-devel] [PATCH] 9pfs: fix vulnerability in openat_dir() and local_unlinkat_common() Greg Kurz
2017-03-03 17:28 ` Daniel P. Berrange
2017-03-03 17:54 ` Mark Cave-Ayland
2017-03-03 19:04 ` Greg Kurz
2017-03-03 18:14 ` Eric Blake
2017-03-03 19:08 ` Greg Kurz [this message]
2017-03-03 23:43 ` Eric Blake
2017-03-04 11:21 ` Greg Kurz
2017-03-04 13:55 ` Mark Cave-Ayland
2017-03-04 15:17 ` Eric Blake
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=20170303200821.70ea87e8@bahia.lan \
--to=groug@kaod.org \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.