From: Boaz Harrosh <boaz@plexistor.com>
To: "J. Bruce Fields" <bfields@fieldses.org>, NeilBrown <neilb@suse.de>
Cc: NFS <linux-nfs@vger.kernel.org>
Subject: Re: Does NFSv4 need to call inode_permission on every write???
Date: Thu, 21 May 2015 16:23:47 +0300 [thread overview]
Message-ID: <555DDC63.6030707@plexistor.com> (raw)
In-Reply-To: <20150521130735.GA27065@fieldses.org>
On 05/21/2015 04:07 PM, J. Bruce Fields wrote:
> On Thu, May 21, 2015 at 02:40:29PM +1000, NeilBrown wrote:
>>
>>
>> Apologies if this has been answered before, however...
>>
>> In nfsd_write() we have:
>>
>> if (file) {
>> err = nfsd_permission(rqstp, fhp->fh_export, fhp->fh_dentry,
>> NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE);
>> if (err)
>> goto out;
>> err = nfsd_vfs_write(rqstp, fhp, file, offset, vec, vlen, cnt,
>> stablep);
>> } else {
>>
>> So if a 'file' is already available - because the request came via NFSv4 and
>> there was a valid state id, and a 'struct file' was associated with that
>> state - we still call nfsd_permission().
>>
>> Is that really needed? The permission check will have been performed at open
>> - it shouldn't be needed again now.
>>
>> With NFSv3 we have to check permission at each IO, and this is slightly
>> different from POSIX semantics. We shouldn't have to with NFSv4... should we?
>>
>> The particular issue that brought this to my attention is that "chattr +i" -
>> to make a file immutable - is not supposed to affect current opens, only
>> future opens. But a current open over NFSv4 is affected.
>>
>> Is there some reason that we cannot just remove that nfsd_permission() check?
>
> The only proof that this write is part of the open is a stateid provided
> as part of the write arguments. Anyone could sniff or guess that
> stateid.
>
Perhaps like in OSD take a few bits in the state ID for a crypto
sig on the stateid+internal-server-counter this way it will be
impossible to fake. (The crypto key is only known to the server
and is volatile) (Yes you'll need to fake something with the DSs
unless you want to communicate public keys for verification)
(No it is not implemented in open-osd, is just provisioned for
in the STD)
Just a thought
Boaz
> We could try to make that work by checking the stateid against the
> principal from the rpc header. Unfortunately that turns out to be more
> complicated than "is this the same principal as did the open"; among
> other things I think it's possible the stateid resulted from opens done
> by different principals, so we'd need to keep a list. If we added that
> kind of check, could we drop the per-operation check? It's not obvious
> to me.
>
> --b.
next prev parent reply other threads:[~2015-05-21 13:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-21 4:40 Does NFSv4 need to call inode_permission on every write??? NeilBrown
2015-05-21 13:07 ` J. Bruce Fields
2015-05-21 13:23 ` Boaz Harrosh [this message]
2015-05-21 23:01 ` NeilBrown
2015-05-22 16:16 ` J. Bruce Fields
2015-05-23 13:37 ` Jeff Layton
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=555DDC63.6030707@plexistor.com \
--to=boaz@plexistor.com \
--cc=bfields@fieldses.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
/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.