• Masami Hiramatsu's avatar
    perf probe: Do not add offset twice to uprobe address · 981a2379
    Masami Hiramatsu authored
    Fix perf-probe not to add offset value twice to uprobe probe address
    when post processing.
    
    The tevs[i].point.address struct member 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
      ---
    
    You can see the given offset is 3 but the actual probed address is
    dso__load_vmlinux+8.
    
    With this fix:
      ---
      # ./perf probe -x ./perf dso__load_vmlinux+4
      # ./perf probe -l
        probe_perf:dso__load_vmlinux (on 0x000000000006d2b4)
      ---
    
    Now the problem is fixed.
    
    Note: This bug is introduced by
    	commit fb7345bbSigned-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
    Cc: "David A. Long" <dave.long@linaro.org>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: yrl.pp-manager.tt@hitachi.com
    Link: http://lkml.kernel.org/r/20140205051858.6519.27314.stgit@kbuild-fedora.yrl.intra.hitachi.co.jpSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    981a2379
probe-event.c 53.4 KB