diff options
author | jh <jh@FreeBSD.org> | 2010-08-30 16:30:18 +0000 |
---|---|---|
committer | jh <jh@FreeBSD.org> | 2010-08-30 16:30:18 +0000 |
commit | c2cb836190c82be4859c68f5fabd199508638762 (patch) | |
tree | 74e3c2e0dd77b8186e54fea709c4eef6f29e2ae5 /sys/kern/kern_exec.c | |
parent | 8505815b26f679d50f55f4ed16b1604f2d747b4e (diff) | |
download | FreeBSD-src-c2cb836190c82be4859c68f5fabd199508638762.zip FreeBSD-src-c2cb836190c82be4859c68f5fabd199508638762.tar.gz |
execve(2) has a special check for file permissions: a file must have at
least one execute bit set, otherwise execve(2) will return EACCES even
for an user with PRIV_VFS_EXEC privilege.
Add the check also to vaccess(9), vaccess_acl_nfs4(9) and
vaccess_acl_posix1e(9). This makes access(2) to better agree with
execve(2). Because ZFS doesn't use vaccess(9) for VEXEC, add the check
to zfs_freebsd_access() too. There may be other file systems which are
not using vaccess*() functions and need to be handled separately.
PR: kern/125009
Reviewed by: bde, trasz
Approved by: pjd (ZFS part)
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r-- | sys/kern/kern_exec.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 2e7e08a..3c05530 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1363,17 +1363,17 @@ exec_check_permissions(imgp) if (error) return (error); #endif - + /* - * 1) Check if file execution is disabled for the filesystem that this - * file resides on. - * 2) Insure that at least one execute bit is on - otherwise root - * will always succeed, and we don't want to happen unless the - * file really is executable. - * 3) Insure that the file is a regular file. + * 1) Check if file execution is disabled for the filesystem that + * this file resides on. + * 2) Ensure that at least one execute bit is on. Otherwise, a + * privileged user will always succeed, and we don't want this + * to happen unless the file really is executable. + * 3) Ensure that the file is a regular file. */ if ((vp->v_mount->mnt_flag & MNT_NOEXEC) || - ((attr->va_mode & 0111) == 0) || + (attr->va_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) == 0 || (attr->va_type != VREG)) return (EACCES); |