2013-06-01 11:33:59

by William Dauchy

[permalink] [raw]
Subject: nfsv4 mount with noexec

Hello,

I've been testing a nfsv4 client based on a 3.8.13 kernel with the
following additional patches:
a3c3cac SUNRPC: Prevent an rpc_task wakeup race
f448bad NFSv4: Fix a thinko in nfs4_try_open_cached
eb54d43 NFS: Fix security flavor negotiation with legacy binary mounts

the mount options are:
type nfs4
rw,nosuid,nodev,noexec,noatime,nodiratime,vers=4.0,rsize=32768,wsize=32768,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,local_lock=none

Even with the noexec option, I'm still able to execute local binaries
on the mounted file system.
Am I wrong on something? I didn't had the issue on a 3.4.x

Regards,

--
William


2013-06-02 20:56:06

by Myklebust, Trond

[permalink] [raw]
Subject: Re: nfsv4 mount with noexec

On Sat, 2013-06-01 at 13:33 +0200, William Dauchy wrote:
> Hello,
>
> I've been testing a nfsv4 client based on a 3.8.13 kernel with the
> following additional patches:
> a3c3cac SUNRPC: Prevent an rpc_task wakeup race
> f448bad NFSv4: Fix a thinko in nfs4_try_open_cached
> eb54d43 NFS: Fix security flavor negotiation with legacy binary mounts
>
> the mount options are:
> type nfs4
> rw,nosuid,nodev,noexec,noatime,nodiratime,vers=4.0,rsize=32768,wsize=32768,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,local_lock=none
>
> Even with the noexec option, I'm still able to execute local binaries
> on the mounted file system.
> Am I wrong on something? I didn't had the issue on a 3.4.x

The mount level flags such as 'nosuid', 'nodev' and 'noexec' are
supposed to be enforced by the VFS, and not by the NFS code. The check
is supposedly done in fs/exec.c:open_exec() after the file has been
opened by the filesystem.

Does 'cat /proc/mounts' actually show the noexec option being applied to
the mountpoint by the kernel?

--
Trond Myklebust
Linux NFS client maintainer

NetApp
[email protected]
http://www.netapp.com

2013-06-02 23:05:22

by William Dauchy

[permalink] [raw]
Subject: Re: nfsv4 mount with noexec

On Sun, Jun 2, 2013 at 10:56 PM, Myklebust, Trond
<[email protected]> wrote:
> The mount level flags such as 'nosuid', 'nodev' and 'noexec' are
> supposed to be enforced by the VFS, and not by the NFS code. The check
> is supposedly done in fs/exec.c:open_exec() after the file has been
> opened by the filesystem.
>
> Does 'cat /proc/mounts' actually show the noexec option being applied to
> the mountpoint by the kernel?

arg I mixed the original mount point and a binded mount point.

Sorry for the noise,

--
William