public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Richter <robert.richter@amd.com>
To: John Lumby <johnlumby@hotmail.com>
Cc: Maynard Johnson <maynardj@us.ibm.com>,
	oprofile list <oprofile-list@lists.sourceforge.net>,
	Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] oprofile, x86: Fix nmi-unsafe callgraph support in, 2.6.27 and later
Date: Thu, 9 Jun 2011 14:57:42 +0200	[thread overview]
Message-ID: <20110609125742.GP20052@erda.amd.com> (raw)
In-Reply-To: <4DEFB4DC.7030206@hotmail.com>

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


  parent reply	other threads:[~2011-06-09 12:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <COL116-W380DF5357514E3CC28BB66A38F0@phx.gbl>
     [not found] ` <4DD5046F.3000807@us.ibm.com>
     [not found]   ` <4DD53BC8.2010208@hotmail.com>
     [not found]     ` <20110607105259.GE20052@erda.amd.com>
     [not found]       ` <4DEE2F09.6090803@hotmail.com>
2011-06-07 17:18         ` [PATCH] oprofile, x86: Fix nmi-unsafe callgraph support in, 2.6.27 and later Robert Richter
2011-06-07 17:24           ` [RFC] [PATCH] x86: Make copy_from_user_nmi() a library function Robert Richter
2011-06-07 20:46             ` Cyrill Gorcunov
2011-07-05 17:22             ` Robert Richter
2011-07-05 17:40               ` Peter Zijlstra
2011-07-21 19:31             ` [tip:perf/core] x86, perf: " tip-bot for Robert Richter
     [not found]           ` <4DEFB4DC.7030206@hotmail.com>
2011-06-09 12:57             ` Robert Richter [this message]
2011-06-13 13:40 [PATCH] oprofile, x86: Fix nmi-unsafe callgraph support in, 2.6.27 and later John Lumby

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=20110609125742.GP20052@erda.amd.com \
    --to=robert.richter@amd.com \
    --cc=johnlumby@hotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maynardj@us.ibm.com \
    --cc=mingo@elte.hu \
    --cc=oprofile-list@lists.sourceforge.net \
    --cc=peterz@infradead.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