aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/compat.c6
-rw-r--r--fs/exec.c10
-rw-r--r--fs/hugetlbfs/inode.c2
-rw-r--r--fs/namei.c6
-rw-r--r--fs/proc/base.c6
5 files changed, 20 insertions, 10 deletions
diff --git a/fs/compat.c b/fs/compat.c
index 681ed81e6be0..bb2a9b2e8173 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1488,7 +1488,7 @@ int compat_do_execve(char * filename,
1488 if (!bprm) 1488 if (!bprm)
1489 goto out_files; 1489 goto out_files;
1490 1490
1491 retval = mutex_lock_interruptible(&current->cred_exec_mutex); 1491 retval = mutex_lock_interruptible(&current->cred_guard_mutex);
1492 if (retval < 0) 1492 if (retval < 0)
1493 goto out_free; 1493 goto out_free;
1494 current->in_execve = 1; 1494 current->in_execve = 1;
@@ -1550,7 +1550,7 @@ int compat_do_execve(char * filename,
1550 /* execve succeeded */ 1550 /* execve succeeded */
1551 current->fs->in_exec = 0; 1551 current->fs->in_exec = 0;
1552 current->in_execve = 0; 1552 current->in_execve = 0;
1553 mutex_unlock(&current->cred_exec_mutex); 1553 mutex_unlock(&current->cred_guard_mutex);
1554 acct_update_integrals(current); 1554 acct_update_integrals(current);
1555 free_bprm(bprm); 1555 free_bprm(bprm);
1556 if (displaced) 1556 if (displaced)
@@ -1573,7 +1573,7 @@ out_unmark:
1573 1573
1574out_unlock: 1574out_unlock:
1575 current->in_execve = 0; 1575 current->in_execve = 0;
1576 mutex_unlock(&current->cred_exec_mutex); 1576 mutex_unlock(&current->cred_guard_mutex);
1577 1577
1578out_free: 1578out_free:
1579 free_bprm(bprm); 1579 free_bprm(bprm);
diff --git a/fs/exec.c b/fs/exec.c
index 895823d0149d..a7fcd975c6b2 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1016,7 +1016,7 @@ void install_exec_creds(struct linux_binprm *bprm)
1016 commit_creds(bprm->cred); 1016 commit_creds(bprm->cred);
1017 bprm->cred = NULL; 1017 bprm->cred = NULL;
1018 1018
1019 /* cred_exec_mutex must be held at least to this point to prevent 1019 /* cred_guard_mutex must be held at least to this point to prevent
1020 * ptrace_attach() from altering our determination of the task's 1020 * ptrace_attach() from altering our determination of the task's
1021 * credentials; any time after this it may be unlocked */ 1021 * credentials; any time after this it may be unlocked */
1022 1022
@@ -1026,7 +1026,7 @@ EXPORT_SYMBOL(install_exec_creds);
1026 1026
1027/* 1027/*
1028 * determine how safe it is to execute the proposed program 1028 * determine how safe it is to execute the proposed program
1029 * - the caller must hold current->cred_exec_mutex to protect against 1029 * - the caller must hold current->cred_guard_mutex to protect against
1030 * PTRACE_ATTACH 1030 * PTRACE_ATTACH
1031 */ 1031 */
1032int check_unsafe_exec(struct linux_binprm *bprm) 1032int check_unsafe_exec(struct linux_binprm *bprm)
@@ -1268,7 +1268,7 @@ int do_execve(char * filename,
1268 if (!bprm) 1268 if (!bprm)
1269 goto out_files; 1269 goto out_files;
1270 1270
1271 retval = mutex_lock_interruptible(&current->cred_exec_mutex); 1271 retval = mutex_lock_interruptible(&current->cred_guard_mutex);
1272 if (retval < 0) 1272 if (retval < 0)
1273 goto out_free; 1273 goto out_free;
1274 current->in_execve = 1; 1274 current->in_execve = 1;
@@ -1331,7 +1331,7 @@ int do_execve(char * filename,
1331 /* execve succeeded */ 1331 /* execve succeeded */
1332 current->fs->in_exec = 0; 1332 current->fs->in_exec = 0;
1333 current->in_execve = 0; 1333 current->in_execve = 0;
1334 mutex_unlock(&current->cred_exec_mutex); 1334 mutex_unlock(&current->cred_guard_mutex);
1335 acct_update_integrals(current); 1335 acct_update_integrals(current);
1336 free_bprm(bprm); 1336 free_bprm(bprm);
1337 if (displaced) 1337 if (displaced)
@@ -1354,7 +1354,7 @@ out_unmark:
1354 1354
1355out_unlock: 1355out_unlock:
1356 current->in_execve = 0; 1356 current->in_execve = 0;
1357 mutex_unlock(&current->cred_exec_mutex); 1357 mutex_unlock(&current->cred_guard_mutex);
1358 1358
1359out_free: 1359out_free:
1360 free_bprm(bprm); 1360 free_bprm(bprm);
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index c1462d43e721..941c8425c10b 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -30,6 +30,7 @@
30#include <linux/dnotify.h> 30#include <linux/dnotify.h>
31#include <linux/statfs.h> 31#include <linux/statfs.h>
32#include <linux/security.h> 32#include <linux/security.h>
33#include <linux/ima.h>
33 34
34#include <asm/uaccess.h> 35#include <asm/uaccess.h>
35 36
@@ -986,6 +987,7 @@ struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag)
986 &hugetlbfs_file_operations); 987 &hugetlbfs_file_operations);
987 if (!file) 988 if (!file)
988 goto out_dentry; /* inode is already attached */ 989 goto out_dentry; /* inode is already attached */
990 ima_counts_get(file);
989 991
990 return file; 992 return file;
991 993
diff --git a/fs/namei.c b/fs/namei.c
index 967c3db92724..c82805d088e1 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -853,7 +853,8 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
853 err = inode_permission(nd->path.dentry->d_inode, 853 err = inode_permission(nd->path.dentry->d_inode,
854 MAY_EXEC); 854 MAY_EXEC);
855 if (!err) 855 if (!err)
856 err = ima_path_check(&nd->path, MAY_EXEC); 856 err = ima_path_check(&nd->path, MAY_EXEC,
857 IMA_COUNT_UPDATE);
857 if (err) 858 if (err)
858 break; 859 break;
859 860
@@ -1515,7 +1516,8 @@ int may_open(struct path *path, int acc_mode, int flag)
1515 return error; 1516 return error;
1516 1517
1517 error = ima_path_check(path, 1518 error = ima_path_check(path,
1518 acc_mode & (MAY_READ | MAY_WRITE | MAY_EXEC)); 1519 acc_mode & (MAY_READ | MAY_WRITE | MAY_EXEC),
1520 IMA_COUNT_UPDATE);
1519 if (error) 1521 if (error)
1520 return error; 1522 return error;
1521 /* 1523 /*
diff --git a/fs/proc/base.c b/fs/proc/base.c
index fb45615943c2..23342e188a66 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2128,9 +2128,15 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf,
2128 if (copy_from_user(page, buf, count)) 2128 if (copy_from_user(page, buf, count))
2129 goto out_free; 2129 goto out_free;
2130 2130
2131 /* Guard against adverse ptrace interaction */
2132 length = mutex_lock_interruptible(&task->cred_guard_mutex);
2133 if (length < 0)
2134 goto out_free;
2135
2131 length = security_setprocattr(task, 2136 length = security_setprocattr(task,
2132 (char*)file->f_path.dentry->d_name.name, 2137 (char*)file->f_path.dentry->d_name.name,
2133 (void*)page, count); 2138 (void*)page, count);
2139 mutex_unlock(&task->cred_guard_mutex);
2134out_free: 2140out_free:
2135 free_page((unsigned long) page); 2141 free_page((unsigned long) page);
2136out: 2142out: