trace_uprobe: Display correct offset in uprobe_events
PATCH 1/1 trace_uprobe: Display correct offset in uprobe_events
Recently, how the pointers being printed with %p has been changed by commit ad67b74d2469 ("printk: hash addresses printed with %p"). This is causing a regression while showing offset in the uprobe_events file. Instead of %p, use %px to display offset.
Before patch:
# perf probe -vv -x /tmp/a.out main Opening /sys/kernel/debug/tracing//uprobe_events write=1 Writing event: p:probe_a/main /tmp/a.out:0x58c
# cat /sys/kernel/debug/tracing/uprobe_events p:probe_a/main /tmp/a.out:0x0000000049a0f352
After patch:
# cat /sys/kernel/debug/tracing/uprobe_events p:probe_a/main /tmp/a.out:0x000000000000058c
--- kernel/trace/trace_uprobe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_uprobe.c +1 -1
@@ -608,7 +608,7 @@ static int probes_seq_show(struct seq_file *m, void *v)/* Don't print "0x (null)" when offset is 0 */ if (tu->offset) { -seq_printf (m,"0x%p" , (void *)tu->offset); +seq_printf (m,"0x%px" , (void *)tu->offset); }else {switch (sizeof (void *)) {case 4 :
Signature · 1 line
2.13.6
Quoted 15 lines · Ravi Bangoria
Recently, how the pointers being printed with %p has been changed by commit
ad67b74d2469("printk: hash addresses printed with %p"). This is causing a regression while showing offset in theuprobe_eventsfile. Instead of %p, use %px to display offset.Signed-off-by Ravi Bangoria <[email protected]>--- kernel/trace/trace_uprobe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/trace/trace_uprobe.c +0
-0
kernel/trace/trace_uprobe.c static int probes_seq_show(struct seq_file *m, void *v) · line 614
Quoted 8 lines
kernel/trace/trace_uprobe.c +1
-1@@ -608,7 +608,7 @@ static int probes_seq_show(struct seq_file *m, void *v)/* Don't print "0x (null)" when offset is 0 */ if (tu->offset) { -seq_printf (m,"0x%p" , (void *)tu->offset); +seq_printf (m,"0x%px" , (void *)tu->offset); }else {switch (sizeof (void *)) {case 4 :
Looks good to me. Did you consider %pK instead of %px?
Quoted 18 lines · Srikar Dronamraju
Quoted 16 lines · Ravi Bangoria
Recently, how the pointers being printed with %p has been changed by commit
ad67b74d2469("printk: hash addresses printed with %p"). This is causing a regression while showing offset in theuprobe_eventsfile. Instead of %p, use %px to display offset.Signed-off-by Ravi Bangoria <[email protected]>--- kernel/trace/trace_uprobe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/trace/trace_uprobe.c +0
-0@@ -608,7 +608,7 @@ static int probes_seq_show(struct seq_file *m, void *v)
Quoted 8 lines
kernel/trace/trace_uprobe.c static int probes_seq_show(struct seq_file *m, void *v) · line 614
Quoted 7 lines
kernel/trace/trace_uprobe.c +1
-1/* Don't print "0x (null)" when offset is 0 */ if (tu->offset) { -seq_printf (m,"0x%p" , (void *)tu->offset); +seq_printf (m,"0x%px" , (void *)tu->offset); }else {switch (sizeof (void *)) {case 4 :Looks good to me. Did you consider %pK instead of %px?
Thanks Srikar,
Checked %pK. But I see same issue with that:
perf probe:
Opening /sys/kernel/debug/tracing//uprobe_events write=1 Writing event: p:probe_a/main /tmp/a.out:0x58c
cat /sys/kernel/debug/tracing/uprobe_events:
p:probe_a/main /tmp/a.out:0x0000000014fd571e
Quoted 1 line
Quoted 32 lines · Ravi Bangoria
Quoted 18 lines · Srikar Dronamraju
Quoted 16 lines · Ravi Bangoria
Recently, how the pointers being printed with %p has been changed by commit
ad67b74d2469("printk: hash addresses printed with %p"). This is causing a regression while showing offset in theuprobe_eventsfile. Instead of %p, use %px to display offset.Signed-off-by Ravi Bangoria <[email protected]>--- kernel/trace/trace_uprobe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/trace/trace_uprobe.c +0
-0@@ -608,7 +608,7 @@ static int probes_seq_show(struct seq_file *m, void *v)Quoted 8 lines
kernel/trace/trace_uprobe.c static int probes_seq_show(struct seq_file *m, void *v) · line 614
Quoted 7 lines
kernel/trace/trace_uprobe.c +1
-1/* Don't print "0x (null)" when offset is 0 */ if (tu->offset) { -seq_printf (m,"0x%p" , (void *)tu->offset); +seq_printf (m,"0x%px" , (void *)tu->offset); }else {switch (sizeof (void *)) {case 4 :Looks good to me. Did you consider %pK instead of %px?
Thanks Srikar,
Quoted 8 lines
Checked %pK. But I see same issue with that:
perf probe:
Opening/sys/kernel/debug/tracing//uprobe_eventswrite=1 Writing event: p:probe_a/main /tmp/a.out:0x58ccat
/sys/kernel/debug/tracing/uprobe_events:
p:probe_a/main /tmp/a.out:0x0000000014fd571e
%pK behaves the same as %p (hashes address) when kpt_restrict==0
Hope this helps,
Tobin.
Quoted 39 lines · Tobin C. Harding
Quoted 38 lines · Ravi Bangoria
Quoted 18 lines · Srikar Dronamraju
Quoted 16 lines · Ravi Bangoria
Recently, how the pointers being printed with %p has been changed by commit
ad67b74d2469("printk: hash addresses printed with %p"). This is causing a regression while showing offset in theuprobe_eventsfile. Instead of %p, use %px to display offset.Signed-off-by Ravi Bangoria <[email protected]>--- kernel/trace/trace_uprobe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/trace/trace_uprobe.c +0
-0@@ -608,7 +608,7 @@ static int probes_seq_show(struct seq_file *m, void *v)Quoted 8 lines
kernel/trace/trace_uprobe.c static int probes_seq_show(struct seq_file *m, void *v) · line 614
Quoted 7 lines
kernel/trace/trace_uprobe.c +1
-1/* Don't print "0x (null)" when offset is 0 */ if (tu->offset) { -seq_printf (m,"0x%p" , (void *)tu->offset); +seq_printf (m,"0x%px" , (void *)tu->offset); }else {switch (sizeof (void *)) {case 4 :Looks good to me. Did you consider %pK instead of %px?
Thanks Srikar,
Checked %pK. But I see same issue with that:
perf probe:
Opening/sys/kernel/debug/tracing//uprobe_eventswrite=1 Writing event: p:probe_a/main /tmp/a.out:0x58c
Quoted 6 lines
Quoted 2 lines
cat
/sys/kernel/debug/tracing/uprobe_events:
p:probe_a/main /tmp/a.out:0x0000000014fd571e%pK behaves the same as %p (hashes address) when kpt_restrict==0
Hope this helps,
Thanks Tobin for the clarification. So %px is the right choice.
Signature · 2 lines
thanks and regards Srikar
Steven Rostedt
maintainerQuoted 11 lines · On Sat, 6 Jan 2018 11:12:46 +0530 Ravi Bangoria…
Recently, how the pointers being printed with %p has been changed by commit
ad67b74d2469("printk: hash addresses printed with %p"). This is causing a regression while showing offset in theuprobe_eventsfile. Instead of %p, use %px to display offset.Before patch:
# perf probe -vv -x /tmp/a.out main Opening /sys/kernel/debug/tracing//uprobe_events write=1 Writing event: p:probe_a/main /tmp/a.out:0x58c
Quoted 8 lines
# cat /sys/kernel/debug/tracing/uprobe_events p:probe_a/main /tmp/a.out:0x0000000049a0f352After patch:
# cat /sys/kernel/debug/tracing/uprobe_events p:probe_a/main /tmp/a.out:0x000000000000058c
Thanks, I'll pull this into my tree.
-- Steve