public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@redhat.com>
To: Arjan van de Ven <arjan@infradead.org>
Cc: ananth@in.ibm.com, Jim Keniston <jkenisto@us.ibm.com>,
	        Roland McGrath <roland@redhat.com>,
	prasanna@in.ibm.com,         anil.s.keshavamurthy@intel.com,
	davem@davemloft.net,
	        systemtap-ml <systemtap@sources.redhat.com>
Subject: Re: [RFC -mm][PATCH 5/6] prepare kprobes code for x86 unification
Date: Tue, 11 Dec 2007 16:41:00 -0000	[thread overview]
Message-ID: <475EBD9B.2050504@redhat.com> (raw)
In-Reply-To: <20071211080259.0877708c@laptopd505.fenrus.org>

Hi Arjan,

Thank you for comment.
Arjan van de Ven wrote:
> On Mon, 10 Dec 2007 17:53:22 -0500
> Masami Hiramatsu <mhiramat@redhat.com> wrote:
>> +#define stack_addr(regs) ((unsigned long *)&regs->sp)
> 
> Hi,
> 
> thanks for taking up this work again, however this line has a bug (yes it's a bug in the 32 bit retprobes);
> the address of the stack is regs->sp not &regs->sp, since &regs->sp is the address of the 
> memory we store the stackpointer in, not the actual address on the stack...

As far as I know, it is true on x86-64, but it's not true on x86-32(kernel mode).
I checked it in __show_registers()@arch/x86/kernel/process_32.c.

Here is that code:
>         if (user_mode_vm(regs)) {
>                 sp = regs->sp;
>                 ss = regs->ss & 0xffff;
>                 savesegment(gs, gs);
>         } else {
>                 sp = (unsigned long) (&regs->sp);
>                 savesegment(ss, ss);
>                 savesegment(gs, gs);
>         }

So, in kernel mode, &regs->sp is the address of the top of stack.

Best Regards,

> 
> Greetings,
>   Arjan van de Ven

-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com, masami.hiramatsu.pt@hitachi.com

  reply	other threads:[~2007-12-11 16:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-10 22:53 Masami Hiramatsu
2007-12-11 13:52 ` Srinivasa Ds
2007-12-11 17:57   ` Masami Hiramatsu
2007-12-12 13:38     ` Srinivasa Ds
2007-12-12 17:30       ` Masami Hiramatsu
2007-12-12 21:20         ` Masami Hiramatsu
2007-12-13  1:21           ` Masami Hiramatsu
2007-12-13  7:48             ` Ananth N Mavinakayanahalli
2007-12-13  8:18               ` Srinivasa Ds
2007-12-13  8:23                 ` Ananth N Mavinakayanahalli
2007-12-13 11:21                   ` [RFC -mm][PATCH ] Patch to avoid probing __init functions using kprobes Srinivasa Ds
2007-12-13 15:35                     ` Ananth N Mavinakayanahalli
2007-12-13 18:50                     ` Masami Hiramatsu
2007-12-11 16:06 ` [RFC -mm][PATCH 5/6] prepare kprobes code for x86 unification Arjan van de Ven
2007-12-11 16:41   ` Masami Hiramatsu [this message]
2007-12-11 18:44     ` Jim Keniston

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=475EBD9B.2050504@redhat.com \
    --to=mhiramat@redhat.com \
    --cc=ananth@in.ibm.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=arjan@infradead.org \
    --cc=davem@davemloft.net \
    --cc=jkenisto@us.ibm.com \
    --cc=prasanna@in.ibm.com \
    --cc=roland@redhat.com \
    --cc=systemtap@sources.redhat.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).