mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Colin Walters <walters@verbum.org>, Greg Kurz <groug@kaod.org>,
	viro@zeniv.linux.org.uk
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] vfs: implement fchmodat2() syscall
Date: Tue, 11 Apr 2017 13:07:02 -0500	[thread overview]
Message-ID: <9005445d-2a56-effd-55da-b3bc700c5cf2@redhat.com> (raw)
In-Reply-To: <02954403-b546-0afe-39c7-23b7b05dece2@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 1746 bytes --]

On 04/11/2017 12:55 PM, Eric Blake wrote:
> On 04/11/2017 12:52 PM, Colin Walters wrote:
>>
>>
>> On Tue, Feb 28, 2017, at 02:23 PM, Eric Blake wrote:
>>
>>> Might also be worth mentioning that this patch is required in order to
>>> solve CVE-2016-9602, per discussion at
>>> https://lists.gnu.org/archive/html/qemu-devel/2017-02/msg06089.html
>>
>> I only briefly looked at this, but can't `open(..., O_PATH)` be used to solve
>> this today?
> 
> O_PATH was the fallback that qemu used

Hmm - actually, qemu used O_PATH for the directory portion of *at
traversals:
git.qemu-project.org/?p=qemu.git;a=commitdiff;h=918112c

but did not use O_PATH for its chmod() fallback:
git.qemu-project.org/?p=qemu.git;a=commitdiff;h=e3187a4

A good idea on the surface. But reading the man page of openat(), the
section on O_PATH says:
   The  file
              itself  is not opened, and other file operations (e.g.,
read(2),
              write(2), fchmod(2), fchown(2), fgetxattr(2), mmap(2))
fail with
              the error EBADF.

> - but that's non-POSIX, which
> means we have to have a different solution for POSIX systems than for
> Linux systems, while waiting for Linux to catch up to POSIX.

But even if using open(O_PATH)/fchmod() works, it is not immediately
obvious whether it can catch all the same cases that chmodat(O_NOFOLLOW)
would cover, as there are cases where you have permissions to change
mode bits but not open() the file for reading or writing.  And even if
it gets rid of a TOCTTOU race, it still is a 2-syscall hit rather than
an atomic single syscall.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2017-04-11 18:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-28 17:03 Greg Kurz
2017-02-28 17:03 ` [PATCH 2/2] x86: wire up " Greg Kurz
2017-03-01  9:00   ` kbuild test robot
2017-02-28 18:23 ` [PATCH 1/2] vfs: implement " Eric Blake
2017-02-28 18:41   ` Greg Kurz
2017-02-28 18:59     ` Eric Blake
2017-04-11 17:52   ` Colin Walters
2017-04-11 17:55     ` Eric Blake
2017-04-11 18:07       ` Eric Blake [this message]
2017-04-11 18:08         ` Eric Blake
2017-04-11 19:09         ` Colin Walters
2017-04-19 12:45           ` Greg Kurz
2017-03-01  9:01 ` Michael Kerrisk
2017-04-11 11:39   ` Greg Kurz
2017-04-11 12:04     ` Greg Kurz

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=9005445d-2a56-effd-55da-b3bc700c5cf2@redhat.com \
    --to=eblake@redhat.com \
    --cc=groug@kaod.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=walters@verbum.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

all inboxes | Powered by JetHome®