kmemcheck: dump shadow memory on errors
PATCH 1/1 kmemcheck: dump shadow memory on errors
Hi,
Check this out. Cool or what? :-)
(The only thing I'm slightly concerned about is the correctness of the copying -- we're rounding down to nearest SHADOW_COPY_SIZE and copying upwards to the nearest SHADOW_COPY_SIZE. So as long as SHADOW_COPY_SHIFT is less than PAGE_SHIFT, there should be no way we'll be able to cross a page boundary during the shadow copy. Does this sound right?)
Vegard
Quoted 1 line
From
f2cb6108e86d0c2dc73a1f89eb4f3ad843eeeb9bMon Sep 17 00:00:00 2001
From: Vegard Nossum <[email protected]>
Date: Fri, 9 May 2008 18:09:56 +0200
Subject: [PATCH] kmemcheck: dump shadow memory on errors
This patch will save a (small) snapshot of the shadow memory surrounding the target of an invalid access and displays it when the report is printed. This in order to aid the debugging of errors.
A report now typically looks something like this:
kmemcheck: Caught 32-bit read from uninitialized memory (c7809f14) iiiiiiiiiiiiiiiiiiiiuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
^
Pid: 1, comm: swapper Not tainted (2.6.26-rc1-00012-g0364f4e-dirty #42)
EIP: 0060:[<c04032b1>] EFLAGS: 00000282 CPU: 0
EIP is at pskb_expand_head+0x91/0x150
EAX: 00000044 EBX: c7852140 ECX: 00000036 EDX: c78be000
ESI: c7809f14 EDI: c78be094 EBP: c783bed0 ESP: c06c9dc8
DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
CR0: 8005003b CR2: c74006e4 CR3: 006ba000 CR4: 00000680
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: 00004000 DR7: 00000000
[<c01190f1>] kmemcheck_read+0xd1/0x160 [<c01192de>] kmemcheck_access+0x15e/0x1a0 [<c04bd2d6>] do_page_fault+0x5e6/0x690 [<c04bb32a>] error_code+0x72/0x78 [<c0417f46>] netlink_broadcast+0x66/0x370 [<c041abba>] genl_ctrl_event+0x2fa/0x310 [<c041b037>] genl_register_mc_group+0xe7/0x130 [<c0698cf3>] genl_init+0x93/0xd0 [<c06735c7>] kernel_init+0x127/0x290 [<c0104cc7>] kernel_thread_helper+0x7/0x10 [<ffffffff>] 0xffffffff
--- arch/x86/Kconfig.debug | 11 +++++++++++ arch/x86/kernel/kmemcheck.c | 43 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 50 insertions(+), 4 deletions(-)
arch/x86/Kconfig.debug +11 -0
@@ -298,6 +298,17 @@ config KMEMCHECK_QUEUE_SIZE if the number of errors occuring between two bursts is larger than this number, the extra error reports will get lost. +config KMEMCHECK_SHADOW_COPY_SHIFT + int "kmemcheck: shadow copy size (5 => 32 bytes, 6 => 64 bytes)" + depends on KMEMCHECK + range 2 8 + default 6 + help + Select the number of shadow bytes to save along with each entry of + the queue. These bytes indicate what parts of an allocation are + initialized, uninitialized, etc. and will be displayed when an + error is detected to help the debugging of a particular problem. + config KMEMCHECK_PARTIAL_OK bool "kmemcheck: allow partially uninitialized memory" depends on KMEMCHECK
arch/x86/kernel/kmemcheck.c +39 -4
97 lines not on this page · raw message
Signature · 1 line
1.5.4.1