Browse Source

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 <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>
Christoph Hellwig 18 years ago
parent
commit
492c8b332e
1 changed files with 3 additions and 0 deletions
  1. 3 0
      fs/exec.c

+ 3 - 0
fs/exec.c

@@ -134,6 +134,9 @@ asmlinkage long sys_uselib(const char __user * library)
 	if (error)
 	if (error)
 		goto out;
 		goto out;
 
 
+	error = -EACCES;
+	if (nd.mnt->mnt_flags & MNT_NOEXEC)
+		goto exit;
 	error = -EINVAL;
 	error = -EINVAL;
 	if (!S_ISREG(nd.dentry->d_inode->i_mode))
 	if (!S_ISREG(nd.dentry->d_inode->i_mode))
 		goto exit;
 		goto exit;