uselib: add missing MNT_NOEXEC check
Subsystems (2)
PATCH 1/1 uselib: add missing MNT_NOEXEC check
We don't allow loading ELF shared library from noexec points so the same should apply to sys_uselib aswell.
Signed-off-by Christoph Hellwig <[email protected]>
fs/exec.c +2 -0
@@ -133,6 +133,8 @@ asmlinkage long sys_uselib(const char __ goto out; error = -EINVAL ; +if (nd.mnt->mnt_flags &MNT_NOEXEC ) + goto exit;if (!S_ISREG (nd.dentry->d_inode->i_mode)) goto exit;
Quoted 2 lines · Christoph Hellwig
We don't allow loading ELF shared library from noexec points so the same should apply to
sys_uselibaswell.
Correct. But...
fs/exec.c asmlinkage long sys_uselib(const char __ · line 137
Quoted 3 lines
error = -EINVAL;fs/exec.c +2
-0+if (nd.mnt->mnt_flags &MNT_NOEXEC ) + goto exit;
... the error here should be EACCES. Aside from that you get an ACK from me.
Quoted 6 lines · Ulrich Drepper
Review
Quoted 3 lines
error = -EINVAL;(quoted diff) +2
-0+ if (nd.mnt->mnt_flags & MNT_NOEXEC) + goto exit;... the error here should be EACCES. Aside from that you get an ACK from me.
updated patch below:
fs/exec.c +3 -0
@@ -134,6 +134,9 @@ asmlinkage long sys_uselib(const char __if (error) goto out; + error = -EACCES ; +if (nd.mnt->mnt_flags &MNT_NOEXEC ) + goto exit; error = -EINVAL ;if (!S_ISREG (nd.dentry->d_inode->i_mode)) goto exit;