From: Mandeep Singh Baines Date: Tue, 5 Feb 2013 22:55:38 +0000 (-0800) Subject: CHROMIUM: sysrq-x: killall chrome process not just first one X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e082d3bf92d2ac86a9c089a8e8db696b6f63edae;p=people%2Faperard%2Flinux-chromebook.git CHROMIUM: sysrq-x: killall chrome process not just first one Currently, sysrq-x just kills the first chrome process it finds. We've seen in at least one occassion where there may be a stale chrome process from a previous session. The fix is to kill all processes we find that meet our criteria. I also modified the printk to print the pid of the process that is killed. Previously we were printing the pid of session_manager which is not as useful. BUG=chrome-os-partner:17522 TEST=manual (debugging feature): hold down alt-volup then x - chrome should crash repeat immediately afterward - session should restart repeat and machine should reboot 2013-02-05T13:28:37.425355-08:00 localhost crash_reporter[2829]: Received crash notification for chrome[963] sig 6 (ignoring - chrome crash) 2013-02-05T13:28:37.557482-08:00 localhost session_manager: [0205/132837:INFO:session_manager_service.cc(523)] Handling child process exit: 963 2013-02-05T13:28:37.557537-08:00 localhost session_manager: [0205/132837:INFO:session_manager_service.cc(525)] Exited with signal 6 Change-Id: Id039df7386cf7cccf42e0861bc2ab6f653147605 Signed-off-by: Mandeep Singh Baines Reviewed-on: https://gerrit.chromium.org/gerrit/42658 Reviewed-by: Sonny Rao Reviewed-by: Sameer Nanda --- diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c index 460998928668b..357a02d4545f3 100644 --- a/drivers/tty/sysrq.c +++ b/drivers/tty/sysrq.c @@ -407,33 +407,18 @@ static void sysrq_x_cros_signal_process(char *comm, char *parent, int sig) read_lock(&tasklist_lock); for_each_process(p) { - if (p->flags & PF_KTHREAD) + if (p->flags & (PF_KTHREAD | PF_EXITING)) continue; if (is_global_init(p)) continue; + if (strncmp(p->comm, comm, TASK_COMM_LEN)) + continue; + if (parent && strncmp(p->parent->comm, parent, TASK_COMM_LEN)) + continue; - if (!strncmp(p->comm, comm, TASK_COMM_LEN)) { - if (!parent) { - printk(KERN_INFO - "%s: signal %d %s pid %u tgid %u\n", - __func__, sig, comm, p->pid, p->tgid); - do_send_sig_info(sig, SEND_SIG_FORCED, p, - true); - break; - } else if (p->parent && - !strncmp(p->parent->comm, parent, - TASK_COMM_LEN)) { - printk(KERN_INFO - "%s: signal %d %s with parent %s " - "pid %u tgid %u\n", - __func__, sig, - comm, parent, p->parent->pid, - p->parent->tgid); - do_send_sig_info(sig, SEND_SIG_FORCED, p, - true); - break; - } - } + printk(KERN_INFO "%s: signal %d %s pid %u tgid %u\n", + __func__, sig, comm, p->pid, p->tgid); + do_send_sig_info(sig, SEND_SIG_FORCED, p, true); } read_unlock(&tasklist_lock); }