Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: Remove fmod_ret from test_overhead

The test_overhead prog_test included an fmod_ret program that attached to
__set_task_comm() in the kernel. However, this function was never listed as
allowed for return modification, so this only worked because of the
verifier skipping tests when a trampoline already existed for the attach
point. Now that the verifier checks have been fixed, remove fmod_ret from
the test so it works again.

Fixes: 4eaf0b5c5e04 ("selftest/bpf: Fmod_ret prog and implement test_overhead as part of bench")
Acked-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Toke Høiland-Jørgensen and committed by
Alexei Starovoitov
b000def2 f7b12b6f

+1 -39
-3
tools/testing/selftests/bpf/bench.c
··· 311 311 extern const struct bench bench_rename_rawtp; 312 312 extern const struct bench bench_rename_fentry; 313 313 extern const struct bench bench_rename_fexit; 314 - extern const struct bench bench_rename_fmodret; 315 314 extern const struct bench bench_trig_base; 316 315 extern const struct bench bench_trig_tp; 317 316 extern const struct bench bench_trig_rawtp; ··· 332 333 &bench_rename_rawtp, 333 334 &bench_rename_fentry, 334 335 &bench_rename_fexit, 335 - &bench_rename_fmodret, 336 336 &bench_trig_base, 337 337 &bench_trig_tp, 338 338 &bench_trig_rawtp, ··· 462 464 463 465 return 0; 464 466 } 465 -
-17
tools/testing/selftests/bpf/benchs/bench_rename.c
··· 106 106 attach_bpf(ctx.skel->progs.prog5); 107 107 } 108 108 109 - static void setup_fmodret() 110 - { 111 - setup_ctx(); 112 - attach_bpf(ctx.skel->progs.prog6); 113 - } 114 - 115 109 static void *consumer(void *input) 116 110 { 117 111 return NULL; ··· 170 176 .name = "rename-fexit", 171 177 .validate = validate, 172 178 .setup = setup_fexit, 173 - .producer_thread = producer, 174 - .consumer_thread = consumer, 175 - .measure = measure, 176 - .report_progress = hits_drops_report_progress, 177 - .report_final = hits_drops_report_final, 178 - }; 179 - 180 - const struct bench bench_rename_fmodret = { 181 - .name = "rename-fmodret", 182 - .validate = validate, 183 - .setup = setup_fmodret, 184 179 .producer_thread = producer, 185 180 .consumer_thread = consumer, 186 181 .measure = measure,
+1 -13
tools/testing/selftests/bpf/prog_tests/test_overhead.c
··· 61 61 const char *raw_tp_name = "raw_tp/task_rename"; 62 62 const char *fentry_name = "fentry/__set_task_comm"; 63 63 const char *fexit_name = "fexit/__set_task_comm"; 64 - const char *fmodret_name = "fmod_ret/__set_task_comm"; 65 64 const char *kprobe_func = "__set_task_comm"; 66 65 struct bpf_program *kprobe_prog, *kretprobe_prog, *raw_tp_prog; 67 - struct bpf_program *fentry_prog, *fexit_prog, *fmodret_prog; 66 + struct bpf_program *fentry_prog, *fexit_prog; 68 67 struct bpf_object *obj; 69 68 struct bpf_link *link; 70 69 int err, duration = 0; ··· 96 97 if (CHECK(!fexit_prog, "find_probe", 97 98 "prog '%s' not found\n", fexit_name)) 98 99 goto cleanup; 99 - fmodret_prog = bpf_object__find_program_by_title(obj, fmodret_name); 100 - if (CHECK(!fmodret_prog, "find_probe", 101 - "prog '%s' not found\n", fmodret_name)) 102 - goto cleanup; 103 - 104 100 err = bpf_object__load(obj); 105 101 if (CHECK(err, "obj_load", "err %d\n", err)) 106 102 goto cleanup; ··· 142 148 test_run("fexit"); 143 149 bpf_link__destroy(link); 144 150 145 - /* attach fmod_ret */ 146 - link = bpf_program__attach_trace(fmodret_prog); 147 - if (CHECK(IS_ERR(link), "attach fmod_ret", "err %ld\n", PTR_ERR(link))) 148 - goto cleanup; 149 - test_run("fmod_ret"); 150 - bpf_link__destroy(link); 151 151 cleanup: 152 152 prctl(PR_SET_NAME, comm, 0L, 0L, 0L); 153 153 bpf_object__close(obj);
-6
tools/testing/selftests/bpf/progs/test_overhead.c
··· 39 39 return 0; 40 40 } 41 41 42 - SEC("fmod_ret/__set_task_comm") 43 - int BPF_PROG(prog6, struct task_struct *tsk, const char *buf, bool exec) 44 - { 45 - return !tsk; 46 - } 47 - 48 42 char _license[] SEC("license") = "GPL";