Message ID | 20210508034837.64585-22-alexei.starovoitov@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | BPF |
Headers | show |
Series | bpf: syscall program, FD array, loader program, light skeleton. | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | fail | Series longer than 15 patches |
netdev/tree_selection | success | Clearly marked for bpf-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 9 maintainers not CCed: linux-kselftest@vger.kernel.org netdev@vger.kernel.org yhs@fb.com kpsingh@kernel.org kafai@fb.com ast@kernel.org songliubraving@fb.com shuah@kernel.org alan.maguire@oracle.com |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | warning | WARNING: line length of 84 exceeds 80 columns |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
On Fri, May 7, 2021 at 8:49 PM Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote: > > From: Alexei Starovoitov <ast@kernel.org> > > Convert test trace_printk to more aggressively validate and use rodata. > > Signed-off-by: Alexei Starovoitov <ast@kernel.org> > --- > tools/testing/selftests/bpf/prog_tests/trace_printk.c | 3 +++ > tools/testing/selftests/bpf/progs/trace_printk.c | 4 ++-- > 2 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/bpf/prog_tests/trace_printk.c b/tools/testing/selftests/bpf/prog_tests/trace_printk.c > index 39b0decb1bb2..60c2347a3181 100644 > --- a/tools/testing/selftests/bpf/prog_tests/trace_printk.c > +++ b/tools/testing/selftests/bpf/prog_tests/trace_printk.c > @@ -21,6 +21,9 @@ void test_trace_printk(void) > if (CHECK(!skel, "skel_open", "failed to open skeleton\n")) > return; > > + ASSERT_EQ(skel->rodata->sys_enter_fmt[0], 'T', "invalid printk fmt string"); > + skel->rodata->sys_enter_fmt[0] = 't'; sys_enter.fmt is no more, need to make it into a global variable. > + > err = trace_printk__load(skel); > if (CHECK(err, "skel_load", "failed to load skeleton: %d\n", err)) > goto cleanup; > diff --git a/tools/testing/selftests/bpf/progs/trace_printk.c b/tools/testing/selftests/bpf/progs/trace_printk.c > index 8ca7f399b670..18c8baaf1143 100644 > --- a/tools/testing/selftests/bpf/progs/trace_printk.c > +++ b/tools/testing/selftests/bpf/progs/trace_printk.c > @@ -10,10 +10,10 @@ char _license[] SEC("license") = "GPL"; > int trace_printk_ret = 0; > int trace_printk_ran = 0; > > -SEC("tp/raw_syscalls/sys_enter") > +SEC("fentry/__x64_sys_nanosleep") this will break on non-x64 systems, can more stable raw_tp be used here? > int sys_enter(void *ctx) > { > - static const char fmt[] = "testing,testing %d\n"; > + static const char fmt[] = "Testing,testing %d\n"; > > trace_printk_ret = bpf_trace_printk(fmt, sizeof(fmt), > ++trace_printk_ran); > -- > 2.30.2 >
diff --git a/tools/testing/selftests/bpf/prog_tests/trace_printk.c b/tools/testing/selftests/bpf/prog_tests/trace_printk.c index 39b0decb1bb2..60c2347a3181 100644 --- a/tools/testing/selftests/bpf/prog_tests/trace_printk.c +++ b/tools/testing/selftests/bpf/prog_tests/trace_printk.c @@ -21,6 +21,9 @@ void test_trace_printk(void) if (CHECK(!skel, "skel_open", "failed to open skeleton\n")) return; + ASSERT_EQ(skel->rodata->sys_enter_fmt[0], 'T', "invalid printk fmt string"); + skel->rodata->sys_enter_fmt[0] = 't'; + err = trace_printk__load(skel); if (CHECK(err, "skel_load", "failed to load skeleton: %d\n", err)) goto cleanup; diff --git a/tools/testing/selftests/bpf/progs/trace_printk.c b/tools/testing/selftests/bpf/progs/trace_printk.c index 8ca7f399b670..18c8baaf1143 100644 --- a/tools/testing/selftests/bpf/progs/trace_printk.c +++ b/tools/testing/selftests/bpf/progs/trace_printk.c @@ -10,10 +10,10 @@ char _license[] SEC("license") = "GPL"; int trace_printk_ret = 0; int trace_printk_ran = 0; -SEC("tp/raw_syscalls/sys_enter") +SEC("fentry/__x64_sys_nanosleep") int sys_enter(void *ctx) { - static const char fmt[] = "testing,testing %d\n"; + static const char fmt[] = "Testing,testing %d\n"; trace_printk_ret = bpf_trace_printk(fmt, sizeof(fmt), ++trace_printk_ran);