selftests/bpf: fix timer/test_bad_ret subtest on test_progs-cpuv4 flavor
Subsystems (3)
Andrii Nakryiko
maintainerPATCH 1/1 selftests/bpf: fix timer/test_bad_ret subtest on test_progs-cpuv4 flavor
Because test_bad_ret main program is not written in assembly, we don't control instruction indices in timer_cb_ret_bad() subprog. This bites us in timer/test_bad_ret subtest, where we see difference between cpuv4 and other flavors.
For now, make __msg() expectations not rely on instruction indices by anchoring them around bpf_get_prandom_u32 call. Once we have regex/glob support for __msg(), this can be expressed a bit more nicely, but for now just mitigating the problem with available means.
--- tools/testing/selftests/bpf/progs/timer_failure.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/progs/timer_failure.c +3 -2
@@ -47,9 +47,10 @@ __log_level(2)__flag (BPF_F_TEST_STATE_FREQ) __failure /* check that fallthrough code path marks r0 as precise */ -__msg ("mark_precise: frame0: regs=r0 stack= before 22: (b7) r0 = 0" ) +__msg("mark_precise: frame0: regs=r0 stack= before") +__msg (": (85) call bpf_get_prandom_u32#7" )/* anchor message */ /* check that branch code path marks r0 as precise */ -__msg("mark_precise: frame0: regs=r0 stack= before 24: (85) call bpf_get_prandom_u32#7") +__msg("mark_precise: frame0: regs=r0 stack= before ") __msg(": (85) call bpf_get_prandom_u32#7") __msg("should have been in [0, 0]")long BPF_PROG2 (test_bad_ret ,int ,a ) {
Signature · 1 line
2.34.1
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Quoted 11 lines · On Fri, 8 Dec 2023 15:30:28 -0800 you wrote:
Because
test_bad_retmain program is not written in assembly, we don't control instruction indices intimer_cb_ret_bad()subprog. This bites us in timer/test_bad_ret subtest, where we see difference between cpuv4 and other flavors.For now, make
__msg()expectations not rely on instruction indices by anchoring them aroundbpf_get_prandom_u32call. Once we have regex/glob support for__msg(), this can be expressed a bit more nicely, but for now just mitigating the problem with available means.[...]
Here is the summary with links:
- [bpf-next] selftests/bpf: fix timer/test_bad_ret subtest on test_progs-cpuv4 flavor
https://git.kernel.org/bpf/bpf-next/c/1720c42b90c8
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html