OSDN Git Service

bpf, selftests: Add test for BPF_STX BPF_B storing R10
authorLuke Nelson <lukenels@cs.washington.edu>
Sat, 18 Apr 2020 23:26:54 +0000 (16:26 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 21 Apr 2020 02:25:30 +0000 (19:25 -0700)
commitd2b6c3ab70dbc0069a69c57edd8c96f365f06b7c
treef8f4cf01b82216e46db29d51c0d0d86d23a5f34c
parentaee194b14dd2b2bde6252b3acf57d36dccfc743a
bpf, selftests: Add test for BPF_STX BPF_B storing R10

This patch adds a test to test_verifier that writes the lower 8 bits of
R10 (aka FP) using BPF_B to an array map and reads the result back. The
expected behavior is that the result should be the same as first copying
R10 to R9, and then storing / loading the lower 8 bits of R9.

This test catches a bug that was present in the x86-64 JIT that caused
an incorrect encoding for BPF_STX BPF_B when the source operand is R10.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Luke Nelson <luke.r.nels@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200418232655.23870-2-luke.r.nels@gmail.com
tools/testing/selftests/bpf/verifier/stack_ptr.c