Possible permissions bug on NFSv3 kernel client
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
On Thu, 29 Apr 2004 23:30:50 +0200, you wrote in linux.kernel:
Quoted 2 lines
It's not "mixed up" at all: the permissions checking has to be done by the server, period.
Then it's at least inconsistent with local filesystem behaviour. fsck has no problem opening device nodes for writing on my root filesystem even though it is mounted read-only at that point.
Signature · 2 lines
Ciao, Pascal
Quoted 3 lines · Pascal Schmidt
Then it's at least inconsistent with local filesystem behaviour. fsck has no problem opening device nodes for writing on my root filesystem even though it is mounted read-only at that point.
So why do you think that is inconsistent with my statement: "the permissions checking has to be done by the server, period"?
The read-only mount option is a *local* override of the write permissions on the server. It applies to regular files, directories, and soft links *only*.
The read-only mount option does *not apply* to char/block devices such as /dev/hd[a-z]*, /dev/tty*. Permission checks on open() for those devices are done on the server *only* via the ACCESS rpc call.
This should be entirely consistent with local file behaviour. Particularly since the code to deal with the read-only mount option in nfs_permission() was pretty much cut-n-pasted from vfs_permission().
Cheers,
Trond
Quoted 2 lines · Trond Myklebust
So why do you think that is inconsistent with my statement: "the permissions checking has to be done by the server, period"?
I see it wasn't clear from my reply. I don't disagree at all. Permission checking is the server's job. Clients are untrusted.
Quoted 3 lines
This should be entirely consistent with local file behaviour. Particularly since the code to deal with the read-only mount option in
nfs_permission()was pretty much cut-n-pasted fromvfs_permission().
The original poster said it didn't work for him on an NFSv3 mount. Looking at nfs_permission() I (of course) agree it looks innocent enough.
Signature · 2 lines
Ciao, Pascal
Hi,
Quoted 2 lines
So why do you think that is inconsistent with my statement: "the permissions checking has to be done by the server, period"?
I agree that permission checking should be done by the server. However, I believe that in this case the client is requesting the wrong permissions. As writing to a char/block device does not perform a write operation *on the server* then the client should not be asking the server for modify/extend permission in the case of char/block devices.
Quoted 3 lines
The read-only mount option does *not apply* to char/block devices such as /dev/hd[a-z]*,
/dev/tty*. Permission checks onopen()for those devices are done on the server *only* via the ACCESS rpc call.
Should vfs_permission() (as called from nfs_permission) be sufficient to perform this check?
Quoted 2 lines
This should be entirely consistent with local file behaviour.
I don't believe that it is... it is possible to write to a block device on a filesystem that is mounted read-only, but not to write to a block device on an NFS filesystem that is *exported* read-only.
I think that nfs_permission() may do sufficient checking - I believe the problem is in nfs3_proc_access() - where the client is asking the server for more permissions than it needs.
Colin
Quoted 3 lines · Colin Paton
As writing to a char/block device does not perform a write operation *on the server* then the client should not be asking the server for modify/extend permission in the case of char/block devices.
Sure it should: you are asking it for write permission! If you didn't check the for modify/extend, then you be allowing world write permission by default.
I just checked that Sun's NFS client indeed checks both "extend" and "modify" when attempting to write to a character device.
Quoted 6 lines
Quoted 3 lines
The read-only mount option does *not apply* to char/block devices such as /dev/hd[a-z]*,
/dev/tty*. Permission checks onopen()for those devices are done on the server *only* via the ACCESS rpc call.Should
vfs_permission()(as called fromnfs_permission) be sufficient to perform this check?
No! I repeat: vfs_permission() knows nothing about any uid/gid mapping/squashing. You cannot rely exclusively on the mode bits in NFS.
Quoted 3 lines
I don't believe that it is... it is possible to write to a block device on a filesystem that is mounted read-only, but not to write to a block device on an NFS filesystem that is *exported* read-only.
That sounds like a server bug, then.
Cheers,
Trond