Skip to content

Commit 35ce8ae

Browse files
committed
Merge branch 'signal-for-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
Pull signal/exit/ptrace updates from Eric Biederman: "This set of changes deletes some dead code, makes a lot of cleanups which hopefully make the code easier to follow, and fixes bugs found along the way. The end-game which I have not yet reached yet is for fatal signals that generate coredumps to be short-circuit deliverable from complete_signal, for force_siginfo_to_task not to require changing userspace configured signal delivery state, and for the ptrace stops to always happen in locations where we can guarantee on all architectures that the all of the registers are saved and available on the stack. Removal of profile_task_ext, profile_munmap, and profile_handoff_task are the big successes for dead code removal this round. A bunch of small bug fixes are included, as most of the issues reported were small enough that they would not affect bisection so I simply added the fixes and did not fold the fixes into the changes they were fixing. There was a bug that broke coredumps piped to systemd-coredump. I dropped the change that caused that bug and replaced it entirely with something much more restrained. Unfortunately that required some rebasing. Some successes after this set of changes: There are few enough calls to do_exit to audit in a reasonable amount of time. The lifetime of struct kthread now matches the lifetime of struct task, and the pointer to struct kthread is no longer stored in set_child_tid. The flag SIGNAL_GROUP_COREDUMP is removed. The field group_exit_task is removed. Issues where task->exit_code was examined with signal->group_exit_code should been examined were fixed. There are several loosely related changes included because I am cleaning up and if I don't include them they will probably get lost. The original postings of these changes can be found at: https://lkml.kernel.org/r/[email protected] https://lkml.kernel.org/r/[email protected] https://lkml.kernel.org/r/[email protected] I trimmed back the last set of changes to only the obviously correct once. Simply because there was less time for review than I had hoped" * 'signal-for-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace: (44 commits) ptrace/m68k: Stop open coding ptrace_report_syscall ptrace: Remove unused regs argument from ptrace_report_syscall ptrace: Remove second setting of PT_SEIZED in ptrace_attach taskstats: Cleanup the use of task->exit_code exit: Use the correct exit_code in /proc/<pid>/stat exit: Fix the exit_code for wait_task_zombie exit: Coredumps reach do_group_exit exit: Remove profile_handoff_task exit: Remove profile_task_exit & profile_munmap signal: clean up kernel-doc comments signal: Remove the helper signal_group_exit signal: Rename group_exit_task group_exec_task coredump: Stop setting signal->group_exit_task signal: Remove SIGNAL_GROUP_COREDUMP signal: During coredumps set SIGNAL_GROUP_EXIT in zap_process signal: Make coredump handling explicit in complete_signal signal: Have prepare_signal detect coredumps using signal->core_state signal: Have the oom killer detect coredumps using signal->core_state exit: Move force_uaccess back into do_exit exit: Guarantee make_task_dead leaks the tsk when calling do_task_exit ...
2 parents 6661224 + a403df2 commit 35ce8ae

File tree

86 files changed

+308
-400
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+308
-400
lines changed

arch/alpha/kernel/traps.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ die_if_kernel(char * str, struct pt_regs *regs, long err, unsigned long *r9_15)
190190
local_irq_enable();
191191
while (1);
192192
}
193-
do_exit(SIGSEGV);
193+
make_task_dead(SIGSEGV);
194194
}
195195

196196
#ifndef CONFIG_MATHEMU
@@ -575,7 +575,7 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg,
575575

576576
printk("Bad unaligned kernel access at %016lx: %p %lx %lu\n",
577577
pc, va, opcode, reg);
578-
do_exit(SIGSEGV);
578+
make_task_dead(SIGSEGV);
579579

580580
got_exception:
581581
/* Ok, we caught the exception, but we don't want it. Is there
@@ -630,7 +630,7 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg,
630630
local_irq_enable();
631631
while (1);
632632
}
633-
do_exit(SIGSEGV);
633+
make_task_dead(SIGSEGV);
634634
}
635635

636636
/*

arch/alpha/mm/fault.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
202202
printk(KERN_ALERT "Unable to handle kernel paging request at "
203203
"virtual address %016lx\n", address);
204204
die_if_kernel("Oops", regs, cause, (unsigned long*)regs - 16);
205-
do_exit(SIGKILL);
205+
make_task_dead(SIGKILL);
206206

207207
/* We ran out of memory, or some other thing happened to us that
208208
made us unable to handle the page fault gracefully. */

arch/arm/kernel/traps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ static void oops_end(unsigned long flags, struct pt_regs *regs, int signr)
335335
if (panic_on_oops)
336336
panic("Fatal exception");
337337
if (signr)
338-
do_exit(signr);
338+
make_task_dead(signr);
339339
}
340340

341341
/*

arch/arm/mm/fault.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static void die_kernel_fault(const char *msg, struct mm_struct *mm,
117117
show_pte(KERN_ALERT, mm, addr);
118118
die("Oops", regs, fsr);
119119
bust_spinlocks(0);
120-
do_exit(SIGKILL);
120+
make_task_dead(SIGKILL);
121121
}
122122

123123
/*

arch/arm64/kernel/traps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ void die(const char *str, struct pt_regs *regs, int err)
235235
raw_spin_unlock_irqrestore(&die_lock, flags);
236236

237237
if (ret != NOTIFY_STOP)
238-
do_exit(SIGSEGV);
238+
make_task_dead(SIGSEGV);
239239
}
240240

241241
static void arm64_show_signal(int signo, const char *str)

arch/arm64/mm/fault.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ static void die_kernel_fault(const char *msg, unsigned long addr,
304304
show_pte(addr);
305305
die("Oops", regs, esr);
306306
bust_spinlocks(0);
307-
do_exit(SIGKILL);
307+
make_task_dead(SIGKILL);
308308
}
309309

310310
#ifdef CONFIG_KASAN_HW_TAGS

arch/csky/abiv1/alignment.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ void csky_alignment(struct pt_regs *regs)
294294
__func__, opcode, rz, rx, imm, addr);
295295
show_regs(regs);
296296
bust_spinlocks(0);
297-
do_exit(SIGKILL);
297+
make_task_dead(SIGKILL);
298298
}
299299

300300
force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)addr);

arch/csky/kernel/traps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void die(struct pt_regs *regs, const char *str)
109109
if (panic_on_oops)
110110
panic("Fatal exception");
111111
if (ret != NOTIFY_STOP)
112-
do_exit(SIGSEGV);
112+
make_task_dead(SIGSEGV);
113113
}
114114

115115
void do_trap(struct pt_regs *regs, int signo, int code, unsigned long addr)

arch/csky/mm/fault.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static inline void no_context(struct pt_regs *regs, unsigned long addr)
6767
pr_alert("Unable to handle kernel paging request at virtual "
6868
"addr 0x%08lx, pc: 0x%08lx\n", addr, regs->pc);
6969
die(regs, "Oops");
70-
do_exit(SIGKILL);
70+
make_task_dead(SIGKILL);
7171
}
7272

7373
static inline void mm_fault_error(struct pt_regs *regs, unsigned long addr, vm_fault_t fault)

arch/h8300/kernel/traps.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/types.h>
1818
#include <linux/sched.h>
1919
#include <linux/sched/debug.h>
20+
#include <linux/sched/task.h>
2021
#include <linux/mm_types.h>
2122
#include <linux/kernel.h>
2223
#include <linux/errno.h>
@@ -106,7 +107,7 @@ void die(const char *str, struct pt_regs *fp, unsigned long err)
106107
dump(fp);
107108

108109
spin_unlock_irq(&die_lock);
109-
do_exit(SIGSEGV);
110+
make_task_dead(SIGSEGV);
110111
}
111112

112113
static int kstack_depth_to_print = 24;

0 commit comments

Comments
 (0)