From fa2755e20ab0c7215d99c2dc7c262e98a09b01df Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Wed, 26 May 2010 14:44:08 -0700 Subject: [PATCH] INIT_TASK() should initialize ->thread_group list The trivial /sbin/init doing int main(void) { kill(0, SIGKILL) } crashes the kernel. This happens because __kill_pgrp_info(init_struct_pid) also sends SIGKILL to the swapper process which runs with the uninitialized ->thread_group. Change INIT_TASK() to initialize ->thread_group properly. Note: the real problem is that the swapper process must not be visible to signals, see the next patch. But this change is right anyway and fixes the crash. Reported-and-tested-by: Mathias Krause Signed-off-by: Oleg Nesterov Cc: Cedric Le Goater Cc: Dave Hansen Cc: Eric Biederman Cc: Herbert Poetzl Cc: Mathias Krause Acked-by: Roland McGrath Acked-by: Serge Hallyn Acked-by: Sukadev Bhattiprolu Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/init_task.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 0551e0dcb71..6deb1ba52fd 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h @@ -163,6 +163,7 @@ extern struct cred init_cred; [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \ [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \ }, \ + .thread_group = LIST_HEAD_INIT(tsk.thread_group), \ .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \ INIT_IDS \ INIT_PERF_EVENTS(tsk) \ -- 2.39.2