Skip to content

Commit

Permalink
selftests/ftrace: Make uprobe test more robust against binary name
Browse files Browse the repository at this point in the history
Make add_remove_uprobe test case more robust against various real
binary name.
Current add_remove_uprobe.tc test expects the real binary of /bin/sh
is '*/bin/*sh', but it does not work on busybox environment.
Instead of using fixed pattern, use readlink to identify real binary
name.

Link: https://lore.kernel.org/r/173625187633.1383744.2840679071525852811.stgit@devnote2
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
  • Loading branch information
Masami Hiramatsu (Google) authored and Shuah Khan committed Jan 15, 2025
1 parent 159ca65 commit 89ae643
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
echo 0 > events/enable
echo > dynamic_events

REALBIN=`readlink -f /bin/sh`

echo 'cat /proc/$$/maps' | /bin/sh | \
grep "r-xp .*/bin/.*sh$" | \
grep "r-xp .*${REALBIN}$" | \
awk '{printf "p:myevent %s:0x%s\n", $6,$3 }' >> uprobe_events

grep -q myevent uprobe_events
Expand Down

0 comments on commit 89ae643

Please sign in to comment.