Re: [PATCH] oprofile, x86: Fix nmi-unsafe callgraph support in,2.6.27 and later

From: Robert Richter
Date: Thu Jun 09 2011 - 08:58:22 EST


On 08.06.11 13:43:56, John Lumby wrote:
> I am also a bit confused by the kernel's statement that it's a NULL
> pointer deref. I had previously found that the pointer contains
> 0x0000000a, not NULL. Does the kernel call it NULL for any invalid
> value? Or am I misunderstanding it. Anyway ...

0x0000000a is also considered a NULL pointer access, typically this
happens if a member of a struct which points to NULL is accessed.

>
> Have you or anyone tried this on an intel x86? I'm just curious
> whether it's everyone or only me.

>From your other mail:

"EIP is at print_context_stack=0x45/0xb0

and from a machine-code listing, I found that that offset corresponds
to the line

addr = *stack;

in arch/x86/kernel/dumpstack.c"

Actually this should not happen, because of checking the stack pointer
in valid_stack_ptr(). So could you apply the change below and test if
this throws a bug message?

Thanks,

-Robert


diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index e2a3f06..37693f5 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -73,6 +73,8 @@ static inline int valid_stack_ptr(struct thread_info *tinfo,
void *p, unsigned int size, void *end)
{
void *t = tinfo;
+
+ BUG_ON(p < (void *)THREAD_SIZE);
if (end) {
if (p < end && p >= (end-THREAD_SIZE))
return 1;


--
Advanced Micro Devices, Inc.
Operating System Research Center

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/