lkml.org 
[lkml]   [2014]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -tip ] [BUGFIX/URGENT] perf-probe: Do not add offset to uprobe address
(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




\
 
 \ /
  Last update: 2014-02-06 11:41    [W:0.049 / U:0.612 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site