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>
This commit is contained in:
10
fs/exec.c
10
fs/exec.c
@@ -1139,7 +1139,7 @@ void setup_new_exec(struct linux_binprm * bprm)
|
||||
/* This is the point of no return */
|
||||
current->sas_ss_sp = current->sas_ss_size = 0;
|
||||
|
||||
if (current_euid() == current_uid() && current_egid() == current_gid())
|
||||
if (uid_eq(current_euid(), current_uid()) && gid_eq(current_egid(), current_gid()))
|
||||
set_dumpable(current->mm, 1);
|
||||
else
|
||||
set_dumpable(current->mm, suid_dumpable);
|
||||
@@ -1153,8 +1153,8 @@ void setup_new_exec(struct linux_binprm * bprm)
|
||||
current->mm->task_size = TASK_SIZE;
|
||||
|
||||
/* install the new credentials */
|
||||
if (bprm->cred->uid != current_euid() ||
|
||||
bprm->cred->gid != current_egid()) {
|
||||
if (!uid_eq(bprm->cred->uid, current_euid()) ||
|
||||
!gid_eq(bprm->cred->gid, current_egid())) {
|
||||
current->pdeath_signal = 0;
|
||||
} else {
|
||||
would_dump(bprm, bprm->file);
|
||||
@@ -2120,7 +2120,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
|
||||
if (__get_dumpable(cprm.mm_flags) == 2) {
|
||||
/* Setuid core dump mode */
|
||||
flag = O_EXCL; /* Stop rewrite attacks */
|
||||
cred->fsuid = 0; /* Dump root private */
|
||||
cred->fsuid = GLOBAL_ROOT_UID; /* Dump root private */
|
||||
}
|
||||
|
||||
retval = coredump_wait(exit_code, &core_state);
|
||||
@@ -2221,7 +2221,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
|
||||
* Dont allow local users get cute and trick others to coredump
|
||||
* into their pre-created files.
|
||||
*/
|
||||
if (inode->i_uid != current_fsuid())
|
||||
if (!uid_eq(inode->i_uid, current_fsuid()))
|
||||
goto close_fail;
|
||||
if (!cprm.file->f_op || !cprm.file->f_op->write)
|
||||
goto close_fail;
|
||||
|
Reference in New Issue
Block a user