OSDN Git Service

selftests/bpf: Test ldsx with more complex cases
authorYonghong Song <yonghong.song@linux.dev>
Fri, 28 Jul 2023 01:13:36 +0000 (18:13 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 28 Jul 2023 01:54:17 +0000 (18:54 -0700)
commit0c606571ae07568b18c112d011dc8cd01d6ae346
treed10903f27bb17e8d0dab34f0e300304f7696f328
parent613dad498072f20d9bfd996422f0fd8e9a2f6c0d
selftests/bpf: Test ldsx with more complex cases

The following ldsx cases are tested:
  - signed readonly map value
  - read/write map value
  - probed memory
  - not-narrowed ctx field access
  - narrowed ctx field access.

Without previous proper verifier/git handling, the test will fail.

If cpuv4 is not supported either by compiler or by jit,
the test will be skipped.

  # ./test_progs -t ldsx_insn
  #113/1   ldsx_insn/map_val and probed_memory:SKIP
  #113/2   ldsx_insn/ctx_member_sign_ext:SKIP
  #113/3   ldsx_insn/ctx_member_narrow_sign_ext:SKIP
  #113     ldsx_insn:SKIP
  Summary: 1/0 PASSED, 3 SKIPPED, 0 FAILED

Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20230728011336.3723434-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
tools/testing/selftests/bpf/prog_tests/test_ldsx_insn.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/test_ldsx_insn.c [new file with mode: 0644]