Thread (8 messages) 8 messages, 2 authors, 2023-01-28

Re: [PATCH] selftests/ftrace: Extend multiple_kprobes.tc to add multiple consecutive probes in a function

From: Naveen N. Rao <hidden>
Date: 2023-01-12 13:21:32
Also in: linux-kselftest, lkml

Akanksha J N wrote:
Commit 97f88a3d723162 ("powerpc/kprobes: Fix null pointer reference in
arch_prepare_kprobe()") fixed a recent kernel oops that was caused as
ftrace-based kprobe does not generate kprobe::ainsn::insn and it gets
set to NULL.
Extend multiple kprobes test to add kprobes on first 256 bytes within a
function, to be able to test potential issues with kprobes on
successive instructions.
The '|| true' is added with the echo statement to ignore errors that are
caused by trying to add kprobes to non probeable lines and continue with
the test.

Signed-off-by: Akanksha J N <redacted>
---
 .../selftests/ftrace/test.d/kprobe/multiple_kprobes.tc        | 4 ++++
 1 file changed, 4 insertions(+)
Thanks for adding this test!
quoted hunk
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
index be754f5bcf79..f005c2542baa 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
@@ -25,6 +25,10 @@ if [ $L -ne 256 ]; then
   exit_fail
 fi

+for i in `seq 0 255`; do
+  echo p $FUNCTION_FORK+${i} >> kprobe_events || true
+done
+
 cat kprobe_events >> $testlog

 echo 1 > events/kprobes/enable
Thinking about this more, I wonder if we should add an explicit fork 
after enabling the events, similar to kprobe_args.tc:
	( echo "forked" )

That will ensure we hit all the probes we added. With that change:
Acked-by: Naveen N. Rao <redacted>


- Naveen
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help