[SRU Eoan] UBUNTU: SAUCE: kselftest: ftrace: check for existing probe

Thadeu Lima de Souza Cascardo cascardo at canonical.com
Fri May 29 22:12:38 UTC 2020


Buglink: https://bugs.launchpad.net/bugs/1866972

When testing multiple_kprobes.tc, it will try to add repeated probes. On
5.4, it will return EEXIST, and the test will keep adding probes until it
gets to 256 probes. On 5.3, it will return success, but not add a new
probe. The test will then fail expecting 256 probes, but less than that
were really added.

Fixing the test to check for those existing probes before adding them is
less prone to regressions. After that, the test will succeed, as it skips
trying to add existing probes.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo at canonical.com>
---
 tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc | 1 +
 1 file changed, 1 insertion(+)

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 6e3dbe5f96b7..4b860bfc64be 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
@@ -16,6 +16,7 @@ N=0
 echo "Setup up kprobes on first available 256 text symbols"
 grep -i " t " /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \
 while read i; do
+  grep -qw ${i} kprobe_events && continue
   echo p ${i}+${OFFS} >> kprobe_events && N=$((N+1)) ||:
   test $N -eq 256 && break
 done
-- 
2.25.1




More information about the kernel-team mailing list