linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Waychison <mikew@google.com>
To: Jason Uhlenkott <jasonuhl@jasonuhl.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [patch 1/1] Drop CAP_SYS_RAWIO requirement for FIBMAP
Date: Fri, 26 Oct 2007 15:53:29 -0700	[thread overview]
Message-ID: <47226FE9.6060705@google.com> (raw)
In-Reply-To: <20071026224035.GB27037@aurum.uhlenkott.net>

Jason Uhlenkott wrote:
> On Fri, Oct 26, 2007 at 14:59:57 -0700, Mike Waychison wrote:
>> Jason Uhlenkott wrote:
>>> Additionally, ext3_bmap() has this to say about it:
>>>
>>>        if (EXT3_I(inode)->i_state & EXT3_STATE_JDATA) {
>>>                /*
>>>                 * This is a REALLY heavyweight approach, but the use of
>>>                 * bmap on dirty files is expected to be extremely rare:
>>>                 * only if we run lilo or swapon on a freshly made file
>>>                 * do we expect this to happen.
>>>                 *
>>>                 * (bmap requires CAP_SYS_RAWIO so this does not
>>>                 * represent an unprivileged user DOS attack --- we'd be
>>>                 * in trouble if mortal users could trigger this path at
>>>                 * will.)
>> Hmm.  I don't know what the right approach to this is.  This seems to be 
>> the same situation as the delayed allocation problem, no?
> 
> Yup.
> 
>> What if we just returned 0?  Tools like lilo are already doing sync(), 
>> would that cause the journal to get flushed explicitly anyway?
> 
> Not sure, but I'd be pretty nervous about breaking any existing users
> which aren't explicitly syncing.

True.   We can probably get away with an implicit flush when 
CAP_SYS_RAWIO is set, but that's pretty gross :(

> 
> Are you envisioning users who want to see where their data is landing
> for performance reasons?  It seems like such users are going to have
> sufficiently different desires from existing FIBMAP users (who need to
> know where everything is because they intend to fiddle with the raw
> device) that a different interface might be warranted.

A little of both ;)

We could introduce a new API, though either way, the same fundamental 
problems apply wrt auditing.

I see three reasons that new APIs are warranted:

a) to deal with block numbers > 2^31 --> FIBMAP64
b) to have a path where no syncing is required due to worries about user 
DoS (delayed allocation / data in journal).
c) possibly some way to FIBMAP a range so that userspace doesn't need to 
syscall for each block, something like how mincore() does it?

I have a patchset ready that I'll send out shortly that introduces 
FIBMAP64.  The last patch in that set drops the CAP_SYS_RAWIO, but it's 
probably not what we want given DoS case.  I'd like to send it out 
anyway to get some comments on some of the sanity checks and locking I'm 
adding.

Handling (c) above is just extra sugar and isn't something I'm too 
worried about implementing.

Mike Waychison

  reply	other threads:[~2007-10-26 22:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-25 23:06 [patch 1/1] Drop CAP_SYS_RAWIO requirement for FIBMAP Mike Waychison
2007-10-26  0:22 ` Alan Cox
2007-10-26  0:35   ` Mike Waychison
2007-10-26  0:43     ` Alan Cox
2007-10-26 21:55   ` Jason Uhlenkott
2007-10-26 21:59     ` Mike Waychison
2007-10-26 22:40       ` Jason Uhlenkott
2007-10-26 22:53         ` Mike Waychison [this message]
2007-10-29 19:08 ` Pavel Machek
2007-11-01 14:51   ` Ric Wheeler

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=47226FE9.6060705@google.com \
    --to=mikew@google.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=jasonuhl@jasonuhl.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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).