Skip to content

Commit b000def

Browse files
tohojoAlexei Starovoitov
authored andcommitted
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: 4eaf0b5 ("selftest/bpf: Fmod_ret prog and implement test_overhead as part of bench") Acked-by: Andrii Nakryiko <[email protected]> Signed-off-by: Toke Høiland-Jørgensen <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent f7b12b6 commit b000def

File tree

4 files changed

+1
-39
lines changed

4 files changed

+1
-39
lines changed

tools/testing/selftests/bpf/bench.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,6 @@ extern const struct bench bench_rename_kretprobe;
311311
extern const struct bench bench_rename_rawtp;
312312
extern const struct bench bench_rename_fentry;
313313
extern const struct bench bench_rename_fexit;
314-
extern const struct bench bench_rename_fmodret;
315314
extern const struct bench bench_trig_base;
316315
extern const struct bench bench_trig_tp;
317316
extern const struct bench bench_trig_rawtp;
@@ -333,7 +332,6 @@ static const struct bench *benchs[] = {
333332
&bench_rename_rawtp,
334333
&bench_rename_fentry,
335334
&bench_rename_fexit,
336-
&bench_rename_fmodret,
337335
&bench_trig_base,
338336
&bench_trig_tp,
339337
&bench_trig_rawtp,
@@ -464,4 +462,3 @@ int main(int argc, char **argv)
464462

465463
return 0;
466464
}
467-

tools/testing/selftests/bpf/benchs/bench_rename.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,6 @@ static void setup_fexit()
106106
attach_bpf(ctx.skel->progs.prog5);
107107
}
108108

109-
static void setup_fmodret()
110-
{
111-
setup_ctx();
112-
attach_bpf(ctx.skel->progs.prog6);
113-
}
114-
115109
static void *consumer(void *input)
116110
{
117111
return NULL;
@@ -182,14 +176,3 @@ const struct bench bench_rename_fexit = {
182176
.report_progress = hits_drops_report_progress,
183177
.report_final = hits_drops_report_final,
184178
};
185-
186-
const struct bench bench_rename_fmodret = {
187-
.name = "rename-fmodret",
188-
.validate = validate,
189-
.setup = setup_fmodret,
190-
.producer_thread = producer,
191-
.consumer_thread = consumer,
192-
.measure = measure,
193-
.report_progress = hits_drops_report_progress,
194-
.report_final = hits_drops_report_final,
195-
};

tools/testing/selftests/bpf/prog_tests/test_overhead.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,9 @@ void test_test_overhead(void)
6161
const char *raw_tp_name = "raw_tp/task_rename";
6262
const char *fentry_name = "fentry/__set_task_comm";
6363
const char *fexit_name = "fexit/__set_task_comm";
64-
const char *fmodret_name = "fmod_ret/__set_task_comm";
6564
const char *kprobe_func = "__set_task_comm";
6665
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;
6867
struct bpf_object *obj;
6968
struct bpf_link *link;
7069
int err, duration = 0;
@@ -97,11 +96,6 @@ void test_test_overhead(void)
9796
if (CHECK(!fexit_prog, "find_probe",
9897
"prog '%s' not found\n", fexit_name))
9998
goto cleanup;
100-
fmodret_prog = bpf_object__find_program_by_title(obj, fmodret_name);
101-
if (CHECK(!fmodret_prog, "find_probe",
102-
"prog '%s' not found\n", fmodret_name))
103-
goto cleanup;
104-
10599
err = bpf_object__load(obj);
106100
if (CHECK(err, "obj_load", "err %d\n", err))
107101
goto cleanup;
@@ -148,12 +142,6 @@ void test_test_overhead(void)
148142
test_run("fexit");
149143
bpf_link__destroy(link);
150144

151-
/* attach fmod_ret */
152-
link = bpf_program__attach_trace(fmodret_prog);
153-
if (CHECK(IS_ERR(link), "attach fmod_ret", "err %ld\n", PTR_ERR(link)))
154-
goto cleanup;
155-
test_run("fmod_ret");
156-
bpf_link__destroy(link);
157145
cleanup:
158146
prctl(PR_SET_NAME, comm, 0L, 0L, 0L);
159147
bpf_object__close(obj);

tools/testing/selftests/bpf/progs/test_overhead.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,4 @@ int BPF_PROG(prog5, struct task_struct *tsk, const char *buf, bool exec)
3939
return 0;
4040
}
4141

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-
4842
char _license[] SEC("license") = "GPL";

0 commit comments

Comments
 (0)