public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [patch 2/16] list_head debugging
@ 2002-06-07 14:17 Bernd Jendrissek
  2002-06-07 18:30 ` Andrew Morton
  0 siblings, 1 reply; 10+ messages in thread
From: Bernd Jendrissek @ 2002-06-07 14:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm

[sorry for the nonexistent In-Reply-To/whatever headers - cutting&pasting]

Andrew Morton wrote:
>   A common and very subtle bug is to use list_heads which aren't on any
>   lists. It causes kernel memory corruption which is observed long after
>   the offending code has executed.
>
>   The patch nulls out the dangling pointers so we get a nice oops at the
>   site of the buggy code.

I'm not current with the kernel tree, but will one such oops occur in
netfilter?  See

http://lists.samba.org/pipermail/netfilter-announce/2002/000010.html

Hmm, no.  A DoS maybe?

>   --- 2.5.19/include/linux/list.h~list-debug Sat Jun 1 01:18:05 2002
>   +++ 2.5.19-akpm/include/linux/list.h Sat Jun 1 01:18:05 2002
>   @@ -94,6 +94,11 @@ static __inline__ void __list_del(struct
>    static __inline__ void list_del(struct list_head *entry)
>    {
>            __list_del(entry->prev, entry->next);
>   + /*
>   + * This is debug. Remove it when the kernel has no bugs ;)
>   + */
>   + entry->next = 0;
>   + entry->prev = 0;
>    }
>
>    /**

Bernd Jendrissek

^ permalink raw reply	[flat|nested] 10+ messages in thread
* [patch 2/16] list_head debugging
@ 2002-06-01  8:40 Andrew Morton
  2002-06-01 17:19 ` Arnaldo Carvalho de Melo
  2002-06-03 13:55 ` Jan Harkes
  0 siblings, 2 replies; 10+ messages in thread
From: Andrew Morton @ 2002-06-01  8:40 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: lkml



A common and very subtle bug is to use list_heads which aren't on any
lists.  It causes kernel memory corruption which is observed long after
the offending code has executed.

The patch nulls out the dangling pointers so we get a nice oops at the
site of the buggy code.


=====================================

--- 2.5.19/include/linux/list.h~list-debug	Sat Jun  1 01:18:05 2002
+++ 2.5.19-akpm/include/linux/list.h	Sat Jun  1 01:18:05 2002
@@ -94,6 +94,11 @@ static __inline__ void __list_del(struct
 static __inline__ void list_del(struct list_head *entry)
 {
 	__list_del(entry->prev, entry->next);
+	/*
+	 * This is debug.  Remove it when the kernel has no bugs ;)
+	 */
+	entry->next = 0;
+	entry->prev = 0;
 }
 
 /**

-

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

end of thread, other threads:[~2002-06-14 12:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-07 14:17 [patch 2/16] list_head debugging Bernd Jendrissek
2002-06-07 18:30 ` Andrew Morton
2002-06-14 12:07   ` Jozsef Kadlecsik
  -- strict thread matches above, loose matches on Subject: below --
2002-06-01  8:40 Andrew Morton
2002-06-01 17:19 ` Arnaldo Carvalho de Melo
2002-06-03 13:55 ` Jan Harkes
2002-06-03 20:16   ` Andrew Morton
2002-06-03 20:41   ` Rik van Riel
2002-06-10 16:36     ` Jan Harkes
2002-06-14  9:22       ` Rik van Riel

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