]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests/bpf: make test_align selftest more robust
authorAndrii Nakryiko <andrii@kernel.org>
Fri, 4 Aug 2023 15:24:57 +0000 (23:24 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Aug 2023 16:21:58 +0000 (18:21 +0200)
commitee701208f4ccb1f083ce3db3ab4e9e7c3ae57dad
treee8b288f4a687bb2820e8036c6062df977e1f4e97
parent683d2969a0820072ddc05dbcc667664f7a34ac90
selftests/bpf: make test_align selftest more robust

[ Upstream commit 4f999b767769b76378c3616c624afd6f4bb0d99f ]

test_align selftest relies on BPF verifier log emitting register states
for specific instructions in expected format. Unfortunately, BPF
verifier precision backtracking log interferes with such expectations.
And instruction on which precision propagation happens sometimes don't
output full expected register states. This does indeed look like
something to be improved in BPF verifier, but is beyond the scope of
this patch set.

So to make test_align a bit more robust, inject few dummy R4 = R5
instructions which capture desired state of R5 and won't have precision
tracking logs on them. This fixes tests until we can improve BPF
verifier output in the presence of precision tracking.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20221104163649.121784-7-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Stable-dep-of: ecdf985d7615 ("bpf: track immediate values written to stack by BPF_ST instruction")
Signed-off-by: Pu Lehui <pulehui@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/testing/selftests/bpf/prog_tests/align.c