mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Andrew Morton <akpm@zip.com.au>,
	kernel list <linux-kernel@vger.kernel.org>
Subject: __init poisoning for i386, too
Date: Thu, 7 Oct 2004 00:18:55 +0200	[thread overview]
Message-ID: <20041006221854.GA1622@elf.ucw.cz> (raw)

Hi!

Overwrite __init section so calls to __init functions from normal code
are catched, reliably. I wonder if this should be configurable... but
it is configurable on x86-64 so I copied it. Please apply,

								Pavel

--- tmp/linux/arch/i386/Kconfig.debug	2004-10-01 00:29:59.000000000 +0200
+++ linux/arch/i386/Kconfig.debug	2004-10-07 00:11:09.000000000 +0200
@@ -15,6 +15,13 @@
 	  with klogd/syslogd or the X server. You should normally N here,
 	  unless you want to debug such a crash.
 
+config INIT_DEBUG
+	bool "Debug __init statements"
+	depends on DEBUG_KERNEL
+	help
+	  Fill __init and __initdata at the end of boot. This helps debugging
+	  illegal uses of __init and __initdata after initialization.
+
 config DEBUG_STACKOVERFLOW
 	bool "Check for stack overflows"
 	depends on DEBUG_KERNEL
--- tmp/linux/arch/i386/mm/init.c	2004-10-01 00:29:59.000000000 +0200
+++ linux/arch/i386/mm/init.c	2004-10-07 00:09:04.000000000 +0200
@@ -705,6 +705,9 @@
 		ClearPageReserved(virt_to_page(addr));
 		set_page_count(virt_to_page(addr), 1);
 		free_page(addr);
+#ifdef CONFIG_INIT_DEBUG
+		memset((void *)(addr & ~(PAGE_SIZE-1)), 0xcc, PAGE_SIZE); 
+#endif
 		totalram_pages++;
 	}
 	printk (KERN_INFO "Freeing unused kernel memory: %dk freed\n", (__init_end - __init_begin) >> 10);

-- 
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!

             reply	other threads:[~2004-10-06 22:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-06 22:18 Pavel Machek [this message]
2004-10-06 22:29 ` Andrew Morton
2004-10-07  8:22   ` Geert Uytterhoeven
2004-10-06 23:56 ` Nigel Cunningham
2004-10-07  8:02   ` Pavel Machek
2004-10-07  6:16 ` William Lee Irwin III
2004-10-07 21:05   ` H. Peter Anvin
2004-10-08 11:08     ` William Lee Irwin III
2004-10-08 11:23       ` Ryan Cumming
     [not found] <20041006221854.GA1622@elf.ucw.cz.suse.lists.linux.kernel>
     [not found] ` <20041007061610.GU9106@holomorphy.com.suse.lists.linux.kernel>
2004-10-07 11:28   ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041006221854.GA1622@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome