path: root/kernel
diff options
authorJann Horn <>2016-06-01 11:55:07 +0200
committerLinus Torvalds <>2016-06-10 12:09:43 -0700
commit29d6455178a09e1dc340380c582b13356227e8df (patch)
tree7bdb5e5a818ab442e8b68213bb9d589fdf7cadf7 /kernel
parent2f36db71009304b3f0b95afacd8eba1f9f046b87 (diff)
sched: panic on corrupted stack end
Until now, hitting this BUG_ON caused a recursive oops (because oops handling involves do_exit(), which calls into the scheduler, which in turn raises an oops), which caused stuff below the stack to be overwritten until a panic happened (e.g. via an oops in interrupt context, caused by the overwritten CPU index in the thread_info). Just panic directly. Signed-off-by: Jann Horn <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'kernel')
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d1f7149f8704..11546a6ed5df 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3047,7 +3047,8 @@ static noinline void __schedule_bug(struct task_struct *prev)
static inline void schedule_debug(struct task_struct *prev)
- BUG_ON(task_stack_end_corrupted(prev));
+ if (task_stack_end_corrupted(prev))
+ panic("corrupted stack end detected inside scheduler\n");
if (unlikely(in_atomic_preempt_off())) {