Skip to content

Commit ceca3c1

Browse files
oleg-nesterovcmetcalf-tilera
authored andcommitted
tile: do_hardwall_trap: do not play with task->sighand
1. do_hardwall_trap() checks ->sighand != NULL and then takes ->siglock. This is unsafe even if the task can't run (I assume it is pinned to the same CPU), its parent can reap the task and set ->sighand = NULL right after this check. Even if the compiler dosn't read ->sighand twice and this memory can't to away __group_send_sig_info() is wrong after that. Use do_send_sig_info(). 2. Send SIGILL to the thread, not to the whole process. Unless it has the handler or blocked this kills the whole thread-group as before. IIUC, different threads can be bound to different rect's. 3. Check PF_EXITING instead of ->sighand. A zombie thread can go away but its ->sighand can be !NULL. Reported-by: Matt Fleming <matt@console-pimps.org> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
1 parent dc0b124 commit ceca3c1

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎arch/tile/kernel/hardwall.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,10 @@ void __kprobes do_hardwall_trap(struct pt_regs* regs, int fault_num)
268268
found_processes = 0;
269269
list_for_each_entry(p, &rect->task_head, thread.hardwall_list) {
270270
BUG_ON(p->thread.hardwall != rect);
271-
if (p->sighand) {
271+
if (!(p->flags & PF_EXITING)) {
272272
found_processes = 1;
273273
pr_notice("hardwall: killing %d\n", p->pid);
274-
spin_lock(&p->sighand->siglock);
275-
__group_send_sig_info(info.si_signo, &info, p);
276-
spin_unlock(&p->sighand->siglock);
274+
do_send_sig_info(info.si_signo, &info, p, false);
277275
}
278276
}
279277
if (!found_processes)

0 commit comments

Comments
 (0)