Replace the SUID_DUMP_DISABLE/USER/ROOT preprocessor constants with enum task_dumpable. Numeric values are preserved (kernel.suid_dumpable sysctl and prctl(PR_SET_DUMPABLE) ABI), so this is a pure rename with no behavioral change. Subsequent commits relocate dumpability onto a per-task structure where the enum type will allow stronger type-checking on the new API.
Showing the changes to kernel (3 of 10 files). Show all
Unified · Split
| @@ -571,7 +571,7 @@ static void exit_mm(void) · 570 unmodified lines | |||
| 571 | */ | 571 | */ |
| 572 | smp_mb__after_spinlock(); | 572 | smp_mb__after_spinlock(); |
| 573 | local_irq_disable(); | 573 | local_irq_disable(); |
| 574 | current->user_dumpable = (get_dumpable(mm) == SUID_DUMP_USER); | 574 | current->user_dumpable = (get_dumpable(mm) == TASK_DUMPABLE_OWNER); |
| 575 | current->mm = NULL; | 575 | current->mm = NULL; |
| 576 | membarrier_update_current_mm(NULL); | 576 | membarrier_update_current_mm(NULL); |
| 577 | enter_lazy_tlb(mm, current); | 577 | enter_lazy_tlb(mm, current); |
| @@ -53,7 +53,7 @@ int ptrace_access_vm(struct task_struct *tsk, unsigned long addr, · 52 unmodified lines | |||
| 53 | 53 | ||
| 54 | if (!tsk->ptrace || | 54 | if (!tsk->ptrace || |
| 55 | (current != tsk->parent) || | 55 | (current != tsk->parent) || |
| 56 | ((get_dumpable(mm) != SUID_DUMP_USER) && | 56 | ((get_dumpable(mm) != TASK_DUMPABLE_OWNER) && |
| 57 | !ptracer_capable(tsk, mm->user_ns))) { | 57 | !ptracer_capable(tsk, mm->user_ns))) { |
| 58 | mmput(mm); | 58 | mmput(mm); |
| 59 | return 0; | 59 | return 0; |
| @@ -276,7 +276,7 @@ static bool task_still_dumpable(struct task_struct *task, unsigned int mode) · 216 unmodified lines | |||
| 276 | { | 276 | { |
| 277 | struct mm_struct *mm = task->mm; | 277 | struct mm_struct *mm = task->mm; |
| 278 | if (mm) { | 278 | if (mm) { |
| 279 | if (get_dumpable(mm) == SUID_DUMP_USER) | 279 | if (get_dumpable(mm) == TASK_DUMPABLE_OWNER) |
| 280 | return true; | 280 | return true; |
| 281 | return ptrace_has_cap(mm->user_ns, mode); | 281 | return ptrace_has_cap(mm->user_ns, mode); |
| 282 | } | 282 | } |
| @@ -2568,7 +2568,7 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, · 2567 unmodified lines | |||
| 2568 | error = get_dumpable(me->mm); | 2568 | error = get_dumpable(me->mm); |
| 2569 | break; | 2569 | break; |
| 2570 | case PR_SET_DUMPABLE: | 2570 | case PR_SET_DUMPABLE: |
| 2571 | if (arg2 != SUID_DUMP_DISABLE && arg2 != SUID_DUMP_USER) { | 2571 | if (arg2 != TASK_DUMPABLE_OFF && arg2 != TASK_DUMPABLE_OWNER) { |
| 2572 | error = -EINVAL; | 2572 | error = -EINVAL; |
| 2573 | break; | 2573 | break; |
| 2574 | } | 2574 | } |