lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 6 Sep 2007 12:22:31 +0530 (IST)
From:	Satyam Sharma <satyam@...radead.org>
To:	Ingo Molnar <mingo@...e.hu>
cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [PATCH] sched: Use show_regs() to improve __schedule_bug() output

Hi Ingo,


On Sun, 2 Sep 2007, Ingo Molnar wrote:
> 
> Thanks! Not sure how that bug slipped in, in my tree it does this:
> 
>  +       struct pt_regs *regs;
>  ...
>  +       regs = get_irq_regs();

You're very right indeed -- this bit was absent from -rc4-mm1's
softlockup-improve-debug-output.patch but now that I looked at your
original patch at http://lkml.org/lkml/2007/7/17/180, it becomes
obvious this was simply a mismerge issue after all :-)

[ Andrew, feel free to ignore my patch in case you just resolve
  the mismerge by yourself. ]


BTW would something similar would be useful in __schedule_bug() too?
I sure think so -- I'm not sure if EIP holds anything useful there,
but CPU#, EFLAGS and the init_utsname() stuff would be definitely
helpful ...


[PATCH] sched: Use show_regs() to improve __schedule_bug() output

A full register dump along with stack backtrace would make the "scheduling
while atomic" message more helpful. Use show_regs() instead of dump_stack()
for this. We already know we're atomic in here (that is why this function
was called) so show_regs()'s atomicity expectations are guaranteed.

Also, modify the output of the "BUG: scheduling while atomic:" header a bit
to keep task->comm and task->pid together and preempt_count() after them.

Signed-off-by: Satyam Sharma <satyam@...radead.org>

---

 kernel/sched.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index b533d6d..4fb07c1 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -63,6 +63,7 @@
 #include <linux/unistd.h>
 
 #include <asm/tlb.h>
+#include <asm/irq_regs.h>
 
 /*
  * Scheduler clock - returns current time in nanosec units.
@@ -3404,12 +3405,19 @@ EXPORT_SYMBOL(sub_preempt_count);
  */
 static noinline void __schedule_bug(struct task_struct *prev)
 {
-	printk(KERN_ERR "BUG: scheduling while atomic: %s/0x%08x/%d\n",
-		prev->comm, preempt_count(), prev->pid);
+	struct pt_regs *regs = get_irq_regs();
+
+	printk(KERN_ERR "BUG: scheduling while atomic: %s/%d/0x%08x\n",
+		prev->comm, prev->pid, preempt_count());
+
 	debug_show_held_locks(prev);
 	if (irqs_disabled())
 		print_irqtrace_events(prev);
-	dump_stack();
+
+	if (regs)
+		show_regs(regs);
+	else
+		dump_stack();
 }
 
 /*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ