All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
	David Ahern <dsahern@gmail.com>,
	linux-kernel@vger.kernel.org,
	"Steven Rostedt (Red Hat)" <rostedt@goodmis.org>,
	Oleg Nesterov <oleg@redhat.com>, Ingo Molnar <mingo@redhat.com>,
	"David A. Long" <dave.long@linaro.org>,
	yrl.pp-manager.tt@hitachi.com
Subject: Re: [PATCH -tip ] [BUGFIX/URGENT] perf-probe: Do not add offset to uprobe address
Date: Thu, 06 Feb 2014 18:50:49 +0900	[thread overview]
Message-ID: <52F35AF9.4050505@hitachi.com> (raw)
In-Reply-To: <871tzg1y31.fsf@sejong.aot.lge.com>

(2014/02/06 16:48), Namhyung Kim wrote:
> Hi Masami,
> 
> On Wed, 05 Feb 2014 05:18:58 +0000, Masami Hiramatsu wrote:
>> Fix perf-probe not to add offset value to uprobe probe
>> address when post processing.
>> tevs[i].point.address is the address of symbol+offset,
>> but current perf-probe adjusts the point.address by
>> adding the offset. As a result, the probe address becomes
>> symbol+offset+offset. This may cause unexpected
>> code corruption. Urgent fix is needed.
>>
>> Without this fix
>>   ---
>>   # ./perf probe -x ./perf dso__load_vmlinux+4
>>   # ./perf probe -l
>>     probe_perf:dso__load_vmlinux (on 0x000000000006d2b8)
>>   # nm ./perf.orig | grep dso__load_vmlinux\$
>>   000000000046d0a0 T dso__load_vmlinux
> 
> Shouldn't the original symbol address be
> 
>     000000000046d2b0

Oops, Yes, I missed my ./perf and ./perf.orig...
Since the uprobe doesn't track binary change, I usually use a
copy of original binary. Here is the correct test results;


Without this fix
  ---
  # ./perf probe -x ./perf.orig dso__load_vmlinux+4
  # ./perf probe -l
    probe_perf:dso__load_vmlinux (on 0x000000000006d2b8)
  # nm ./perf.orig | grep dso__load_vmlinux\$
  000000000046d2b0 T dso__load_vmlinux
  ---
You can see the given offset is 4 but the actual probed
address is dso__load_vmlinux+8.

With this fix
  ---
  # ./perf probe -x ./perf.orig dso__load_vmlinux+4
  # ./perf probe -l
    probe_perf:dso__load_vmlinux (on 0x000000000006d2b4)
  ---
Now the problem is fixed.


> 
>>   ---
>> You can see the given offset is 3 but the actual probed
> 
> s/3/4/ ?

Yes, it's a typo. :(

Thank you!!



-- 
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com



  reply	other threads:[~2014-02-06  9:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-05  5:18 [PATCH -tip ] [BUGFIX/URGENT] perf-probe: Do not add offset to uprobe address Masami Hiramatsu
2014-02-06  7:48 ` Namhyung Kim
2014-02-06  9:50   ` Masami Hiramatsu [this message]
2014-02-22 17:54 ` [tip:perf/core] perf probe: Do not add offset twice " tip-bot for Masami Hiramatsu

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=52F35AF9.4050505@hitachi.com \
    --to=masami.hiramatsu.pt@hitachi.com \
    --cc=acme@ghostprotocols.net \
    --cc=dave.long@linaro.org \
    --cc=dsahern@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=oleg@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=yrl.pp-manager.tt@hitachi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.