aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2009-05-08 08:55:22 -0400
committerJames Morris <jmorris@namei.org>2009-05-10 18:15:36 -0400
commit5e751e992f3fb08ba35e1ca8095ec8fbf9eda523 (patch)
tree711b1b47622dc9661f1d3d9c67d55c0b21456e8c /fs
parentd254117099d711f215e62427f55dfb8ebd5ad011 (diff)
CRED: Rename cred_exec_mutex to reflect that it's a guard against ptrace
Rename cred_exec_mutex to reflect that it's a guard against foreign intervention on a process's credential state, such as is made by ptrace(). The attachment of a debugger to a process affects execve()'s calculation of the new credential state - _and_ also setprocattr()'s calculation of that state. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/compat.c6
-rw-r--r--fs/exec.c10
2 files changed, 8 insertions, 8 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 639177b0eeac..998e856c3079 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1045,7 +1045,7 @@ void install_exec_creds(struct linux_binprm *bprm)
1045 commit_creds(bprm->cred); 1045 commit_creds(bprm->cred);
1046 bprm->cred = NULL; 1046 bprm->cred = NULL;
1047 1047
1048 /* cred_exec_mutex must be held at least to this point to prevent 1048 /* cred_guard_mutex must be held at least to this point to prevent
1049 * ptrace_attach() from altering our determination of the task's 1049 * ptrace_attach() from altering our determination of the task's
1050 * credentials; any time after this it may be unlocked */ 1050 * credentials; any time after this it may be unlocked */
1051 1051
@@ -1055,7 +1055,7 @@ EXPORT_SYMBOL(install_exec_creds);
1055 1055
1056/* 1056/*
1057 * determine how safe it is to execute the proposed program 1057 * determine how safe it is to execute the proposed program
1058 * - the caller must hold current->cred_exec_mutex to protect against 1058 * - the caller must hold current->cred_guard_mutex to protect against
1059 * PTRACE_ATTACH 1059 * PTRACE_ATTACH
1060 */ 1060 */
1061int check_unsafe_exec(struct linux_binprm *bprm) 1061int check_unsafe_exec(struct linux_binprm *bprm)
@@ -1297,7 +1297,7 @@ int do_execve(char * filename,
1297 if (!bprm) 1297 if (!bprm)
1298 goto out_files; 1298 goto out_files;
1299 1299
1300 retval = mutex_lock_interruptible(&current->cred_exec_mutex); 1300 retval = mutex_lock_interruptible(&current->cred_guard_mutex);
1301 if (retval < 0) 1301 if (retval < 0)
1302 goto out_free; 1302 goto out_free;
1303 current->in_execve = 1; 1303 current->in_execve = 1;
@@ -1360,7 +1360,7 @@ int do_execve(char * filename,
1360 /* execve succeeded */ 1360 /* execve succeeded */
1361 current->fs->in_exec = 0; 1361 current->fs->in_exec = 0;
1362 current->in_execve = 0; 1362 current->in_execve = 0;
1363 mutex_unlock(&current->cred_exec_mutex); 1363 mutex_unlock(&current->cred_guard_mutex);
1364 acct_update_integrals(current); 1364 acct_update_integrals(current);
1365 free_bprm(bprm); 1365 free_bprm(bprm);
1366 if (displaced) 1366 if (displaced)
@@ -1383,7 +1383,7 @@ out_unmark:
1383 1383
1384out_unlock: 1384out_unlock:
1385 current->in_execve = 0; 1385 current->in_execve = 0;
1386 mutex_unlock(&current->cred_exec_mutex); 1386 mutex_unlock(&current->cred_guard_mutex);
1387 1387
1388out_free: 1388out_free:
1389 free_bprm(bprm); 1389 free_bprm(bprm);