From 49ba178cfe9cac97498bf83c25d34317cf207afb Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@elte.hu>
Date: Sun, 8 Sep 2002 06:04:56 -0700
Subject: [PATCH] [PATCH] Re: pinpointed: PANIC caused by dequeue_signal() in
 current Linus

This fixes the bootup crash.  There were two initialization bugs:

	- INIT_SIGNAL needs to set shared_pending.

	- exec() needs to set up newsig properly.

the second one caused the crash Anton saw.
---
 arch/i386/kernel/init_task.c | 2 +-
 fs/exec.c                    | 2 ++
 include/linux/init_task.h    | 5 +++--
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/i386/kernel/init_task.c b/arch/i386/kernel/init_task.c
index f652f279b787..4eb40a9582c7 100644
--- a/arch/i386/kernel/init_task.c
+++ b/arch/i386/kernel/init_task.c
@@ -10,7 +10,7 @@
 
 static struct fs_struct init_fs = INIT_FS;
 static struct files_struct init_files = INIT_FILES;
-static struct signal_struct init_signals = INIT_SIGNALS;
+static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 struct mm_struct init_mm = INIT_MM(init_mm);
 
 /*
diff --git a/fs/exec.c b/fs/exec.c
index 9c00b733fcee..9344e1ec3894 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -514,6 +514,8 @@ static inline int make_private_signals(void)
 	spin_lock_init(&newsig->siglock);
 	atomic_set(&newsig->count, 1);
 	memcpy(newsig->action, current->sig->action, sizeof(newsig->action));
+	init_sigpending(&newsig->shared_pending);
+
 	spin_lock_irq(&current->sigmask_lock);
 	current->sig = newsig;
 	spin_unlock_irq(&current->sigmask_lock);
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 80a57914bccc..bdf03241a009 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -29,10 +29,11 @@
 	.mmlist		= LIST_HEAD_INIT(name.mmlist),	\
 }
 
-#define INIT_SIGNALS {	\
+#define INIT_SIGNALS(sig) {	\
 	.count		= ATOMIC_INIT(1), 		\
 	.action		= { {{0,}}, }, 			\
-	.siglock	= SPIN_LOCK_UNLOCKED 		\
+	.siglock	= SPIN_LOCK_UNLOCKED, 		\
+	.shared_pending	= { NULL, &sig.shared_pending.head, {{0}}}, \
 }
 
 /*
-- 
2.30.9