mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
coredump: remove redundant defines for dumpable states
The existing SUID_DUMP_* defines duplicate the newer SUID_DUMPABLE_*
defines introduced in 54b501992d ("coredump: warn about unsafe
suid_dumpable / core_pattern combo"). Remove the new ones, and use the
prior values instead.
Signed-off-by: Kees Cook <[email protected]>
Reported-by: Chen Gang <[email protected]>
Cc: Alexander Viro <[email protected]>
Cc: Alan Cox <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Cc: Doug Ledford <[email protected]>
Cc: Serge Hallyn <[email protected]>
Cc: James Morris <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
5d1fadc147
commit
e579d2c259
5 changed files with 9 additions and 13 deletions
|
|
@ -501,7 +501,7 @@ void do_coredump(siginfo_t *siginfo)
|
|||
* so we dump it as root in mode 2, and only into a controlled
|
||||
* environment (pipe handler or fully qualified path).
|
||||
*/
|
||||
if (__get_dumpable(cprm.mm_flags) == SUID_DUMPABLE_SAFE) {
|
||||
if (__get_dumpable(cprm.mm_flags) == SUID_DUMP_ROOT) {
|
||||
/* Setuid core dump mode */
|
||||
flag = O_EXCL; /* Stop rewrite attacks */
|
||||
cred->fsuid = GLOBAL_ROOT_UID; /* Dump root private */
|
||||
|
|
|
|||
10
fs/exec.c
10
fs/exec.c
|
|
@ -1111,7 +1111,7 @@ void setup_new_exec(struct linux_binprm * bprm)
|
|||
current->sas_ss_sp = current->sas_ss_size = 0;
|
||||
|
||||
if (uid_eq(current_euid(), current_uid()) && gid_eq(current_egid(), current_gid()))
|
||||
set_dumpable(current->mm, SUID_DUMPABLE_ENABLED);
|
||||
set_dumpable(current->mm, SUID_DUMP_USER);
|
||||
else
|
||||
set_dumpable(current->mm, suid_dumpable);
|
||||
|
||||
|
|
@ -1639,17 +1639,17 @@ EXPORT_SYMBOL(set_binfmt);
|
|||
void set_dumpable(struct mm_struct *mm, int value)
|
||||
{
|
||||
switch (value) {
|
||||
case SUID_DUMPABLE_DISABLED:
|
||||
case SUID_DUMP_DISABLE:
|
||||
clear_bit(MMF_DUMPABLE, &mm->flags);
|
||||
smp_wmb();
|
||||
clear_bit(MMF_DUMP_SECURELY, &mm->flags);
|
||||
break;
|
||||
case SUID_DUMPABLE_ENABLED:
|
||||
case SUID_DUMP_USER:
|
||||
set_bit(MMF_DUMPABLE, &mm->flags);
|
||||
smp_wmb();
|
||||
clear_bit(MMF_DUMP_SECURELY, &mm->flags);
|
||||
break;
|
||||
case SUID_DUMPABLE_SAFE:
|
||||
case SUID_DUMP_ROOT:
|
||||
set_bit(MMF_DUMP_SECURELY, &mm->flags);
|
||||
smp_wmb();
|
||||
set_bit(MMF_DUMPABLE, &mm->flags);
|
||||
|
|
@ -1662,7 +1662,7 @@ int __get_dumpable(unsigned long mm_flags)
|
|||
int ret;
|
||||
|
||||
ret = mm_flags & MMF_DUMPABLE_MASK;
|
||||
return (ret > SUID_DUMPABLE_ENABLED) ? SUID_DUMPABLE_SAFE : ret;
|
||||
return (ret > SUID_DUMP_USER) ? SUID_DUMP_ROOT : ret;
|
||||
}
|
||||
|
||||
int get_dumpable(struct mm_struct *mm)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <linux/sched.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/binfmts.h>
|
||||
struct ctl_table_header;
|
||||
struct mempolicy;
|
||||
|
||||
|
|
@ -108,7 +109,7 @@ static inline int task_dumpable(struct task_struct *task)
|
|||
if (mm)
|
||||
dumpable = get_dumpable(mm);
|
||||
task_unlock(task);
|
||||
if (dumpable == SUID_DUMPABLE_ENABLED)
|
||||
if (dumpable == SUID_DUMP_USER)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue