mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-11 00:04:33 +08:00
9d120b4127
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> |
||
---|---|---|
.. | ||
.gitignore | ||
bpf_obj_id.c | ||
bpf_verif_scale.c | ||
flow_dissector_load_bytes.c | ||
flow_dissector.c | ||
get_stack_raw_tp.c | ||
global_data.c | ||
l4lb_all.c | ||
map_lock.c | ||
obj_name.c | ||
pkt_access.c | ||
pkt_md_access.c | ||
prog_run_xattr.c | ||
queue_stack_map.c | ||
raw_tp_writable_reject_nbd_invalid.c | ||
raw_tp_writable_test_run.c | ||
reference_tracking.c | ||
send_signal.c | ||
signal_pending.c | ||
skb_ctx.c | ||
spinlock.c | ||
stacktrace_build_id_nmi.c | ||
stacktrace_build_id.c | ||
stacktrace_map_raw_tp.c | ||
stacktrace_map.c | ||
task_fd_query_rawtp.c | ||
task_fd_query_tp.c | ||
tcp_estats.c | ||
tp_attach_query.c | ||
xdp_adjust_tail.c | ||
xdp_noinline.c | ||
xdp.c |