aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-03-04 00:17:15 -0500
committerEric W. Biederman <ebiederm@xmission.com>2012-05-03 06:29:34 -0400
commit8e96e3b7b8407be794ab1fd8e4b332818a358e78 (patch)
treef27756bb2ec49e586221ac669ea00c68e8a2ee58 /fs/exec.c
parent72cda3d1ef24ab0a9a89c15e9776ca737b75f45a (diff)
userns: Use uid_eq gid_eq helpers when comparing kuids and kgids in the vfs
Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 9a1d9f0a60ab..00ae2ef100d8 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1139,7 +1139,7 @@ void setup_new_exec(struct linux_binprm * bprm)
1139 /* This is the point of no return */ 1139 /* This is the point of no return */
1140 current->sas_ss_sp = current->sas_ss_size = 0; 1140 current->sas_ss_sp = current->sas_ss_size = 0;
1141 1141
1142 if (current_euid() == current_uid() && current_egid() == current_gid()) 1142 if (uid_eq(current_euid(), current_uid()) && gid_eq(current_egid(), current_gid()))
1143 set_dumpable(current->mm, 1); 1143 set_dumpable(current->mm, 1);
1144 else 1144 else
1145 set_dumpable(current->mm, suid_dumpable); 1145 set_dumpable(current->mm, suid_dumpable);
@@ -1153,8 +1153,8 @@ void setup_new_exec(struct linux_binprm * bprm)
1153 current->mm->task_size = TASK_SIZE; 1153 current->mm->task_size = TASK_SIZE;
1154 1154
1155 /* install the new credentials */ 1155 /* install the new credentials */
1156 if (bprm->cred->uid != current_euid() || 1156 if (!uid_eq(bprm->cred->uid, current_euid()) ||
1157 bprm->cred->gid != current_egid()) { 1157 !gid_eq(bprm->cred->gid, current_egid())) {
1158 current->pdeath_signal = 0; 1158 current->pdeath_signal = 0;
1159 } else { 1159 } else {
1160 would_dump(bprm, bprm->file); 1160 would_dump(bprm, bprm->file);
@@ -2120,7 +2120,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
2120 if (__get_dumpable(cprm.mm_flags) == 2) { 2120 if (__get_dumpable(cprm.mm_flags) == 2) {
2121 /* Setuid core dump mode */ 2121 /* Setuid core dump mode */
2122 flag = O_EXCL; /* Stop rewrite attacks */ 2122 flag = O_EXCL; /* Stop rewrite attacks */
2123 cred->fsuid = 0; /* Dump root private */ 2123 cred->fsuid = GLOBAL_ROOT_UID; /* Dump root private */
2124 } 2124 }
2125 2125
2126 retval = coredump_wait(exit_code, &core_state); 2126 retval = coredump_wait(exit_code, &core_state);
@@ -2221,7 +2221,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
2221 * Dont allow local users get cute and trick others to coredump 2221 * Dont allow local users get cute and trick others to coredump
2222 * into their pre-created files. 2222 * into their pre-created files.
2223 */ 2223 */
2224 if (inode->i_uid != current_fsuid()) 2224 if (!uid_eq(inode->i_uid, current_fsuid()))
2225 goto close_fail; 2225 goto close_fail;
2226 if (!cprm.file->f_op || !cprm.file->f_op->write) 2226 if (!cprm.file->f_op || !cprm.file->f_op->write)
2227 goto close_fail; 2227 goto close_fail;