Skip to content

Commit

Permalink
uselib: add missing MNT_NOEXEC check
Browse files Browse the repository at this point in the history
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 <hch@lst.de>
Cc: Ulrich Drepper <drepper@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Christoph Hellwig authored and Linus Torvalds committed May 24, 2007
1 parent 5a1b639 commit 492c8b3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ asmlinkage long sys_uselib(const char __user * library)
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;
Expand Down

0 comments on commit 492c8b3

Please sign in to comment.