linux/tools/testing/selftests/bpf/prog_tests
Jiong Wang 9d120b4127 selftests: bpf: enable hi32 randomization for all tests
The previous libbpf patch allows user to specify "prog_flags" to bpf
program load APIs. To enable high 32-bit randomization for a test, we need
to set BPF_F_TEST_RND_HI32 in "prog_flags".

To enable such randomization for all tests, we need to make sure all places
are passing BPF_F_TEST_RND_HI32. Changing them one by one is not
convenient, also, it would be better if a test could be switched to
"normal" running mode without code change.

Given the program load APIs used across bpf selftests are mostly:
  bpf_prog_load:      load from file
  bpf_load_program:   load from raw insns

A test_stub.c is implemented for bpf seltests, it offers two functions for
testing purpose:

  bpf_prog_test_load
  bpf_test_load_program

The are the same as "bpf_prog_load" and "bpf_load_program", except they
also set BPF_F_TEST_RND_HI32. Given *_xattr functions are the APIs to
customize any "prog_flags", it makes little sense to put these two
functions into libbpf.

Then, the following CFLAGS are passed to compilations for host programs:
  -Dbpf_prog_load=bpf_prog_test_load
  -Dbpf_load_program=bpf_test_load_program

They migrate the used load APIs to the test version, hence enable high
32-bit randomization for these tests without changing source code.

Besides all these, there are several testcases are using
"bpf_prog_load_attr" directly, their call sites are updated to pass
BPF_F_TEST_RND_HI32.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2019-05-24 18:58:37 -07:00
..
.gitignore
bpf_obj_id.c selftests: bpf: fix -Wformat-invalid-specifier for bpf_obj_id.c 2019-04-02 23:17:18 +02:00
bpf_verif_scale.c selftests: bpf: enable hi32 randomization for all tests 2019-05-24 18:58:37 -07:00
flow_dissector_load_bytes.c selftests/bpf: add flow dissector bpf_skb_load_bytes helper test 2019-04-23 18:36:34 +02:00
flow_dissector.c selftests/bpf: add prog detach to flow_dissector test 2019-05-16 01:33:33 +02:00
get_stack_raw_tp.c samples, selftests/bpf: add NULL check for ksym_search 2019-04-04 16:43:47 +02:00
global_data.c bpf, selftest: test global data/bss/rodata sections 2019-04-09 17:05:47 -07:00
l4lb_all.c selftests: bpf: break up test_progs - misc 2019-03-02 11:10:40 -08:00
map_lock.c selftests/bpf: fix segfault of test_progs when prog loading failed 2019-03-12 21:55:54 +01:00
obj_name.c selftests: bpf: break up test_progs - misc 2019-03-02 11:10:40 -08:00
pkt_access.c selftests: bpf: break up test_progs - pkt access 2019-03-02 11:10:40 -08:00
pkt_md_access.c selftests: bpf: break up test_progs - pkt access 2019-03-02 11:10:40 -08:00
prog_run_xattr.c selftests: bpf: break up test_progs - misc 2019-03-02 11:10:40 -08:00
queue_stack_map.c selftests: bpf: break up test_progs - misc 2019-03-02 11:10:40 -08:00
raw_tp_writable_reject_nbd_invalid.c selftests: bpf: test writable buffers in raw tps 2019-04-26 19:04:19 -07:00
raw_tp_writable_test_run.c selftests: bpf: test writable buffers in raw tps 2019-04-26 19:04:19 -07:00
reference_tracking.c selftests: bpf: break up test_progs - misc 2019-03-02 11:10:40 -08:00
send_signal.c tools/bpf: add selftest in test_progs for bpf_send_signal() helper 2019-05-24 23:26:48 +02:00
signal_pending.c selftests: bpf: test_progs: initialize duration in singal_pending test 2019-03-07 10:46:25 +01:00
skb_ctx.c selftests: bpf: add selftest for __sk_buff context in BPF_PROG_TEST_RUN 2019-04-11 10:21:41 +02:00
spinlock.c selftests/bpf: fix segfault of test_progs when prog loading failed 2019-03-12 21:55:54 +01:00
stacktrace_build_id_nmi.c selftests: bpf: don't depend on hardcoded perf sample_freq 2019-03-26 12:47:41 -07:00
stacktrace_build_id.c selftests: bpf: break up test_progs - stackmap 2019-03-02 11:10:40 -08:00
stacktrace_map_raw_tp.c selftests: bpf: break up test_progs - stackmap 2019-03-02 11:10:40 -08:00
stacktrace_map.c selftests: bpf: break up test_progs - stackmap 2019-03-02 11:10:40 -08:00
task_fd_query_rawtp.c selftests: bpf: break up test_progs - tracepoint 2019-03-02 11:10:40 -08:00
task_fd_query_tp.c selftests: bpf: initialize bpf_object pointers where needed 2019-05-09 15:53:56 -07:00
tcp_estats.c selftests: bpf: break up test_progs - misc 2019-03-02 11:10:40 -08:00
tp_attach_query.c selftests: bpf: initialize bpf_object pointers where needed 2019-05-09 15:53:56 -07:00
xdp_adjust_tail.c selftests: bpf: break up test_progs - xdp 2019-03-02 11:10:40 -08:00
xdp_noinline.c selftests: bpf: break up test_progs - xdp 2019-03-02 11:10:40 -08:00
xdp.c selftests: bpf: break up test_progs - xdp 2019-03-02 11:10:40 -08:00