Re: [PATCH] kbuild: Require pahole >v1.29 with GENDWARFKSYMS and BTF on X86

2025-04-10 Thread Alan Maguire
On 07/04/2025 09:25, Sam James wrote: > [with regard to > https://lore.kernel.org/linux-kbuild/20250320232757.2283956-2-samitolva...@google.com/] > > Would it be possible to have a new release with that fix, to avoid > distros all having to cherrypick the fix commit? > > Thanks in advance, > sam

Re: [PATCH v2 1/4] ftrace: Add print_function_args()

2025-01-08 Thread Alan Maguire
On 08/01/2025 15:24, Steven Rostedt wrote: > On Wed, 8 Jan 2025 11:19:11 + > Alan Maguire wrote: > >>>>> + trace_seq_printf(s, "("); >>>>> + >>>>> + if (!args) >>>>> + goto out; &

Re: [PATCH v2 1/4] ftrace: Add print_function_args()

2025-01-08 Thread Alan Maguire
On 08/01/2025 04:52, Masami Hiramatsu (Google) wrote: > On Wed, 8 Jan 2025 10:30:08 +0800 > Donglin Peng wrote: > >> Steven Rostedt 于2024年12月24日 周二04:14写道: >> >>> From: Sven Schnelle >>> >>> Add a function to decode argument types with the help of BTF. Will >>> be used to display arguments in th

Re: [PATCH bpf-next v2] bpf: handle implicit declaration of function gettid in bpf_iter.c

2024-10-29 Thread Alan Maguire
el->bss->tid = gettid(); >^~ >getgid > > Directly call the syscall solves this issue. > > Signed-off-by: Jason Xing Reviewed-by: Alan Maguire Tested-by: Alan Maguire > --- > v2 > Link: > https://lore.kernel.org/all/202410

Re: [PATCH bpf-next 2/4] selftests/bpf: convert test_cgroup_storage to test_progs

2024-08-06 Thread Alan Maguire
On 01/08/2024 10:21, Alexis Lothoré wrote: > On 8/1/24 10:27, Alan Maguire wrote: >> On 31/07/2024 11:38, Alexis Lothoré (eBPF Foundation) wrote: >>> test_cgroup_storage is currently a standalone program which is not run >>> when executing test_progs. >>> >&g

Re: [PATCH bpf-next 3/4] selftests/bpf: add proper section name to bpf prog and rename it

2024-08-06 Thread Alan Maguire
On 01/08/2024 11:00, Alexis Lothoré wrote: > On 8/1/24 10:35, Alan Maguire wrote: >> On 31/07/2024 11:38, Alexis Lothoré (eBPF Foundation) wrote: >>> test_skb_cgroup_id_kern.c is currently involved in a manual test. In its >>> current form, it can not be used with the a

Re: [PATCH bpf-next 4/4] selftests/bpf: convert test_skb_cgroup_id_user to test_progs

2024-08-06 Thread Alan Maguire
On 01/08/2024 11:12, Alexis Lothoré wrote: > On 8/1/24 10:49, Alan Maguire wrote: >> On 31/07/2024 11:38, Alexis Lothoré (eBPF Foundation) wrote: > > [...] > >>> +static int wait_local_ip(void) >>> +{ >>> + char *ping_cmd = ping_command(AF_INET6);

Re: [PATCH bpf-next 4/4] selftests/bpf: convert test_skb_cgroup_id_user to test_progs

2024-08-01 Thread Alan Maguire
On 31/07/2024 11:38, Alexis Lothoré (eBPF Foundation) wrote: > test_skb_cgroup_id_user allows testing skb cgroup id retrieval at different > levels, but is not integrated in test_progs, so it is not run > automatically in CI. The test overlaps a bit with > cgroup_skb_sk_lookup_kern, which is integr

Re: [PATCH bpf-next 3/4] selftests/bpf: add proper section name to bpf prog and rename it

2024-08-01 Thread Alan Maguire
o test_progs > - update the obj name > - fix loading issue (verifier rejecting the program when loaded through tc, > because of map not found), by preloading the whole obj with bpftool > > Signed-off-by: Alexis Lothoré (eBPF Foundation) Reviewed-by: Alan Maguire >

Re: [PATCH bpf-next 2/4] selftests/bpf: convert test_cgroup_storage to test_progs

2024-08-01 Thread Alan Maguire
ropped. > > Signed-off-by: Alexis Lothoré (eBPF Foundation) Two small things below, but Reviewed-by: Alan Maguire > --- > Tested in a local qemu environment: > > ./test_progs -a cgroup_storage > 53 cgroup_storage:OK > Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED

Re: [PATCH bpf-next 1/4] selftests/bpf: convert get_current_cgroup_id_user to test_progs

2024-08-01 Thread Alan Maguire
On 31/07/2024 19:53, Alexis Lothoré wrote: > Hello Alan, > > On 7/31/24 19:23, Alan Maguire wrote: >> On 31/07/2024 11:38, Alexis Lothoré (eBPF Foundation) wrote: > > [...] > >>> + pid = getpid(); >>> + if (!ASSERT_OK(bp

Re: [PATCH bpf-next 1/4] selftests/bpf: convert get_current_cgroup_id_user to test_progs

2024-07-31 Thread Alan Maguire
On 31/07/2024 11:38, Alexis Lothoré (eBPF Foundation) wrote: > get_current_cgroup_id_user allows testing for bpf_get_current_cgroup_id() > bpf API but is not integrated into test_progs, and so is not tested > automatically in CI. > > Convert it to the test_progs framework to allow running it autom

Re: [PATCH bpf-next v3 1/3] selftests/bpf: do not disable /dev/null device access in cgroup dev test

2024-07-30 Thread Alan Maguire
nipulates > extensively /dev/null. > > Allow /dev/null manipulation in dev_cgroup program to make its usage in > test_progs framework possible. Update test_dev_cgroup.c as well to match > this change while it has not been removed. > > Signed-off-by: Alexis Lothoré (eBPF Foundatio

Re: [PATCH bpf-next v2 1/3] selftests/bpf: do not disable /dev/null device access in cgroup dev test

2024-07-30 Thread Alan Maguire
On 29/07/2024 18:30, Alexis Lothoré wrote: > Hello Alan, > > On 7/29/24 18:59, Alan Maguire wrote: >> On 29/07/2024 09:20, Alexis Lothoré (eBPF Foundation) wrote: >>> test_dev_cgroup currently loads a small bpf program allowing any access on >>> urandom and zero

Re: [PATCH bpf-next v2 2/3] selftests/bpf: convert test_dev_cgroup to test_progs

2024-07-29 Thread Alan Maguire
On 29/07/2024 18:47, Alexis Lothoré wrote: > Hello Alan, thanks for the review > > On 7/29/24 19:29, Alan Maguire wrote: >> On 29/07/2024 09:20, Alexis Lothoré (eBPF Foundation) wrote: >>> test_dev_cgroup is defined as a standalone test program, and so is not >>>

Re: [PATCH bpf-next v2 3/3] selftests/bpf: add wrong type test to cgroup dev

2024-07-29 Thread Alan Maguire
that the device type passed to bpf program > allows it to take decisions as well. > > Signed-off-by: Alexis Lothoré (eBPF Foundation) Reviewed-by: Alan Maguire > --- > Changes in v2: > - change test name ("null" block device does not make sense) > - use updated s

Re: [PATCH bpf-next v2 2/3] selftests/bpf: convert test_dev_cgroup to test_progs

2024-07-29 Thread Alan Maguire
le to run it in test_progs, /dev/null > must remain usable, so change the new test to test operations on devices > 1:3 as valid, and operations on devices 1:5 (/dev/zero) as invalid. > > Signed-off-by: Alexis Lothoré (eBPF Foundation) A few small suggestions but looks great! Reviewed-by: Ala

Re: [PATCH bpf-next v2 1/3] selftests/bpf: do not disable /dev/null device access in cgroup dev test

2024-07-29 Thread Alan Maguire
On 29/07/2024 09:20, Alexis Lothoré (eBPF Foundation) wrote: > test_dev_cgroup currently loads a small bpf program allowing any access on > urandom and zero devices, disabling access to any other device. It makes > migrating this test to test_progs impossible, since this one manipulates > extensive

Bug#1076564: pahole BTF processing seems flaky on powerpc

2024-07-24 Thread Alan Maguire
On 19/07/2024 20:13, Arnaldo Carvalho de Melo wrote: > Adding Alan and Jiri to the CC list. > I'm late chiming in on this one, but judging by the output: BTF .btf.vmlinux.bin.o + LLVM_OBJCOPY=powerpc-linux-gnu-objcopy pahole -J -j --btf_features=encode_force,var,float,enum64,decl_tag,type_t

Re: [PATCH bpf-next 3/3] selftests/bpf: Close obj in error paths in xdp_adjust_tail

2024-07-10 Thread Alan Maguire
On 09/07/2024 11:45, Geliang Tang wrote: > From: Geliang Tang > > If bpf_object__load() fails in test_xdp_adjust_frags_tail_grow(), "obj" > opened before this should be closed. So use "goto out" to close it instead > of using "return" here. > &

Re: [PATCH bpf-next 2/3] selftests/bpf: Check ASSERT_OK(err) in dummy_st_ops

2024-07-10 Thread Alan Maguire
e is not implemented on Loongarch yet, > bpf_prog_test_run_opts() returns ENOTSUPP. > > This patch checks the return values of bpf_prog_test_run_opts() in > dummy_st_ops to fix these errors. If error returned, goto the newly > added label "out" to destroy the skel. > > Signed-

Re: [PATCH bpf-next 1/3] selftests/bpf: Null checks for links in bpf_tcp_ca

2024-07-10 Thread Alan Maguire
t; returned by bpf_map__attach_struct_ops() is NULL. test_progs > crashs when this NULL link passes to bpf_link__update_map(). This > patch adds NULL checks for all links in bpf_tcp_ca to fix these errors. > If "link" is NULL, goto the newly added label "out" to d

Re: [PATCH] bpf/btf: Move tracing BTF APIs to the BTF library

2023-10-11 Thread Alan Maguire
would be good to confirm. > Signed-off-by: Masami Hiramatsu (Google) Reviewed-by: Alan Maguire > --- > include/linux/btf.h| 24 + > kernel/bpf/btf.c | 115 +

Re: [PATCH 0/4] tracing: improve symbolic printing

2023-10-04 Thread Alan Maguire
On 04/10/2023 22:43, Steven Rostedt wrote: > On Wed, 4 Oct 2023 22:35:07 +0100 > Alan Maguire wrote: > >> One thing we've heard from some embedded folks [1] is that having >> kernel BTF loadable as a separate module (rather than embedded in >> vmlinux) would h

Re: [PATCH 0/4] tracing: improve symbolic printing

2023-10-04 Thread Alan Maguire
On 04/10/2023 18:29, Steven Rostedt wrote: > On Wed, 4 Oct 2023 09:54:31 -0700 > Jakub Kicinski wrote: > >> On Wed, 4 Oct 2023 12:35:24 -0400 Steven Rostedt wrote: Potentially naive question - the trace point holds enum skb_drop_reason. The user space can get the names from BTF. Can we

Re: [PATCH v3 1/2] kunit: support failure from dynamic analysis tools

2021-02-11 Thread Alan Maguire
On Thu, 11 Feb 2021, David Gow wrote: > On Wed, Feb 10, 2021 at 6:14 AM Daniel Latypov wrote: > > > > From: Uriel Guajardo > > > > Add a kunit_fail_current_test() function to fail the currently running > > test, if any, with an error message. > > > > This is largely intended for dynamic analysis

Re: [PATCH v3 0/2] kunit: fail tests on UBSAN errors

2021-02-10 Thread Alan Maguire
s://lore.kernel.org/linux-kselftest/20200806174326.3577537-1-urielguajard...@gmail.com/ > For the series: Reviewed-by: Alan Maguire Thanks!

Re: [PATCH v2 1/2] kunit: support failure from dynamic analysis tools

2021-02-09 Thread Alan Maguire
On Tue, 9 Feb 2021, Daniel Latypov wrote: > On Tue, Feb 9, 2021 at 9:26 AM Alan Maguire wrote: > > > > On Fri, 5 Feb 2021, Daniel Latypov wrote: > > > > > From: Uriel Guajardo > > > > > > Add a kunit_fail_current_test() function to fail the cur

Re: [PATCH v2 1/2] kunit: support failure from dynamic analysis tools

2021-02-09 Thread Alan Maguire
On Fri, 5 Feb 2021, Daniel Latypov wrote: > From: Uriel Guajardo > > Add a kunit_fail_current_test() function to fail the currently running > test, if any, with an error message. > > This is largely intended for dynamic analysis tools like UBSAN and for > fakes. > E.g. say I had a fake ops stru

Re: [PATCH v2 bpf-next 3/4] libbpf: BTF dumper support for typed data

2021-01-22 Thread Alan Maguire
On Thu, 21 Jan 2021, Andrii Nakryiko wrote: > On Wed, Jan 20, 2021 at 10:56 PM Andrii Nakryiko > wrote: > > > > On Sun, Jan 17, 2021 at 2:22 PM Alan Maguire > > wrote: > > > > > > Add a BTF dumper for typed data, so that the user can dump

Re: [PATCH v2 bpf-next 3/4] libbpf: BTF dumper support for typed data

2021-01-22 Thread Alan Maguire
On Thu, 21 Jan 2021, Andrii Nakryiko wrote: > On Wed, Jan 20, 2021 at 10:56 PM Andrii Nakryiko > wrote: > > > > On Sun, Jan 17, 2021 at 2:22 PM Alan Maguire > > wrote: > > > > > > Add a BTF dumper for typed data, so that the user can dump

[PATCH v2 bpf-next 1/4] libbpf: add btf_has_size() and btf_int() inlines

2021-01-17 Thread Alan Maguire
BTF type data dumping will use them in later patches, and they are useful generally when handling BTF data. Signed-off-by: Alan Maguire --- tools/lib/bpf/btf.h | 19 +++ 1 file changed, 19 insertions(+) diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h index 1237bcd

[PATCH v2 bpf-next 1/4] libbpf: add btf_has_size() and btf_int() inlines

2021-01-17 Thread Alan Maguire
BTF type data dumping will use them in later patches, and they are useful generally when handling BTF data. Signed-off-by: Alan Maguire --- tools/lib/bpf/btf.h | 19 +++ 1 file changed, 19 insertions(+) diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h index 1237bcd

[PATCH v2 bpf-next 3/4] libbpf: BTF dumper support for typed data

2021-01-17 Thread Alan Maguire
6744073709551615, }, }, ... Signed-off-by: Alan Maguire --- tools/lib/bpf/btf.h | 17 + tools/lib/bpf/btf_dump.c | 974 +++ tools/lib/bpf/libbpf.map | 5 + 3 files changed, 996 insertions(+) diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/b

[PATCH v2 bpf-next 3/4] libbpf: BTF dumper support for typed data

2021-01-17 Thread Alan Maguire
6744073709551615, }, }, ... Signed-off-by: Alan Maguire --- tools/lib/bpf/btf.h | 17 + tools/lib/bpf/btf_dump.c | 974 +++ tools/lib/bpf/libbpf.map | 5 + 3 files changed, 996 insertions(+) diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/b

[PATCH v2 bpf-next 0/4] libbpf: BTF dumper support for typed data

2021-01-17 Thread Alan Maguire
ound in it should be fixed there or vice versa; mirroring the tests should help with this also (Andrii) [1] https://lore.kernel.org/bpf/1610386373-24162-1-git-send-email-alan.magu...@oracle.com/T/#t Alan Maguire (4): libbpf: add btf_has_size() and btf_int() inlines libbpf: make skip_mods_an

[PATCH v2 bpf-next 4/4] selftests/bpf: add dump type data tests to btf dump tests

2021-01-17 Thread Alan Maguire
Test various type data dumping operations by comparing expected format with the dumped string; an snprintf-style printf function is used to record the string dumped. Signed-off-by: Alan Maguire --- tools/testing/selftests/bpf/prog_tests/btf_dump.c | 233 ++ 1 file changed

[PATCH v2 bpf-next 4/4] selftests/bpf: add dump type data tests to btf dump tests

2021-01-17 Thread Alan Maguire
Test various type data dumping operations by comparing expected format with the dumped string; an snprintf-style printf function is used to record the string dumped. Signed-off-by: Alan Maguire --- tools/testing/selftests/bpf/prog_tests/btf_dump.c | 233 ++ 1 file changed

[PATCH v2 bpf-next 2/4] libbpf: make skip_mods_and_typedefs available internally in libbpf

2021-01-17 Thread Alan Maguire
btf_dump.c will need it for type-based data display. Signed-off-by: Alan Maguire --- tools/lib/bpf/libbpf.c | 4 +--- tools/lib/bpf/libbpf_internal.h | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 2abbc38

[PATCH v2 bpf-next 2/4] libbpf: make skip_mods_and_typedefs available internally in libbpf

2021-01-17 Thread Alan Maguire
btf_dump.c will need it for type-based data display. Signed-off-by: Alan Maguire --- tools/lib/bpf/libbpf.c | 4 +--- tools/lib/bpf/libbpf_internal.h | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 2abbc38

[PATCH v2 bpf-next 0/4] libbpf: BTF dumper support for typed data

2021-01-17 Thread Alan Maguire
ound in it should be fixed there or vice versa; mirroring the tests should help with this also (Andrii) [1] https://lore.kernel.org/bpf/1610386373-24162-1-git-send-email-alan.magu...@oracle.com/T/#t Alan Maguire (4): libbpf: add btf_has_size() and btf_int() inlines libbpf: make skip_mods_an

Re: [RFC PATCH bpf-next 1/2] bpf: share BTF "show" implementation between kernel and libbpf

2021-01-14 Thread Alan Maguire
On Mon, 11 Jan 2021, Andrii Nakryiko wrote: > On Mon, Jan 11, 2021 at 9:34 AM Alan Maguire wrote: > > Currently the only "show" function for userspace is to write the > > representation of the typed data to a string via > > > > LIBBPF_API int > > btf__s

Re: [RFC PATCH bpf-next 1/2] bpf: share BTF "show" implementation between kernel and libbpf

2021-01-14 Thread Alan Maguire
On Mon, 11 Jan 2021, Andrii Nakryiko wrote: > On Mon, Jan 11, 2021 at 9:34 AM Alan Maguire wrote: > > Currently the only "show" function for userspace is to write the > > representation of the typed data to a string via > > > > LIBBPF_API int > > btf__s

[RFC PATCH bpf-next 1/2] bpf: share BTF "show" implementation between kernel and libbpf

2021-01-11 Thread Alan Maguire
d\n", skb_id); else btf__snprintf(btf, buf, sizeof(buf), skb_id, skb, 0); Suggested-by: Alexei Starovoitov Signed-off-by: Alan Maguire --- include/linux/btf.h | 121 +--- include/linux/btf_common.h | 286 + kernel/bpf/Makefile |2 +

[RFC PATCH bpf-next 1/2] bpf: share BTF "show" implementation between kernel and libbpf

2021-01-11 Thread Alan Maguire
d\n", skb_id); else btf__snprintf(btf, buf, sizeof(buf), skb_id, skb, 0); Suggested-by: Alexei Starovoitov Signed-off-by: Alan Maguire --- include/linux/btf.h | 121 +--- include/linux/btf_common.h | 286 + kernel/bpf/Makefile |2 +

[RFC PATCH bpf-next 2/2] selftests/bpf: test libbpf-based type display

2021-01-11 Thread Alan Maguire
Test btf__snprintf with various base/kernel types and ensure display is as expected; tests are identical to those in snprintf_btf test save for the fact these run in userspace rather than BPF program context. Signed-off-by: Alan Maguire --- .../selftests/bpf/prog_tests/snprintf_btf_user.c

[RFC PATCH bpf-next 2/2] selftests/bpf: test libbpf-based type display

2021-01-11 Thread Alan Maguire
Test btf__snprintf with various base/kernel types and ensure display is as expected; tests are identical to those in snprintf_btf test save for the fact these run in userspace rather than BPF program context. Signed-off-by: Alan Maguire --- .../selftests/bpf/prog_tests/snprintf_btf_user.c

[RFC PATCH bpf-next 0/2] bpf, libbpf: share BTF data show functionality

2021-01-11 Thread Alan Maguire
format. The test closely mirrors the BPF program associated with the snprintf_btf.c; in this case however the string representations are verified in userspace rather than in BPF program context. Alan Maguire (2): bpf: share BTF "show" implementation between kernel and libbpf selftests

[RFC PATCH bpf-next 0/2] bpf, libbpf: share BTF data show functionality

2021-01-11 Thread Alan Maguire
format. The test closely mirrors the BPF program associated with the snprintf_btf.c; in this case however the string representations are verified in userspace rather than in BPF program context. Alan Maguire (2): bpf: share BTF "show" implementation between kernel and libbpf selftests

[PATCH bpf] bpftool: fix compilation failure for net.o with older glibc

2021-01-06 Thread Alan Maguire
needed for compilation anyhow. [1] https://lore.kernel.org/netdev/1461512707-23058-1-git-send-email-mikko.rapeli__34748.27880641$1462831734$gmane$o...@iki.fi/ Fixes: f6f3bac08ff9 ("tools/bpf: bpftool: add net support") Signed-off-by: Alan Maguire --- tools/bpf/bpftool/net.c | 1

[PATCH bpf] bpftool: fix compilation failure for net.o with older glibc

2021-01-06 Thread Alan Maguire
needed for compilation anyhow. [1] https://lore.kernel.org/netdev/1461512707-23058-1-git-send-email-mikko.rapeli__34748.27880641$1462831734$gmane$o...@iki.fi/ Fixes: f6f3bac08ff9 ("tools/bpf: bpftool: add net support") Signed-off-by: Alan Maguire --- tools/bpf/bpftool/net.c | 1

Re: [RFC PATCH bpf-next] ksnoop: kernel argument/return value tracing/display using BTF

2021-01-05 Thread Alan Maguire
On Tue, 5 Jan 2021, Cong Wang wrote: > On Mon, Jan 4, 2021 at 7:29 AM Alan Maguire wrote: > > > > BPF Type Format (BTF) provides a description of kernel data structures > > and of the types kernel functions utilize as arguments and return values. > > >

Re: [RFC PATCH bpf-next] ksnoop: kernel argument/return value tracing/display using BTF

2021-01-05 Thread Alan Maguire
On Tue, 5 Jan 2021, Cong Wang wrote: > On Mon, Jan 4, 2021 at 7:29 AM Alan Maguire wrote: > > > > BPF Type Format (BTF) provides a description of kernel data structures > > and of the types kernel functions utilize as arguments and return values. > > >

[RFC PATCH bpf-next] ksnoop: kernel argument/return value tracing/display using BTF

2021-01-04 Thread Alan Maguire
edicate, e.g. ksnoop "ip_send_skb(skb->dev == 0, skb)" ...as this will be evaluated before the skb is stringified, and we potentially avoid that operation if the predicate fails. The same is _not_ true however in the stash case; for ksnoop "ip_send_skb(skb, return!=0)"

[RFC PATCH bpf-next] ksnoop: kernel argument/return value tracing/display using BTF

2021-01-04 Thread Alan Maguire
edicate, e.g. ksnoop "ip_send_skb(skb->dev == 0, skb)" ...as this will be evaluated before the skb is stringified, and we potentially avoid that operation if the predicate fails. The same is _not_ true however in the stash case; for ksnoop "ip_send_skb(skb, return!=0)"

Re: one prog multi fentry. Was: [PATCH bpf-next] libbpf: support module BTF for BPF_TYPE_ID_TARGET CO-RE relocation

2020-12-17 Thread Alan Maguire
On Wed, 16 Dec 2020, Alexei Starovoitov wrote: > > > $ ksnoop "ip_send_skb(skb->sk)" > > > > > > ...will trace the skb->sk value. The user-space side of the program > > > matches the function/arg name and looks up the referenced type, setting it > > > in the function's map. For field referenc

Re: one prog multi fentry. Was: [PATCH bpf-next] libbpf: support module BTF for BPF_TYPE_ID_TARGET CO-RE relocation

2020-12-16 Thread Alan Maguire
On Tue, 15 Dec 2020, Alexei Starovoitov wrote: > On Wed, Dec 09, 2020 at 11:21:43PM +0000, Alan Maguire wrote: > > Right, that's exactly it. A pair of generic tracing BPF programs are > > used, and they attach to kprobe/kretprobes, and when they run they > > use

Re: [PATCH bpf-next] libbpf: support module BTF for BPF_TYPE_ID_TARGET CO-RE relocation

2020-12-09 Thread Alan Maguire
On Tue, 8 Dec 2020, Alexei Starovoitov wrote: > On Tue, Dec 08, 2020 at 10:13:35PM +0000, Alan Maguire wrote: > > > > Does this approach prevent more complex run-time specification of BTF > > object fd though? For example, I've been working on a simple tracer >

Re: [PATCH v2 bpf-next] libbpf: support module BTF for BPF_TYPE_ID_TARGET CO-RE relocation

2020-12-09 Thread Alan Maguire
->v2: > - fix crash on failing to resolve target spec (Alan). > > Cc: Alan Maguire > Signed-off-by: Andrii Nakryiko Thanks for this! Can confirm the segmentation fault has gone away. I tested with the veth_stats_rx program (though will switch to btf_test module later), and

Re: [PATCH bpf-next] libbpf: support module BTF for BPF_TYPE_ID_TARGET CO-RE relocation

2020-12-08 Thread Alan Maguire
On Mon, 7 Dec 2020, Andrii Nakryiko wrote: > On Mon, Dec 7, 2020 at 7:12 PM Alexei Starovoitov > wrote: > > > > On Mon, Dec 07, 2020 at 04:38:16PM +, Alan Maguire wrote: > > > Sorry about this Andrii, but I'm a bit stuck here. > > > > > > I&

Re: [PATCH bpf-next] libbpf: support module BTF for BPF_TYPE_ID_TARGET CO-RE relocation

2020-12-08 Thread Alan Maguire
On Mon, 7 Dec 2020, Andrii Nakryiko wrote: > On Sat, Dec 5, 2020 at 4:38 PM Alan Maguire wrote: > > Thanks so much for doing this Andrii! When I tested, I ran into a problem; > > it turns out when a module struct such as "veth_stats" is used, it's > > classif

Re: [PATCH bpf-next] libbpf: support module BTF for BPF_TYPE_ID_TARGET CO-RE relocation

2020-12-07 Thread Alan Maguire
t; selftests. Manual testing was performed with debug log messages sprinkled > across selftests and libbpf, confirming expected values are substituted. > Better testing will be performed as part of the work adding module BTF types > support to bpf_snprintf_btf() helpers. > > Cc: Al

Re: [PATCH v2 bpf-next 0/3] bpf: support module BTF in BTF display helpers

2020-12-05 Thread Alan Maguire
On Sat, 5 Dec 2020, Yonghong Song wrote: > > > __builtin_btf_type_id() is really only supported in llvm12 > and 64bit return value support is pushed to llvm12 trunk > a while back. The builtin is introduced in llvm11 but has a > corner bug, so llvm12 is recommended. So if people use the builti

Re: [PATCH v2 bpf-next 0/3] bpf: support module BTF in BTF display helpers

2020-12-05 Thread Alan Maguire
On Sat, 5 Dec 2020, Yonghong Song wrote: > > > __builtin_btf_type_id() is really only supported in llvm12 > and 64bit return value support is pushed to llvm12 trunk > a while back. The builtin is introduced in llvm11 but has a > corner bug, so llvm12 is recommended. So if people use the builti

Re: [PATCH bpf-next] libbpf: support module BTF for BPF_TYPE_ID_TARGET CO-RE relocation

2020-12-05 Thread Alan Maguire
t; selftests. Manual testing was performed with debug log messages sprinkled > across selftests and libbpf, confirming expected values are substituted. > Better testing will be performed as part of the work adding module BTF types > support to bpf_snprintf_btf() helpers. > > Cc: Al

[PATCH v2 bpf-next 1/3] bpf: eliminate btf_module_mutex as RCU synchronization can be used

2020-12-04 Thread Alan Maguire
auditing example in Documentation/RCU/listRCU.rst ; and as such we can eliminate the lock and use list_del_rcu()/call_rcu() on module removal, and list_add_rcu() for module addition. Signed-off-by: Alan Maguire --- kernel/bpf/btf.c | 31 +-- 1 file changed, 17 insertions

[PATCH v2 bpf-next 1/3] bpf: eliminate btf_module_mutex as RCU synchronization can be used

2020-12-04 Thread Alan Maguire
auditing example in Documentation/RCU/listRCU.rst ; and as such we can eliminate the lock and use list_del_rcu()/call_rcu() on module removal, and list_add_rcu() for module addition. Signed-off-by: Alan Maguire --- kernel/bpf/btf.c | 31 +-- 1 file changed, 17 insertions

[PATCH v2 bpf-next 3/3] selftests/bpf: verify module-specific types can be shown via bpf_snprintf_btf

2020-12-04 Thread Alan Maguire
t net_device". Currently the tests take the messy approach of determining object and type ids for the relevant module/function; __builtin_btf_type_id() supports object ids by returning a 64-bit value, but need to find a good way to determine if that support is present. Signed-off-by: Alan M

[PATCH v2 bpf-next 3/3] selftests/bpf: verify module-specific types can be shown via bpf_snprintf_btf

2020-12-04 Thread Alan Maguire
t net_device". Currently the tests take the messy approach of determining object and type ids for the relevant module/function; __builtin_btf_type_id() supports object ids by returning a 64-bit value, but need to find a good way to determine if that support is present. Signed-off-by: Alan M

[PATCH v2 bpf-next 2/3] bpf: add module support to btf display helpers

2020-12-04 Thread Alan Maguire
the object id specifies the module the type is in, or if no such id is found in the module list, we fall back to vmlinux. Signed-off-by: Alan Maguire --- include/linux/btf.h| 12 include/uapi/linux/bpf.h | 13 +++-- kernel/bpf/btf.c

[PATCH v2 bpf-next 2/3] bpf: add module support to btf display helpers

2020-12-04 Thread Alan Maguire
the object id specifies the module the type is in, or if no such id is found in the module list, we fall back to vmlinux. Signed-off-by: Alan Maguire --- include/linux/btf.h| 12 include/uapi/linux/bpf.h | 13 +++-- kernel/bpf/btf.c

[PATCH v2 bpf-next 0/3] bpf: support module BTF in BTF display helpers

2020-12-04 Thread Alan Maguire
likely be supported directly in the BPF program via __builtin_btf_type_id(); but I need to determine a good test to determine if that builtin supports object ids. Changes since RFC - add patch to remove module mutex - modify to use obj_id instead of module name as identifier in "struct btf_ptr&

[PATCH v2 bpf-next 0/3] bpf: support module BTF in BTF display helpers

2020-12-04 Thread Alan Maguire
likely be supported directly in the BPF program via __builtin_btf_type_id(); but I need to determine a good test to determine if that builtin supports object ids. Changes since RFC - add patch to remove module mutex - modify to use obj_id instead of module name as identifier in "struct btf_ptr&

Re: [RFC bpf-next 1/3] bpf: add module support to btf display helpers

2020-11-15 Thread Alan Maguire
On Sat, 14 Nov 2020, Yonghong Song wrote: > > > On 11/14/20 8:04 AM, Alexei Starovoitov wrote: > > On Fri, Nov 13, 2020 at 10:59 PM Andrii Nakryiko > > wrote: > >> > >> On Fri, Nov 13, 2020 at 10:11 AM Alan Maguire > >> wrote: > >>>

Re: [RFC bpf-next 1/3] bpf: add module support to btf display helpers

2020-11-15 Thread Alan Maguire
On Sat, 14 Nov 2020, Yonghong Song wrote: > > > On 11/14/20 8:04 AM, Alexei Starovoitov wrote: > > On Fri, Nov 13, 2020 at 10:59 PM Andrii Nakryiko > > wrote: > >> > >> On Fri, Nov 13, 2020 at 10:11 AM Alan Maguire > >> wrote: > >>>

[PATCH bpf-next] libbpf: bpf__find_by_name[_kind] should use btf__get_nr_types()

2020-11-15 Thread Alan Maguire
lly for vmlinux + module BTF, where the latter is much smaller. Use btf__get_nr_types() instead. Fixes: ba451366bf44 ("libbpf: Implement basic split BTF support") Signed-off-by: Alan Maguire --- tools/lib/bpf/btf.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --gi

[PATCH bpf-next] libbpf: bpf__find_by_name[_kind] should use btf__get_nr_types()

2020-11-15 Thread Alan Maguire
lly for vmlinux + module BTF, where the latter is much smaller. Use btf__get_nr_types() instead. Fixes: ba451366bf44 ("libbpf: Implement basic split BTF support") Signed-off-by: Alan Maguire --- tools/lib/bpf/btf.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --gi

[RFC bpf-next 3/3] selftests/bpf: verify module-specific types can be shown via bpf_snprintf_btf

2020-11-13 Thread Alan Maguire
t_device". Signed-off-by: Alan Maguire --- .../selftests/bpf/prog_tests/snprintf_btf_mod.c| 96 ++ tools/testing/selftests/bpf/progs/btf_ptr.h| 1 + tools/testing/selftests/bpf/progs/veth_stats_rx.c | 73 3 files changed, 170 insertions(+) cr

[RFC bpf-next 1/3] bpf: add module support to btf display helpers

2020-11-13 Thread Alan Maguire
bpf_snprintf_btf and bpf_seq_printf_btf use a "struct btf_ptr *" argument that specifies type information about the type to be displayed. Augment this information to include a module name, allowing such display to support module types. Signed-off-by: Alan Maguire --- include/l

[RFC bpf-next 0/3] bpf: support module BTF in btf display helpers

2020-11-13 Thread Alan Maguire
of a module-specific type id will fail in patch 3. Patch 3 is a selftest that uses veth (when built as a module) and a kprobe to display both a module-specific and kernel-specific type; both are arguments to veth_stats_rx(). Alan Maguire (3): bpf: add module support to btf disp

[RFC bpf-next 1/3] bpf: add module support to btf display helpers

2020-11-13 Thread Alan Maguire
bpf_snprintf_btf and bpf_seq_printf_btf use a "struct btf_ptr *" argument that specifies type information about the type to be displayed. Augment this information to include a module name, allowing such display to support module types. Signed-off-by: Alan Maguire --- include/l

[RFC bpf-next 3/3] selftests/bpf: verify module-specific types can be shown via bpf_snprintf_btf

2020-11-13 Thread Alan Maguire
t_device". Signed-off-by: Alan Maguire --- .../selftests/bpf/prog_tests/snprintf_btf_mod.c| 96 ++ tools/testing/selftests/bpf/progs/btf_ptr.h| 1 + tools/testing/selftests/bpf/progs/veth_stats_rx.c | 73 3 files changed, 170 insertions(+) cr

[RFC bpf-next 2/3] libbpf: bpf__find_by_name[_kind] should use btf__get_nr_types()

2020-11-13 Thread Alan Maguire
lly for vmlinux + module BTF, where the latter is much smaller. Use btf__get_nr_types() instead. Signed-off-by: Alan Maguire --- tools/lib/bpf/btf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c index 2d0d064..0fccf4b 100644 --

[RFC bpf-next 0/3] bpf: support module BTF in btf display helpers

2020-11-13 Thread Alan Maguire
of a module-specific type id will fail in patch 3. Patch 3 is a selftest that uses veth (when built as a module) and a kprobe to display both a module-specific and kernel-specific type; both are arguments to veth_stats_rx(). Alan Maguire (3): bpf: add module support to btf disp

[RFC bpf-next 2/3] libbpf: bpf__find_by_name[_kind] should use btf__get_nr_types()

2020-11-13 Thread Alan Maguire
lly for vmlinux + module BTF, where the latter is much smaller. Use btf__get_nr_types() instead. Signed-off-by: Alan Maguire --- tools/lib/bpf/btf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c index 2d0d064..0fccf4b 100644 --

Re: [PATCH bpf-next 5/5] tools/bpftool: add support for in-kernel and named BTF in `btf show`

2020-11-09 Thread Alan Maguire
to the latest changes etc and BTF generation seemed to work fine for modules during kernel build). For the "bpftool btf show" functionality, feel free to add Tested-by: Alan Maguire Thanks! Alan

Re: [PATCH bpf-next 5/5] tools/bpftool: add support for in-kernel and named BTF in `btf show`

2020-11-09 Thread Alan Maguire
to the latest changes etc and BTF generation seemed to work fine for modules during kernel build). For the "bpftool btf show" functionality, feel free to add Tested-by: Alan Maguire Thanks! Alan

Re: [PATCH bpf-next 00/11] libbpf: split BTF support

2020-10-30 Thread Alan Maguire
On Thu, 29 Oct 2020, Andrii Nakryiko wrote: > On Thu, Oct 29, 2020 at 5:33 PM Song Liu wrote: > > > > > > > > > On Oct 28, 2020, at 5:58 PM, Andrii Nakryiko wrote: > > > > > > This patch set adds support for generating and deduplicating split BTF. > > > This > > > is an enhancement to the BTF,

Re: [PATCH 5.8 574/633] selftests/bpf: Fix overflow tests to reflect iter size increase

2020-10-27 Thread Alan Maguire
On Tue, 27 Oct 2020, Greg Kroah-Hartman wrote: > From: Alan Maguire > > [ Upstream commit eb58bbf2e5c7917aa30bf8818761f26bbeeb2290 ] > > bpf iter size increase to PAGE_SIZE << 3 means overflow tests assuming > page size need to be bumped also. > Alexei can correc

Re: [PATCH bpf-next] selftests/bpf_iter: don't fail test due to missing __builtin_btf_type_id

2020-09-29 Thread Alan Maguire
; still fail. Fix this by also skipping the rest of the parent test if the > skip condition was reached. > > Fixes: b72091bd4ee4 ("selftests/bpf: Add test for bpf_seq_printf_btf helper") > Signed-off-by: Toke Høiland-Jørgensen Reviewed-by: Alan Maguire Thanks for fixing

[PATCH bpf-next 0/2] selftests/bpf: BTF-based kernel data display fixes

2020-09-29 Thread Alan Maguire
Resolve issues in bpf selftests introduced with BTF-based kernel data display selftests; these are - a warning introduced in snprintf_btf.c; and - compilation failures with old kernels vmlinux.h Alan Maguire (2): selftests/bpf: fix unused-result warning in snprintf_btf.c selftests/bpf

[PATCH bpf-next 0/2] selftests/bpf: BTF-based kernel data display fixes

2020-09-29 Thread Alan Maguire
Resolve issues in bpf selftests introduced with BTF-based kernel data display selftests; these are - a warning introduced in snprintf_btf.c; and - compilation failures with old kernels vmlinux.h Alan Maguire (2): selftests/bpf: fix unused-result warning in snprintf_btf.c selftests/bpf

[PATCH bpf-next 2/2] selftests/bpf: ensure snprintf_btf/bpf_iter tests compatibility with old vmlinux.h

2020-09-29 Thread Alan Maguire
lftests/bpf: Add test for bpf_seq_printf_btf helper") Fixes: 076a95f5aff2 ("selftests/bpf: Add bpf_snprintf_btf helper tests") Reported-by: Andrii Nakryiko Signed-off-by: Alan Maguire --- tools/testing/selftests/bpf/progs/bpf_iter.h | 23 ++ tools/testing/s

[PATCH bpf-next 2/2] selftests/bpf: ensure snprintf_btf/bpf_iter tests compatibility with old vmlinux.h

2020-09-29 Thread Alan Maguire
lftests/bpf: Add test for bpf_seq_printf_btf helper") Fixes: 076a95f5aff2 ("selftests/bpf: Add bpf_snprintf_btf helper tests") Reported-by: Andrii Nakryiko Signed-off-by: Alan Maguire --- tools/testing/selftests/bpf/progs/bpf_iter.h | 23 ++ tools/testing/s

[PATCH bpf-next 1/2] selftests/bpf: fix unused-result warning in snprintf_btf.c

2020-09-29 Thread Alan Maguire
declared with attribute warn_unused_result [-Wunused-result] system("ping -c 1 127.0.0.1 > /dev/null"); ^ [...] Fixes: 076a95f5aff2 ("selftests/bpf: Add bpf_snprintf_btf helper tests") Reported-by: Daniel Borkmann Signed-off-

[PATCH bpf-next 1/2] selftests/bpf: fix unused-result warning in snprintf_btf.c

2020-09-29 Thread Alan Maguire
declared with attribute warn_unused_result [-Wunused-result] system("ping -c 1 127.0.0.1 > /dev/null"); ^ [...] Fixes: 076a95f5aff2 ("selftests/bpf: Add bpf_snprintf_btf helper tests") Reported-by: Daniel Borkmann Signed-off-

Re: [PATCH v6 bpf-next 6/6] selftests/bpf: add test for bpf_seq_printf_btf helper

2020-09-28 Thread Alan Maguire
On Thu, 24 Sep 2020, Alexei Starovoitov wrote: > to whatever number, but printing single task_struct needs ~800 lines and > ~18kbytes. Humans can scroll through that much spam, but can we make it less > verbose by default somehow? > May be not in this patch set, but in the follow up? > One app

Re: [PATCH v6 bpf-next 6/6] selftests/bpf: add test for bpf_seq_printf_btf helper

2020-09-28 Thread Alan Maguire
On Thu, 24 Sep 2020, Alexei Starovoitov wrote: > to whatever number, but printing single task_struct needs ~800 lines and > ~18kbytes. Humans can scroll through that much spam, but can we make it less > verbose by default somehow? > May be not in this patch set, but in the follow up? > One app

[PATCH v7 bpf-next 8/8] selftests/bpf: add test for bpf_seq_printf_btf helper

2020-09-28 Thread Alan Maguire
Add a test verifying iterating over tasks and displaying BTF representation of task_struct succeeds. Suggested-by: Alexei Starovoitov Signed-off-by: Alan Maguire --- tools/testing/selftests/bpf/prog_tests/bpf_iter.c | 74 ++ .../selftests/bpf/progs/bpf_iter_task_btf.c

[PATCH v7 bpf-next 8/8] selftests/bpf: add test for bpf_seq_printf_btf helper

2020-09-28 Thread Alan Maguire
Add a test verifying iterating over tasks and displaying BTF representation of task_struct succeeds. Suggested-by: Alexei Starovoitov Signed-off-by: Alan Maguire --- tools/testing/selftests/bpf/prog_tests/bpf_iter.c | 74 ++ .../selftests/bpf/progs/bpf_iter_task_btf.c

  1   2   3   4   5   6   7   8   9   >