From 54090e39192e289e689c841b079d288319e56e5f Mon Sep 17 00:00:00 2001 From: Tianchen Ding Date: Thu, 7 Dec 2023 13:32:27 +0800 Subject: [PATCH] tests: runtime: fix kprobe_offset_module* on aarch64 For kprobe_offset_module: On aarch64, +0x5 is not a correct offset. Since +0x4 is reserved by ftrace, the test should use +0x8, which is the same as ppc64. For kprobe_offset_module_error: nft_trans_alloc_gfp is not in vmlinux so usermode offset check is skipped. The kernel will return -EINVAL instead of -EILSEQ during arch_prepare_kprobe() on aarch64, so change the expected string. Signed-off-by: Tianchen Ding --- tests/runtime/probe | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/runtime/probe b/tests/runtime/probe index 599a24dc..d33c6e47 100644 --- a/tests/runtime/probe +++ b/tests/runtime/probe @@ -153,18 +153,18 @@ NAME kprobe_offset_module RUN {{BPFTRACE}} -e 'kprobe:nft_trans_alloc_gfp+0x5 { printf("hit\n"); exit(); }' AFTER /usr/sbin/nft add table bpftrace EXPECT hit -ARCH x86_64|aarch64 +ARCH x86_64 TIMEOUT 5 REQUIRES lsmod | grep '^nf_tables' REQUIRES /usr/sbin/nft --help CLEANUP /usr/sbin/nft delete table bpftrace -# Local entry point to nft_trans_alloc_gfp is located at offset of 8 bytes in ppc64. +# Local entry point to nft_trans_alloc_gfp is located at offset of 8 bytes in ppc64 and aarch64. NAME kprobe_offset_module RUN {{BPFTRACE}} -e 'kprobe:nft_trans_alloc_gfp+0x8 { printf("hit\n"); exit(); }' AFTER /usr/sbin/nft add table bpftrace EXPECT hit -ARCH ppc64|ppc64le +ARCH ppc64|ppc64le|aarch64 TIMEOUT 5 REQUIRES lsmod | grep '^nf_tables' REQUIRES /usr/sbin/nft --help @@ -173,6 +173,15 @@ CLEANUP /usr/sbin/nft delete table bpftrace NAME kprobe_offset_module_error RUN {{BPFTRACE}} -e 'kprobe:nft_trans_alloc_gfp+0x1 { printf("hit\n"); exit(); }' EXPECT Possible attachment attempt in the middle of an instruction, try a different offset. +ARCH x86_64 +TIMEOUT 5 +REQUIRES lsmod | grep '^nf_tables' +WILL_FAIL + +NAME kprobe_offset_module_error +RUN {{BPFTRACE}} -e 'kprobe:nft_trans_alloc_gfp+0x1 { printf("hit\n"); exit(); }' +EXPECT Invalid argument +ARCH aarch64 TIMEOUT 5 REQUIRES lsmod | grep '^nf_tables' WILL_FAIL