mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] stacktrace: don't crash on invalid stack trace structs
@ 2008-05-04 12:39 Johannes Berg
  2008-05-05  6:31 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Berg @ 2008-05-04 12:39 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Linux Kernel list

This patch makes the stacktrace printout code warn when the entries
pointer is unset rather than crashing when trying to access it in an
attempt to make it a bit more robust.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
I was saving a stacktrace into an skb and forgot to copy it across skb
copies... Not sure if you want this, I have since fixed the code, but it
would have been easier had the kernel not crashed in an interrupt.

--- everything.orig/kernel/stacktrace.c	2008-05-04 14:02:14.000000000 +0200
+++ everything/kernel/stacktrace.c	2008-05-04 14:02:24.000000000 +0200
@@ -13,6 +13,9 @@ void print_stack_trace(struct stack_trac
 {
 	int i, j;
 
+	if (WARN_ON(!trace->entries))
+		return;
+
 	for (i = 0; i < trace->nr_entries; i++) {
 		unsigned long ip = trace->entries[i];
 



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] stacktrace: don't crash on invalid stack trace structs
  2008-05-04 12:39 [PATCH] stacktrace: don't crash on invalid stack trace structs Johannes Berg
@ 2008-05-05  6:31 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-05-05  6:31 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Ingo Molnar, Linux Kernel list


* Johannes Berg <johannes@sipsolutions.net> wrote:

> This patch makes the stacktrace printout code warn when the entries
> pointer is unset rather than crashing when trying to access it in an
> attempt to make it a bit more robust.
> 
> I was saving a stacktrace into an skb and forgot to copy it across skb 
> copies... Not sure if you want this, I have since fixed the code, but 
> it would have been easier had the kernel not crashed in an interrupt.

applied, thanks Johannes.

I agree that such code needs to be more resilient, and resilience is 
mainly driven by observing random incidents as they happen in the field. 
So please keep sending such patches (even if they might seem dubious to 
you at first sight), they do make a lot of sense - and even if a patch 
does not end up getting applied your submission documents the incident.

	Ingo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-05-05  6:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-04 12:39 [PATCH] stacktrace: don't crash on invalid stack trace structs Johannes Berg
2008-05-05  6:31 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®