Re: [PATCHv2 RFC bpf-next 0/7] bpf: Add support for ftrace probe

2021-04-20 Thread Jiri Olsa
On Tue, Apr 20, 2021 at 08:33:43AM -0700, Alexei Starovoitov wrote: > On Tue, Apr 20, 2021 at 5:51 AM Jiri Olsa wrote: > > > > On Fri, Apr 16, 2021 at 12:48:34PM -0400, Steven Rostedt wrote: > > > On Sat, 17 Apr 2021 00:03:04 +0900 > > > Masami Hiramatsu wr

[PATCH bpf-next] selftests/bpf: Add docs target as all dependency

2021-04-20 Thread Jiri Olsa
2 $ make make[1]: Nothing to be done for 'docs'. Cc: Joe Stringer Fixes: a01d935b2e09 ("tools/bpf: Remove bpf-helpers from bpftool docs") Signed-off-by: Jiri Olsa --- tools/testing/selftests/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

Re: [PATCHv2 RFC bpf-next 0/7] bpf: Add support for ftrace probe

2021-04-20 Thread Jiri Olsa
On Fri, Apr 16, 2021 at 12:48:34PM -0400, Steven Rostedt wrote: > On Sat, 17 Apr 2021 00:03:04 +0900 > Masami Hiramatsu wrote: > > > > Anyway, IIRC, Masami wasn't sure that the full regs was ever needed for > > > the > > > return (who cares about the registers on return, except for the return >

Re: [PATCHv2 RFC bpf-next 0/7] bpf: Add support for ftrace probe

2021-04-19 Thread Jiri Olsa
On Thu, Apr 15, 2021 at 07:30:32PM -0400, Steven Rostedt wrote: > On Thu, 15 Apr 2021 23:49:43 +0200 > Jiri Olsa wrote: > > > > right, I quickly checked on that and it looks exactly like > > the thing we need > > > > I'll try to rebase that on the cu

Re: [PATCHv5 bpf-next 0/7] bpf: Tracing and lsm programs re-attach

2021-04-15 Thread Jiri Olsa
On Thu, Apr 15, 2021 at 04:45:24PM -0700, Alexei Starovoitov wrote: > On Wed, Apr 14, 2021 at 12:52 PM Jiri Olsa wrote: > > > > hi, > > while adding test for pinning the module while there's > > trampoline attach to it, I noticed that we don't allow > &

Re: [PATCHv2 RFC bpf-next 0/7] bpf: Add support for ftrace probe

2021-04-15 Thread Jiri Olsa
On Thu, Apr 15, 2021 at 02:21:20PM -0400, Steven Rostedt wrote: > On Thu, 15 Apr 2021 14:18:31 -0400 > Steven Rostedt wrote: > > > My last release of that code is here: > > > > https://lore.kernel.org/lkml/20190525031633.811342...@goodmis.org/ > > > > It allows you to "reserve data" to pass f

Re: [PATCHv2 RFC bpf-next 0/7] bpf: Add support for ftrace probe

2021-04-15 Thread Jiri Olsa
On Thu, Apr 15, 2021 at 11:10:02AM -0400, Steven Rostedt wrote: SNIP > > > heya, > > > I had some initial prototypes trying this way, but always ended up > > > in complicated code, that's why I turned to ftrace_ops. > > > > > > let's see if it'll make any sense to you ;-) > > > > > > 1) so let's

Re: [PATCHv2 RFC bpf-next 0/7] bpf: Add support for ftrace probe

2021-04-15 Thread Jiri Olsa
On Wed, Apr 14, 2021 at 03:46:49PM -0700, Andrii Nakryiko wrote: > On Wed, Apr 14, 2021 at 5:19 AM Jiri Olsa wrote: > > > > On Tue, Apr 13, 2021 at 06:04:05PM -0700, Andrii Nakryiko wrote: > > > On Tue, Apr 13, 2021 at 7:57 AM Jiri Olsa wrote: > > > > > &g

[PATCHv5 bpf-next 7/7] selftests/bpf: Use ASSERT macros in lsm test

2021-04-14 Thread Jiri Olsa
Replacing CHECK with ASSERT macros. Suggested-by: Andrii Nakryiko Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/test_lsm.c | 27 +++ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/test_lsm.c b/tools

[PATCHv5 bpf-next 6/7] selftests/bpf: Test that module can't be unloaded with attached trampoline

2021-04-14 Thread Jiri Olsa
Adding test to verify that once we attach module's trampoline, the module can't be unloaded. Acked-by: Andrii Nakryiko Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/module_attach.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/tools/testing/sel

[PATCHv5 bpf-next 5/7] selftests/bpf: Add re-attach test to lsm test

2021-04-14 Thread Jiri Olsa
Adding the test to re-attach (detach/attach again) lsm programs, plus check that already linked program can't be attached again. Acked-by: Andrii Nakryiko Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/test_lsm.c | 48 +++ 1 file changed, 38 insertions(+

[PATCHv5 bpf-next 4/7] selftests/bpf: Add re-attach test to fexit_test

2021-04-14 Thread Jiri Olsa
Adding the test to re-attach (detach/attach again) tracing fexit programs, plus check that already linked program can't be attached again. Also switching to ASSERT* macros. Acked-by: Andrii Nakryiko Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/fexit_test.c

[PATCHv5 bpf-next 3/7] selftests/bpf: Add re-attach test to fentry_test

2021-04-14 Thread Jiri Olsa
Adding the test to re-attach (detach/attach again) tracing fentry programs, plus check that already linked program can't be attached again. Acked-by: Andrii Nakryiko Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/fentry_test.c| 52 +-- 1 file change

[PATCHv5 bpf-next 2/7] selftests/bpf: Add missing semicolon

2021-04-14 Thread Jiri Olsa
Adding missing semicolon. Fixes: 22ba36351631 ("selftests/bpf: Move and extend ASSERT_xxx() testing macros") Signed-off-by: Jiri Olsa --- tools/testing/selftests/bpf/test_progs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/test_

[PATCHv5 bpf-next 1/7] bpf: Allow trampoline re-attach for tracing and lsm programs

2021-04-14 Thread Jiri Olsa
a. Reported-by: kernel test robot Reported-by: Julia Lawall Acked-by: Toke Høiland-Jørgensen Signed-off-by: Jiri Olsa --- kernel/bpf/syscall.c| 23 +-- kernel/bpf/trampoline.c | 4 ++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/kernel/bpf/syscall

[PATCHv5 bpf-next 0/7] bpf: Tracing and lsm programs re-attach

2021-04-14 Thread Jiri Olsa
pass. v5 changes: - fixed missing hlist_del_init change - fixed several ASSERT calls - added extra patch for missing ';' - added ASSERT macros to lsm test - added acks thanks, jirka [1] https://lore.kernel.org/bpf/20210326105900.151466-1-jo...@kernel.org/ --- Jiri Olsa (7): b

Re: [PATCHv2 RFC bpf-next 0/7] bpf: Add support for ftrace probe

2021-04-14 Thread Jiri Olsa
On Tue, Apr 13, 2021 at 06:04:05PM -0700, Andrii Nakryiko wrote: > On Tue, Apr 13, 2021 at 7:57 AM Jiri Olsa wrote: > > > > hi, > > sending another attempt on speeding up load of multiple probes > > for bpftrace and possibly other tools (first post in [1]). > >

Re: [PATCHv4 bpf-next 3/5] selftests/bpf: Add re-attach test to fexit_test

2021-04-14 Thread Jiri Olsa
On Tue, Apr 13, 2021 at 02:55:32PM -0700, Andrii Nakryiko wrote: > On Mon, Apr 12, 2021 at 9:30 AM Jiri Olsa wrote: > > > > Adding the test to re-attach (detach/attach again) tracing > > fexit programs, plus check that already linked program can't > > be attached

Re: [PATCHv4 bpf-next 1/5] bpf: Allow trampoline re-attach for tracing and lsm programs

2021-04-14 Thread Jiri Olsa
On Tue, Apr 13, 2021 at 03:03:27PM -0700, Andrii Nakryiko wrote: > On Mon, Apr 12, 2021 at 9:28 AM Jiri Olsa wrote: > > > > Currently we don't allow re-attaching of trampolines. Once > > it's detached, it can't be re-attach even when the program > > is st

Re: [PATCHv4 bpf-next 2/5] selftests/bpf: Add re-attach test to fentry_test

2021-04-14 Thread Jiri Olsa
On Tue, Apr 13, 2021 at 02:54:10PM -0700, Andrii Nakryiko wrote: SNIP > > __u32 duration = 0, retval; > > + struct bpf_link *link; > > __u64 *result; > > > > - fentry_skel = fentry_test__open_and_load(); > > - if (CHECK(!fentry_skel, "fentry_skel_load", "fentry s

Re: [PATCHv4 bpf-next 4/5] selftests/bpf: Add re-attach test to lsm test

2021-04-14 Thread Jiri Olsa
On Tue, Apr 13, 2021 at 02:57:26PM -0700, Andrii Nakryiko wrote: > On Mon, Apr 12, 2021 at 9:31 AM Jiri Olsa wrote: > > > > Adding the test to re-attach (detach/attach again) lsm programs, > > plus check that already linked program can't be attached again. > &

[PATCHv2 RFC bpf-next 3/7] bpf: Add support to attach program to ftrace probe

2021-04-13 Thread Jiri Olsa
trace_probe as probe, but we could change it to use any function with same prototype if needed. Signed-off-by: Jiri Olsa --- include/uapi/linux/bpf.h | 3 + kernel/bpf/syscall.c | 147 + kernel/bpf/verifier.c | 30 +++ net/bpf/test_ru

[PATCHv2 RFC bpf-next 6/7] selftests/bpf: Add ftrace probe to fentry test

2021-04-13 Thread Jiri Olsa
Adding 2 more tests for fentry probe test, to show/test ftrace probe. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/fentry_test.c | 5 - tools/testing/selftests/bpf/progs/fentry_test.c | 16 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a

[PATCHv2 RFC bpf-next 5/7] libbpf: Add support to load and attach ftrace probe

2021-04-13 Thread Jiri Olsa
Signed-off-by: Jiri Olsa --- tools/lib/bpf/bpf.c | 12 +++ tools/lib/bpf/bpf.h | 5 ++- tools/lib/bpf/libbpf.c | 74 tools/lib/bpf/libbpf.map | 1 + 4 files changed, 91 insertions(+), 1 deletion(-) diff --git a/tools/lib/bpf/bpf.c b/tool

[PATCHv2 RFC bpf-next 7/7] selftests/bpf: Add ftrace probe test

2021-04-13 Thread Jiri Olsa
Adding simple ftrace probe test that configures ftrace probe and verifies the 'ip' argument matches the probed functions addresses. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/ftrace_test.c| 48 +++ .../testing/selftests/bpf/progs/ftrace_test.c | 17

[PATCHv2 RFC bpf-next 0/7] bpf: Add support for ftrace probe

2021-04-13 Thread Jiri Olsa
o available in git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git bpf/ftrace thanks, jirka [1] https://lore.kernel.org/bpf/20201022082138.2322434-1-jo...@kernel.org/ --- Jiri Olsa (7): bpf: Move bpf_prog_start/end functions to generic place bpf: Add bpf_functions o

[PATCHv2 RFC bpf-next 2/7] bpf: Add bpf_functions object

2021-04-13 Thread Jiri Olsa
fd is returned. For fd >= 0 the function (specified by btf_id) is added to the existing object for the given fd. Signed-off-by: Jiri Olsa --- include/uapi/linux/bpf.h | 5 ++ kernel/bpf/syscall.c | 137 + tools/include/uapi/linux/bpf.h | 5 ++

[PATCHv2 RFC bpf-next 4/7] libbpf: Add btf__find_by_pattern_kind function

2021-04-13 Thread Jiri Olsa
Adding btf__find_by_pattern_kind function that returns array of BTF ids for given function name pattern. Using libc's regex.h support for that. Signed-off-by: Jiri Olsa --- tools/lib/bpf/btf.c | 68 + tools/lib/bpf/btf.h | 3 ++ 2 files change

[PATCHv2 RFC bpf-next 1/7] bpf: Move bpf_prog_start/end functions to generic place

2021-04-13 Thread Jiri Olsa
Moving bpf_prog_start/end functions plus related static functions to generic place. So they can be used also when trampolines are disabled. Reported-by: kernel test robot Signed-off-by: Jiri Olsa --- kernel/bpf/syscall.c| 97 + kernel/bpf

[PATCHv4 bpf-next 3/5] selftests/bpf: Add re-attach test to fexit_test

2021-04-12 Thread Jiri Olsa
Adding the test to re-attach (detach/attach again) tracing fexit programs, plus check that already linked program can't be attached again. Also switching to ASSERT* macros. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/fexit_test.c | 51 +-- 1 file change

[PATCHv4 bpf-next 4/5] selftests/bpf: Add re-attach test to lsm test

2021-04-12 Thread Jiri Olsa
Adding the test to re-attach (detach/attach again) lsm programs, plus check that already linked program can't be attached again. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/test_lsm.c | 48 +++ 1 file changed, 38 insertions(+), 10 deletions(-) diff --

[PATCHv4 bpf-next 5/5] selftests/bpf: Test that module can't be unloaded with attached trampoline

2021-04-12 Thread Jiri Olsa
Adding test to verify that once we attach module's trampoline, the module can't be unloaded. Acked-by: Andrii Nakryiko Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/module_attach.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/tools/testing/sel

[PATCHv4 bpf-next 2/5] selftests/bpf: Add re-attach test to fentry_test

2021-04-12 Thread Jiri Olsa
Adding the test to re-attach (detach/attach again) tracing fentry programs, plus check that already linked program can't be attached again. Also switching to ASSERT* macros and adding missing ';' in ASSERT_ERR_PTR macro. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_test

[PATCHv4 bpf-next 1/5] bpf: Allow trampoline re-attach for tracing and lsm programs

2021-04-12 Thread Jiri Olsa
a. Reported-by: kernel test robot Reported-by: Julia Lawall Acked-by: Toke Høiland-Jørgensen Signed-off-by: Jiri Olsa --- kernel/bpf/syscall.c| 23 +-- kernel/bpf/trampoline.c | 2 +- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/kernel/bpf/syscall

[PATCHv4 bpf-next 0/5] bpf: Tracing and lsm programs re-attach

2021-04-12 Thread Jiri Olsa
pass. v4 changes: - fix wrong cleanup goto jump reported by Julia thanks, jirka [1] https://lore.kernel.org/bpf/20210326105900.151466-1-jo...@kernel.org/ --- Jiri Olsa (5): bpf: Allow trampoline re-attach for tracing and lsm programs selftests/bpf: Add re-attach test to fentry_test

Re: [PATCHv3 bpf-next 1/5] bpf: Allow trampoline re-attach for tracing and lsm programs (fwd)

2021-04-11 Thread Jiri Olsa
lt;20210411130010.1337650-2-jo...@kernel.org> > References: <20210411130010.1337650-2-jo...@kernel.org> > TO: Jiri Olsa > TO: Alexei Starovoitov > TO: Daniel Borkmann > TO: Andrii Nakryiko > CC: "Toke Høiland-Jørgensen" > CC: netdev@vger.kernel.org

[PATCHv3 bpf-next 4/5] selftests/bpf: Add re-attach test to lsm test

2021-04-11 Thread Jiri Olsa
Adding the test to re-attach (detach/attach again) lsm programs, plus check that already linked program can't be attached again. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/test_lsm.c | 48 +++ 1 file changed, 38 insertions(+), 10 deletions(-) diff --

[PATCHv3 bpf-next 5/5] selftests/bpf: Test that module can't be unloaded with attached trampoline

2021-04-11 Thread Jiri Olsa
Adding test to verify that once we attach module's trampoline, the module can't be unloaded. Acked-by: Andrii Nakryiko Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/module_attach.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/tools/testing/sel

[PATCHv3 bpf-next 2/5] selftests/bpf: Add re-attach test to fentry_test

2021-04-11 Thread Jiri Olsa
Adding the test to re-attach (detach/attach again) tracing fentry programs, plus check that already linked program can't be attached again. Also switching to ASSERT* macros and adding missing ';' in ASSERT_ERR_PTR macro. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_test

[PATCHv3 bpf-next 3/5] selftests/bpf: Add re-attach test to fexit_test

2021-04-11 Thread Jiri Olsa
Adding the test to re-attach (detach/attach again) tracing fexit programs, plus check that already linked program can't be attached again. Also switching to ASSERT* macros. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/fexit_test.c | 51 +-- 1 file change

[PATCHv3 bpf-next 1/5] bpf: Allow trampoline re-attach for tracing and lsm programs

2021-04-11 Thread Jiri Olsa
Currently we don't allow re-attaching of trampolines. Once it's detached, it can't be re-attach even when the program is still loaded. Adding the possibility to re-attach the loaded tracing and lsm programs. Acked-by: Toke Høiland-Jørgensen Signed-off-by: Jiri Olsa --- kerne

[PATCHv3 bpf-next 0/5] bpf: Tracing and lsm programs re-attach

2021-04-11 Thread Jiri Olsa
pass. v3 changes: - used ASSERT* macros apart from lsm test, which is using CHECKs all over the place [Andrii] - added acks thanks, jirka [1] https://lore.kernel.org/bpf/20210326105900.151466-1-jo...@kernel.org/ --- Jiri Olsa (5): bpf: Allow trampoline re-attach for tracing and ls

Re: [PATCHv2 bpf-next 5/5] selftests/bpf: Test that module can't be unloaded with attached trampoline

2021-04-08 Thread Jiri Olsa
On Wed, Apr 07, 2021 at 04:04:48PM -0700, Andrii Nakryiko wrote: > On Wed, Apr 7, 2021 at 4:22 AM Jiri Olsa wrote: > > > > Adding test to verify that once we attach module's trampoline, > > the module can't be unloaded. > > > > Signed-off-by: Jiri Olsa

Re: [PATCHv2 bpf-next 2/5] selftests/bpf: Add re-attach test to fentry_test

2021-04-08 Thread Jiri Olsa
On Wed, Apr 07, 2021 at 03:47:30PM -0700, Andrii Nakryiko wrote: > On Wed, Apr 7, 2021 at 4:21 AM Jiri Olsa wrote: > > > > Adding the test to re-attach (detach/attach again) tracing > > fentry programs, plus check that already linked program can't > > be attached

Re: [PATCHv2 bpf-next 3/5] selftests/bpf: Add re-attach test to fexit_test

2021-04-08 Thread Jiri Olsa
On Wed, Apr 07, 2021 at 03:51:46PM -0700, Andrii Nakryiko wrote: > On Wed, Apr 7, 2021 at 4:21 AM Jiri Olsa wrote: > > > > Adding the test to re-attach (detach/attach again) tracing > > fexit programs, plus check that already linked program can't > > be attached

Re: WARNING net/core/stream.c:208 when running test_sockmap

2021-04-08 Thread Jiri Olsa
On Wed, Apr 07, 2021 at 04:14:27PM -0700, Cong Wang wrote: > On Wed, Apr 7, 2021 at 2:22 PM Jiri Olsa wrote: > > > > hi, > > I'm getting couple of WARNINGs below when running > > test_sockmap on latest bpf-next/master, like: > > > > # while :; do ./t

[PATCHv2 bpf-next 5/5] selftests/bpf: Test that module can't be unloaded with attached trampoline

2021-04-06 Thread Jiri Olsa
Adding test to verify that once we attach module's trampoline, the module can't be unloaded. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/module_attach.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/modul

[PATCHv2 bpf-next 4/5] selftests/bpf: Add re-attach test to lsm test

2021-04-06 Thread Jiri Olsa
Adding the test to re-attach (detach/attach again) lsm programs, plus check that already linked program can't be attached again. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/test_lsm.c | 48 +++ 1 file changed, 38 insertions(+), 10 deletions(-) diff --

[PATCHv2 bpf-next 3/5] selftests/bpf: Add re-attach test to fexit_test

2021-04-06 Thread Jiri Olsa
Adding the test to re-attach (detach/attach again) tracing fexit programs, plus check that already linked program can't be attached again. Fixing the number of check-ed results, which should be 8. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/fexit_test.c

[PATCHv2 bpf-next 2/5] selftests/bpf: Add re-attach test to fentry_test

2021-04-06 Thread Jiri Olsa
Adding the test to re-attach (detach/attach again) tracing fentry programs, plus check that already linked program can't be attached again. Fixing the number of check-ed results, which should be 8. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/fentry_test.c

[PATCHv2 bpf-next 1/5] bpf: Allow trampoline re-attach for tracing and lsm programs

2021-04-06 Thread Jiri Olsa
Currently we don't allow re-attaching of trampolines. Once it's detached, it can't be re-attach even when the program is still loaded. Adding the possibility to re-attach the loaded tracing and lsm programs. Signed-off-by: Jiri Olsa --- kernel/bpf/sy

[PATCHv2 bpf-next 0/5] bpf: Tracing and lsm programs re-attach

2021-04-06 Thread Jiri Olsa
pass. v2 changes: - allow re-attach for TRACING and LSM programs - add lsm re-attach test thanks, jirka [1] https://lore.kernel.org/bpf/20210326105900.151466-1-jo...@kernel.org/ --- Jiri Olsa (5): bpf: Allow trampoline re-attach for tracing and lsm programs selftests/bpf: Add re-atta

Re: [RFC PATCH bpf-next 1/4] bpf: Allow trampoline re-attach

2021-04-05 Thread Jiri Olsa
On Mon, Apr 05, 2021 at 04:15:54PM +0200, Toke Høiland-Jørgensen wrote: > Jiri Olsa writes: > > > On Sat, Apr 03, 2021 at 11:21:55AM -0700, Alexei Starovoitov wrote: > >> On Sat, Apr 03, 2021 at 01:24:12PM +0200, Toke Høiland-Jørgensen wrote: > >> > >

Re: [RFC PATCH bpf-next 1/4] bpf: Allow trampoline re-attach

2021-04-05 Thread Jiri Olsa
On Sat, Apr 03, 2021 at 11:21:55AM -0700, Alexei Starovoitov wrote: > On Sat, Apr 03, 2021 at 01:24:12PM +0200, Toke Høiland-Jørgensen wrote: > > > if (!prog->aux->dst_trampoline && !tgt_prog) { > > > - err = -ENOENT; > > > - goto out_unlock; > > > + /* > > > + *

Re: [RFC PATCH bpf-next 1/4] bpf: Allow trampoline re-attach

2021-04-05 Thread Jiri Olsa
On Sat, Apr 03, 2021 at 01:24:12PM +0200, Toke Høiland-Jørgensen wrote: > Jiri Olsa writes: > > > Currently we don't allow re-attaching of trampolines. Once > > it's detached, it can't be re-attach even when the program > > is still loaded. > > >

Re: [RFC PATCH bpf-next 2/4] selftests/bpf: Add re-attach test to fentry_test

2021-03-30 Thread Jiri Olsa
On Tue, Mar 30, 2021 at 01:23:15AM +, Song Liu wrote: > > > > On Mar 28, 2021, at 4:26 AM, Jiri Olsa wrote: > > > > Adding the test to re-attach (detach/attach again) tracing > > fentry programs, plus check that already linked program can't > > be a

Re: [PATCH v4 bpf-next 07/12] libbpf: add BPF static linker BTF and BTF.ext support

2021-03-29 Thread Jiri Olsa
On Sun, Mar 28, 2021 at 11:29:27AM -0700, Andrii Nakryiko wrote: > On Sun, Mar 28, 2021 at 5:03 AM Jiri Olsa wrote: > > > > On Fri, Mar 19, 2021 at 07:58:13PM +0100, Jiri Olsa wrote: > > > On Fri, Mar 19, 2021 at 11:39:01AM -0700, Andrii Nakryiko wrote: > > >

Re: linux-next: manual merge of the net-next tree with the bpf tree

2021-03-29 Thread Jiri Olsa
On Mon, Mar 29, 2021 at 12:29:16PM +1100, Stephen Rothwell wrote: > Hi all, > > Today's linux-next merge of the net-next tree got a conflict in: > > include/linux/bpf.h > > between commit: > > 861de02e5f3f ("bpf: Take module reference for trampoline in module") > > from the bpf tree and co

Re: [PATCH v4 bpf-next 07/12] libbpf: add BPF static linker BTF and BTF.ext support

2021-03-28 Thread Jiri Olsa
On Fri, Mar 19, 2021 at 07:58:13PM +0100, Jiri Olsa wrote: > On Fri, Mar 19, 2021 at 11:39:01AM -0700, Andrii Nakryiko wrote: > > On Fri, Mar 19, 2021 at 9:23 AM Jiri Olsa wrote: > > > > > > On Thu, Mar 18, 2021 at 12:40:31PM -0700, Andrii Nakry

[RFC PATCH bpf-next 2/4] selftests/bpf: Add re-attach test to fentry_test

2021-03-28 Thread Jiri Olsa
Adding the test to re-attach (detach/attach again) tracing fentry programs, plus check that already linked program can't be attached again. Fixing the number of check-ed results, which should be 8. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/fentry_test.c

[RFC PATCH bpf-next 1/4] bpf: Allow trampoline re-attach

2021-03-28 Thread Jiri Olsa
Currently we don't allow re-attaching of trampolines. Once it's detached, it can't be re-attach even when the program is still loaded. Adding the possibility to re-attach the loaded tracing kernel program. Signed-off-by: Jiri Olsa --- kernel/bpf/sy

[RFC PATCH bpf-next 4/4] selftests/bpf: Test that module can't be unloaded with attached trampoline

2021-03-28 Thread Jiri Olsa
Adding test to verify that once we attach module's trampoline, the module can't be unloaded. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/module_attach.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/modul

[RFC PATCH bpf-next 3/4] selftests/bpf: Add re-attach test to fexit_test

2021-03-28 Thread Jiri Olsa
Adding the test to re-attach (detach/attach again) tracing fexit programs, plus check that already linked program can't be attached again. Fixing the number of check-ed results, which should be 8. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/fexit_test.c

[RFC PATCH bpf-next 0/4] bpf: Tracing programs re-attach

2021-03-28 Thread Jiri Olsa
now. You need to have patch [1] from bpf tree for test module attach test to pass. thanks, jirka [1] https://lore.kernel.org/bpf/20210326105900.151466-1-jo...@kernel.org/ --- Jiri Olsa (4): bpf: Allow trampoline re-attach selftests/bpf: Add re-attach test to fentry_test selfte

[PATCHv3 bpf] bpf: Take module reference for trampoline in module

2021-03-26 Thread Jiri Olsa
;s ip is within the module code. Releasing it when the trampoline's ip is unregistered. Signed-off-by: Jiri Olsa --- v3 changes: - store module pointer under bpf_trampoline struct include/linux/bpf.h | 2 ++ kernel/bpf/trampoline.c | 30 ++ 2 files ch

Re: [PATCHv2] bpf: Take module reference for trampoline in module

2021-03-25 Thread Jiri Olsa
On Thu, Mar 25, 2021 at 10:26:32PM +0100, Daniel Borkmann wrote: > On 3/24/21 6:40 PM, Jiri Olsa wrote: > > Currently module can be unloaded even if there's a trampoline > > register in it. It's easily reproduced by running in parallel: > > > ># while :; d

[PATCHv2] bpf: Take module reference for trampoline in module

2021-03-24 Thread Jiri Olsa
;s ip is within the module code. Releasing it when the trampoline's ip is unregistered. Signed-off-by: Jiri Olsa --- v2 changes: - fixed ip_module_put to do preempt_disable/preempt_enable kernel/bpf/trampoline.c | 31 +++ 1 file changed, 31 insertions(+) dif

Re: [PATCH bpf] bpf: Take module reference for ip in module code

2021-03-24 Thread Jiri Olsa
On Wed, Mar 24, 2021 at 12:31:42PM +0100, Jiri Olsa wrote: > On Tue, Mar 23, 2021 at 06:22:37PM -0700, Alexei Starovoitov wrote: > > On Tue, Mar 23, 2021 at 10:15:33PM +0100, Jiri Olsa wrote: > > > Currently module can be unloaded even if there's a trampoline > >

Re: [PATCH bpf] bpf: Take module reference for ip in module code

2021-03-24 Thread Jiri Olsa
On Tue, Mar 23, 2021 at 06:22:37PM -0700, Alexei Starovoitov wrote: > On Tue, Mar 23, 2021 at 10:15:33PM +0100, Jiri Olsa wrote: > > Currently module can be unloaded even if there's a trampoline > > register in it. It's easily reproduced by running in parallel:

[PATCH bpf] bpf: Take module reference for ip in module code

2021-03-23 Thread Jiri Olsa
p is within the module code. Releasing it when the trampoline's ip is unregistered. Signed-off-by: Jiri Olsa --- kernel/bpf/trampoline.c | 32 1 file changed, 32 insertions(+) diff --git a/kernel/bpf/trampoline.c b/kernel/bpf/trampoline.c index 1f3a4be4b175.

Re: [PATCH bpf-next 2/3] libbpf: skip BTF fixup if object file has no BTF

2021-03-19 Thread Jiri Olsa
On Fri, Mar 19, 2021 at 01:59:08PM -0700, Andrii Nakryiko wrote: > Skip BTF fixup step when input object file is missing BTF altogether. > > Reported-by: Jiri Olsa > Fixes: 8fd27bf69b86 ("libbpf: Add BPF static linker BTF and BTF.ext support") > Signed-off-by: Andrii N

Re: [PATCH v4 bpf-next 07/12] libbpf: add BPF static linker BTF and BTF.ext support

2021-03-19 Thread Jiri Olsa
On Fri, Mar 19, 2021 at 11:39:01AM -0700, Andrii Nakryiko wrote: > On Fri, Mar 19, 2021 at 9:23 AM Jiri Olsa wrote: > > > > On Thu, Mar 18, 2021 at 12:40:31PM -0700, Andrii Nakryiko wrote: > > > > SNIP > > > > > + > > > + return NULL; > &g

Re: [PATCH v4 bpf-next 07/12] libbpf: add BPF static linker BTF and BTF.ext support

2021-03-19 Thread Jiri Olsa
On Thu, Mar 18, 2021 at 12:40:31PM -0700, Andrii Nakryiko wrote: SNIP > + > + return NULL; > +} > + > +static int linker_fixup_btf(struct src_obj *obj) > +{ > + const char *sec_name; > + struct src_sec *sec; > + int i, j, n, m; > + > + n = btf__get_nr_types(obj->btf); hi, I'm

Re: [PATCH bpf-next 1/4] tools/resolve_btfids: Build libbpf and libsubcmd in separate directories

2021-03-10 Thread Jiri Olsa
er objects and we don't get them mixed > > > in the future. > > > > > > It also simplifies cleaning, which is now simple rm -rf. > > > > > > Also there's no need for FEATURE-DUMP.libbpf and bpf_helper_defs.h > > > files in .gitignore anymo

Re: [PATCHv2 bpf-next] selftests/bpf: Fix test_attach_probe for powerpc uprobes

2021-03-07 Thread Jiri Olsa
On Sat, Mar 06, 2021 at 07:13:17PM -0800, Andrii Nakryiko wrote: > On Fri, Mar 5, 2021 at 5:42 AM Jiri Olsa wrote: > > > > When testing uprobes we the test gets GEP (Global Entry Point) > > address from kallsyms, but then the function is called locally > > so

[PATCHv2 bpf-next] selftests/bpf: Fix test_attach_probe for powerpc uprobes

2021-03-05 Thread Jiri Olsa
function pointed out and explained by Michael and Naveen. Cc: Michael Ellerman Cc: Naveen N. Rao Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/attach_probe.c | 40 ++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/prog_tests

Re: [PATCH bpf-next] selftests/bpf: Fix test_attach_probe for powerpc uprobes

2021-03-05 Thread Jiri Olsa
On Thu, Mar 04, 2021 at 07:04:59AM +0530, Naveen N. Rao wrote: SNIP > > > static inline unsigned long ppc_function_entry(void *func) > > > { > > > #ifdef PPC64_ELF_ABI_v2 > > > u32 *insn = func; > > > > > > /* > > >* A PPC64 ABIv2 function may have a local and a global entry > > >* p

[BUG] hitting bug when running spinlock test

2021-03-04 Thread Jiri Olsa
hi, I'm getting attached BUG/crash when running in parralel selftests, like: while :; do ./test_progs -t spinlock; done while :; do ./test_progs ; done it's the latest bpf-next/master, I can send the .config if needed, but I don't think there's anything special about it, because I saw the bug

Re: [PATCH bpf-next] selftests/bpf: Fix test_attach_probe for powerpc uprobes

2021-03-04 Thread Jiri Olsa
On Thu, Mar 04, 2021 at 11:46:27AM +1100, Michael Ellerman wrote: > "Naveen N. Rao" writes: > > On 2021/03/02 11:35AM, Jiri Olsa wrote: > >> On Mon, Mar 01, 2021 at 02:58:53PM -0800, Yonghong Song wrote: > >> > > >> > > >> > On 3/

Re: [PATCH bpf-next] selftests/bpf: Fix test_attach_probe for powerpc uprobes

2021-03-03 Thread Jiri Olsa
On Wed, Mar 03, 2021 at 12:10:43PM +0530, Naveen N. Rao wrote: > On 2021/03/02 11:35AM, Jiri Olsa wrote: > > On Mon, Mar 01, 2021 at 02:58:53PM -0800, Yonghong Song wrote: > > > > > > > > > On 3/1/21 11:04 AM, Jiri Olsa wrote: > > > > When testing

Re: [PATCH bpf-next] selftests/bpf: Fix test_attach_probe for powerpc uprobes

2021-03-02 Thread Jiri Olsa
On Tue, Mar 02, 2021 at 10:31:41AM -0800, Andrii Nakryiko wrote: > On Tue, Mar 2, 2021 at 3:14 AM Jiri Olsa wrote: > > > > On Mon, Mar 01, 2021 at 04:34:24PM -0800, Andrii Nakryiko wrote: > > > On Mon, Mar 1, 2021 at 11:11 AM Jiri Olsa wrote: > > > > > >

Re: [PATCH bpf-next] selftests/bpf: Fix test_attach_probe for powerpc uprobes

2021-03-02 Thread Jiri Olsa
On Mon, Mar 01, 2021 at 04:34:24PM -0800, Andrii Nakryiko wrote: > On Mon, Mar 1, 2021 at 11:11 AM Jiri Olsa wrote: > > > > When testing uprobes we the test gets GEP (Global Entry Point) > > address from kallsyms, but then the function is called locally > > so

Re: [PATCH bpf-next] selftests/bpf: Fix test_attach_probe for powerpc uprobes

2021-03-02 Thread Jiri Olsa
On Mon, Mar 01, 2021 at 02:58:53PM -0800, Yonghong Song wrote: > > > On 3/1/21 11:04 AM, Jiri Olsa wrote: > > When testing uprobes we the test gets GEP (Global Entry Point) > > address from kallsyms, but then the function is called locally > > so the uprobe is not trig

[PATCH bpf-next] selftests/bpf: Fix test_attach_probe for powerpc uprobes

2021-03-01 Thread Jiri Olsa
When testing uprobes we the test gets GEP (Global Entry Point) address from kallsyms, but then the function is called locally so the uprobe is not triggered. Fixing this by adjusting the address to LEP (Local Entry Point) for powerpc arch. Signed-off-by: Jiri Olsa --- .../selftests/bpf

Re: [RFC] dwarves/pahole: Add test scripts

2021-02-25 Thread Jiri Olsa
On Wed, Feb 24, 2021 at 10:30:45AM -0700, Nathan Chancellor wrote: SNIP > > + > > +build() > > +{ > > + local name=$1 > > + local opts=$2 > > A more robust way to handle this might be > > shift > local opts=$@ > > > + > > + echo "build ${name} (${OUTPUT}/output)" > > + > > + mkdir -p $

[RFC] dwarves/pahole: Add test scripts

2021-02-23 Thread Jiri Olsa
hi, I cleaned up a bit my testing scripts, that I'm using for testing btf encoding changes. It's far from ideal and convoluted, but let's have discussion if this could be kicked into something useful for everybody. There are 2 scripts: kernel-objects-build.sh - compiles kernel for several archs

[PATCHv2] btf_encoder: Match ftrace addresses within elf functions

2021-02-13 Thread Jiri Olsa
count the whole function not just the entrypoint. Most of the is_ftrace_func code was contributed by Andrii. [1] https://lore.kernel.org/bpf/20210209034416.GA1669105@ubuntu-m3-large-x86/ Acked-by: Andrii Nakryiko Signed-off-by: Jiri Olsa --- v2 changes: - update functions addr directly [A

Re: [PATCH] btf_encoder: Match ftrace addresses within elf functions

2021-02-13 Thread Jiri Olsa
On Fri, Feb 12, 2021 at 02:21:04PM -0800, Andrii Nakryiko wrote: > On Fri, Feb 12, 2021 at 2:05 PM Jiri Olsa wrote: > > > > Currently when processing DWARF function, we check its entrypoint > > against ftrace addresses, assuming that the ftrace address matches > >

[PATCH] btf_encoder: Match ftrace addresses within elf functions

2021-02-12 Thread Jiri Olsa
count the whole function not just the entrypoint. Most of the is_ftrace_func code was contributed by Andrii. [1] https://lore.kernel.org/bpf/20210209034416.GA1669105@ubuntu-m3-large-x86/ Signed-off-by: Jiri Olsa --- btf_encoder.c | 55 +-- 1

Re: FAILED unresolved symbol vfs_truncate on arm64 with LLVM

2021-02-12 Thread Jiri Olsa
On Fri, Feb 12, 2021 at 11:22:41AM -0800, Andrii Nakryiko wrote: SNIP > > +static int is_ftrace_func(struct elf_function *func, __u64 *addrs, > > + __u64 count, bool kmod) > > +{ > > + /* > > +* For vmlinux image both addrs[x] and functions[x]::addr > > +

Re: [PATCH bpf-next] tools/resolve_btfids: add /libbpf to .gitignore

2021-02-12 Thread Jiri Olsa
On Fri, Feb 12, 2021 at 11:48:46AM -0800, Andrii Nakryiko wrote: > On Thu, Feb 11, 2021 at 5:07 PM Stanislav Fomichev wrote: > > > > There is what I see after compiling the kernel: > > typo: This? > > > > > # bpf-next...bpf-next/master > > ?? tools/bpf/resolve_btfids/libbpf/ > > > > Signed-off

Re: [PATCH bpf-next] tools/resolve_btfids: add /libbpf to .gitignore

2021-02-12 Thread Jiri Olsa
On Fri, Feb 12, 2021 at 11:56:29AM -0800, Stanislav Fomichev wrote: > On Fri, Feb 12, 2021 at 11:48 AM Andrii Nakryiko > wrote: > > > > On Thu, Feb 11, 2021 at 5:07 PM Stanislav Fomichev wrote: > > > > > > There is what I see after compiling the kernel: > > > > typo: This? > Yes, sure. > > > >

Re: FAILED unresolved symbol vfs_truncate on arm64 with LLVM

2021-02-12 Thread Jiri Olsa
On Thu, Feb 11, 2021 at 11:59:02AM -0800, Andrii Nakryiko wrote: SNIP > > So in my previous example I assumed we have address ranges for ftrace > section, which is exactly the opposite from what we have. So this > binary search should be a bit different. start <= addr seems wrong > here as well.

Re: [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target

2021-02-12 Thread Jiri Olsa
On Fri, Feb 12, 2021 at 12:30:45PM +0900, Masahiro Yamada wrote: SNIP > > I expected this kind of mess > when I saw 33a57ce0a54d498275f432db04850001175dfdfa > > > The tools/ directory is a completely different world > governed by a different build system > (no, not a build system, but a collec

Re: FAILED unresolved symbol vfs_truncate on arm64 with LLVM

2021-02-11 Thread Jiri Olsa
On Thu, Feb 11, 2021 at 11:59:02AM -0800, Andrii Nakryiko wrote: SNIP > > return strcmp(a->name, b->name); > > } > > > > +static int functions_cmp_addr(const void *_a, const void *_b) > > +{ > > + const struct elf_function *a = _a; > > + const struct elf_function *b = _b; > >

Re: FAILED unresolved symbol vfs_truncate on arm64 with LLVM

2021-02-11 Thread Jiri Olsa
On Thu, Feb 11, 2021 at 04:43:48PM +0100, Sedat Dilek wrote: SNIP > > > filled with elf functions start/end values, right? > > > > > > > /* > > > > * We iterate over sorted array, so we can > > > > easily skip > > > > * no

Re: FAILED unresolved symbol vfs_truncate on arm64 with LLVM

2021-02-11 Thread Jiri Olsa
On Wed, Feb 10, 2021 at 09:13:47PM +0100, Jiri Olsa wrote: > On Wed, Feb 10, 2021 at 10:20:20AM -0800, Andrii Nakryiko wrote: > > SNIP > > > > but below is change for checking that ftrace addrs are within elf > > > functions > > > > > > seems t

[PATCH bpf-next] kbuild: Do not clean resolve_btfids if the output does not exist

2021-02-11 Thread Jiri Olsa
around the resolve_btfids clean target to ensure the output directory is in place. Tested-by: Nathan Chancellor Signed-off-by: Jiri Olsa --- Makefile | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 159d9592b587..b6fa039c18b8 100644 --- a

Re: [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target

2021-02-11 Thread Jiri Olsa
On Wed, Feb 10, 2021 at 11:26:28AM -0800, Andrii Nakryiko wrote: SNIP > > > > Can't reproduce it. It works in all kinds of variants (relative and > > > > absolute O=, clean and not clean trees, etc). Jiri, please check as > > > > well. > > > > > > > > > > Odd, this reproduces for me on a complete

Re: FAILED unresolved symbol vfs_truncate on arm64 with LLVM

2021-02-10 Thread Jiri Olsa
On Wed, Feb 10, 2021 at 10:20:20AM -0800, Andrii Nakryiko wrote: SNIP > > but below is change for checking that ftrace addrs are within elf functions > > > > seems to work in my tests, I'll run some more tests and send full patch > > It seems unnecessarily convoluted. I was thinking about someth

  1   2   3   4   5   6   7   >