Re: [PATCH v3] tracing/net_sched: NULL pointer dereference in perf_trace_qdisc_reset()

2024-06-24 Thread Pedro Tammela
On 24/06/2024 12:43, Yunseong Kim wrote: Hi Pedro, On 6/25/24 12:12 오전, Pedro Tammela wrote: On 22/06/2024 01:57, ysk...@gmail.com wrote: From: Yunseong Kim In the TRACE_EVENT(qdisc_reset) NULL dereference occurred from   qdisc->dev_queue->dev ->name [ 5301.595872] KASAN: null-

Re: [PATCH v3] tracing/net_sched: NULL pointer dereference in perf_trace_qdisc_reset()

2024-06-24 Thread Pedro Tammela
On 22/06/2024 01:57, ysk...@gmail.com wrote: From: Yunseong Kim In the TRACE_EVENT(qdisc_reset) NULL dereference occurred from qdisc->dev_queue->dev ->name This situation simulated from bunch of veths and Bluetooth dis/reconnection. During qdisc initialization, qdisc was being set to noop

Re: [PATCH] qdisc: fix NULL pointer dereference in perf_trace_qdisc_reset()

2024-06-21 Thread Pedro Tammela
On 21/06/2024 08:45, ysk...@gmail.com wrote: From: Yunseong Kim In the TRACE_EVENT(qdisc_reset) NULL dereference occurred from qdisc->dev_queue->dev ->name This situation simulated from bunch of veths and Bluetooth dis/reconnection. During qdisc initialization, qdisc was being set to noop

Re: [PATCH] bpf: fix errno code for unsupported batch ops

2021-04-19 Thread Pedro Tammela
Em dom., 18 de abr. de 2021 às 19:56, Alexei Starovoitov escreveu: > > On Sun, Apr 18, 2021 at 1:03 PM Pedro Tammela wrote: > > > > ENOTSUPP is not a valid userland errno[1], which is annoying for > > userland applications that implement a fallback to iterative, report

[PATCH] bpf: fix errno code for unsupported batch ops

2021-04-18 Thread Pedro Tammela
In older kernels, pre batched ops, it returns EINVAL as the arguments are not supported in the syscall. [1] https://lore.kernel.org/netdev/20200511165319.2251678-1-k...@kernel.org/ Signed-off-by: Pedro Tammela --- kernel/bpf/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --gi

[PATCH bpf-next v4 2/3] bpf: selftests: remove percpu macros from bpf_util.h

2021-04-15 Thread Pedro Tammela
Signed-off-by: Pedro Tammela --- tools/testing/selftests/bpf/bpf_util.h| 7 -- .../bpf/map_tests/htab_map_batch_ops.c| 87 +-- .../selftests/bpf/prog_tests/map_init.c | 9 +- tools/testing/selftests/bpf/test_maps.c | 84 +++--- 4 files changed

[PATCH bpf-next v4 3/3] bpf: selftests: update array map tests for per-cpu batched ops

2021-04-15 Thread Pedro Tammela
Follows the same logic as the hashtable tests. Signed-off-by: Pedro Tammela --- .../bpf/map_tests/array_map_batch_ops.c | 104 +- 1 file changed, 75 insertions(+), 29 deletions(-) diff --git a/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c b/tools/testing

[PATCH bpf-next v4 1/3] bpf: add batched ops support for percpu array

2021-04-15 Thread Pedro Tammela
i Salim Signed-off-by: Pedro Tammela --- kernel/bpf/arraymap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c index 463d25e1e67e..3c4105603f9d 100644 --- a/kernel/bpf/arraymap.c +++ b/kernel/bpf/arraymap.c @@ -698,6 +698,8 @@ const str

[PATCH bpf-next v4 0/3] add batched ops for percpu array

2021-04-15 Thread Pedro Tammela
pu macros v1 -> v2: - Amended a more descriptive commit message Pedro Tammela (3): bpf: add batched ops support for percpu array bpf: selftests: remove percpu macros from bpf_util.h bpf: selftests: update array map tests for per-cpu batched ops kernel/bpf/arraymap.c

[PATCH bpf-next v3 2/3] bpf: selftests: remove percpu macros from bpf_util.h

2021-04-12 Thread Pedro Tammela
Signed-off-by: Pedro Tammela --- tools/testing/selftests/bpf/bpf_util.h| 7 -- .../bpf/map_tests/htab_map_batch_ops.c| 71 .../selftests/bpf/prog_tests/map_init.c | 9 +- tools/testing/selftests/bpf/test_maps.c | 84 +++ 4 files changed, 89

[PATCH bpf-next v3 1/3] bpf: add batched ops support for percpu array

2021-04-12 Thread Pedro Tammela
i Salim Signed-off-by: Pedro Tammela --- kernel/bpf/arraymap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c index 463d25e1e67e..3c4105603f9d 100644 --- a/kernel/bpf/arraymap.c +++ b/kernel/bpf/arraymap.c @@ -698,6 +698,8 @@ const str

[PATCH bpf-next v3 3/3] bpf: selftests: update array map tests for per-cpu batched ops

2021-04-12 Thread Pedro Tammela
Follows the same logic as the hashtable tests. Signed-off-by: Pedro Tammela --- .../bpf/map_tests/array_map_batch_ops.c | 110 +- 1 file changed, 80 insertions(+), 30 deletions(-) diff --git a/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c b/tools/testing

[PATCH bpf-next v3 0/3] add batched ops for percpu array

2021-04-12 Thread Pedro Tammela
v3: - Remove percpu macros as suggested by Andrii - Update tests that used the per cpu macros v1 -> v2: - Amended a more descriptive commit message Pedro Tammela (3): bpf: add batched ops support for percpu array bpf: selftests: remove percpu macros from bpf_util.h bpf: selftests: update arr

[PATCH bpf-next v2] libbpf: clarify flags in ringbuf helpers

2021-04-12 Thread Pedro Tammela
In 'bpf_ringbuf_reserve()' we require the flag to '0' at the moment. For 'bpf_ringbuf_{discard,submit,output}' a flag of '0' might send a notification to the process if needed. Signed-off-by: Pedro Tammela --- include/uapi/linux/bpf.h | 16

Re: [PATCH bpf-next v2 2/3] libbpf: selftests: refactor 'BPF_PERCPU_TYPE()' and 'bpf_percpu()' macros

2021-04-07 Thread Pedro Tammela
Em qua., 7 de abr. de 2021 às 16:51, Andrii Nakryiko escreveu: > > On Wed, Apr 7, 2021 at 12:30 PM Pedro Tammela wrote: > > > > Em qua., 7 de abr. de 2021 às 15:31, Andrii Nakryiko > > escreveu: > > > > > > On Tue, Apr 6, 2021 at 11:55 AM Pedro Tamm

Re: [PATCH bpf-next] libbpf: clarify flags in ringbuf helpers

2021-04-07 Thread Pedro Tammela
Em qua., 7 de abr. de 2021 às 16:58, Andrii Nakryiko escreveu: > > On Wed, Apr 7, 2021 at 11:43 AM Joe Stringer wrote: > > > > Hi Pedro, > > > > On Tue, Apr 6, 2021 at 11:58 AM Pedro Tammela wrote: > > > > > > In 'bpf_ringbuf_reserve()'

Re: [PATCH bpf-next v2 2/3] libbpf: selftests: refactor 'BPF_PERCPU_TYPE()' and 'bpf_percpu()' macros

2021-04-07 Thread Pedro Tammela
Em qua., 7 de abr. de 2021 às 15:31, Andrii Nakryiko escreveu: > > On Tue, Apr 6, 2021 at 11:55 AM Pedro Tammela wrote: > > > > This macro was refactored out of the bpf selftests. > > > > Since percpu values are rounded up to '8' in the kernel, a carele

[PATCH bpf-next] libbpf: clarify flags in ringbuf helpers

2021-04-06 Thread Pedro Tammela
In 'bpf_ringbuf_reserve()' we require the flag to '0' at the moment. For 'bpf_ringbuf_{discard,submit,output}' a flag of '0' might send a notification to the process if needed. Signed-off-by: Pedro Tammela --- include/uapi/linux/bpf.h | 7 +++

[PATCH bpf-next v2 3/3] bpf: selftests: update array map tests for per-cpu batched ops

2021-04-06 Thread Pedro Tammela
Follows the same logic as the hashtable tests. Signed-off-by: Pedro Tammela --- .../bpf/map_tests/array_map_batch_ops.c | 114 +- 1 file changed, 85 insertions(+), 29 deletions(-) diff --git a/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c b/tools/testing

[PATCH bpf-next v2 1/3] bpf: add batched ops support for percpu array

2021-04-06 Thread Pedro Tammela
i Salim Signed-off-by: Pedro Tammela --- kernel/bpf/arraymap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c index 463d25e1e67e..3c4105603f9d 100644 --- a/kernel/bpf/arraymap.c +++ b/kernel/bpf/arraymap.c @@ -698,6 +698,8 @@ const str

[PATCH bpf-next v2 2/3] libbpf: selftests: refactor 'BPF_PERCPU_TYPE()' and 'bpf_percpu()' macros

2021-04-06 Thread Pedro Tammela
ops in the percpu variant, let's provide a convenient macro to declare percpu map value types. Updates the tests to a "reference" usage of the new macro. Signed-off-by: Pedro Tammela --- tools/lib/bpf/bpf.h | 10 tools/testing/selftests/bpf/bpf_util.h

[PATCH bpf-next v2 0/3] add batched ops support for percpu

2021-04-06 Thread Pedro Tammela
refactored out to libbpf, with some simplifications for reuse. The tests were updated to reflect all the new changes. v1 -> v2: - Amended a more descriptive commit message Pedro Tammela (3): bpf: add batched ops support for percpu array libbpf: selftests: refactor 'BPF_PERCPU_TYPE(

[PATCH bpf-next 3/3] bpf: selftests: update array map tests for per-cpu batched ops

2021-04-04 Thread Pedro Tammela
Follows the same logic as the hashtable tests. Signed-off-by: Pedro Tammela --- .../bpf/map_tests/array_map_batch_ops.c | 114 +- 1 file changed, 85 insertions(+), 29 deletions(-) diff --git a/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c b/tools/testing

[PATCH bpf-next 2/3] libbpf: selftests: refactor 'BPF_PERCPU_TYPE()' and 'bpf_percpu()' macros

2021-04-04 Thread Pedro Tammela
ops in the percpu variant, let's provide a convenient macro to declare percpu map value types. Updates the tests to a "reference" usage of the new macro. Signed-off-by: Pedro Tammela --- tools/lib/bpf/bpf.h | 10 tools/testing/selftests/bpf/bpf_util.h

[PATCH bpf-next 1/3] bpf: add batched ops support for percpu array

2021-04-04 Thread Pedro Tammela
Suggested-by: Jamal Hadi Salim Signed-off-by: Pedro Tammela --- kernel/bpf/arraymap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c index 463d25e1e67e..3c4105603f9d 100644 --- a/kernel/bpf/arraymap.c +++ b/kernel/bpf/arraymap.c @@ -698,6

[PATCH bpf-next 0/3] add batched ops support for percpu array

2021-04-04 Thread Pedro Tammela
refactored out to libbpf, with some simplifications for reuse. The tests were updated to reflect all the new changes. Pedro Tammela (3): bpf: add batched ops support for percpu array libbpf: selftests: refactor 'BPF_PERCPU_TYPE()' and 'bpf_percpu()' macros bpf: selftes

Re: [PATCH bpf-next] bpf: add 'BPF_RB_MAY_WAKEUP' flag

2021-04-03 Thread Pedro Tammela
Em qua., 31 de mar. de 2021 às 03:54, Andrii Nakryiko escreveu: > > On Sun, Mar 28, 2021 at 9:11 AM Pedro Tammela wrote: > > > > The current way to provide a no-op flag to 'bpf_ringbuf_submit()', > > 'bpf_ringbuf_discard()' and 'bpf_ringbuf_outp

Re: [PATCH bpf-next v2] bpf: check flags in 'bpf_ringbuf_discard()' and 'bpf_ringbuf_submit()'

2021-04-03 Thread Pedro Tammela
Em qua., 31 de mar. de 2021 às 04:02, Andrii Nakryiko escreveu: > > On Tue, Mar 30, 2021 at 4:16 PM Alexei Starovoitov > wrote: > > > > On Tue, Mar 30, 2021 at 3:54 PM Pedro Tammela wrote: > > > > > > BPF_CALL_2(bpf_ringbuf_submit, void *, sample

[PATCH bpf-next v2] bpf: check flags in 'bpf_ringbuf_discard()' and 'bpf_ringbuf_submit()'

2021-03-30 Thread Pedro Tammela
The current code only checks flags in 'bpf_ringbuf_output()'. Signed-off-by: Pedro Tammela --- include/uapi/linux/bpf.h | 8 kernel/bpf/ringbuf.c | 13 +++-- tools/include/uapi/linux/bpf.h | 8 3 files changed, 19 insertions(+), 10 deletion

Re: [PATCH bpf-next] bpf: check flags in 'bpf_ringbuf_discard()' and 'bpf_ringbuf_submit()'

2021-03-30 Thread Pedro Tammela
Em seg., 29 de mar. de 2021 às 13:10, Song Liu escreveu: > > > > > On Mar 28, 2021, at 9:10 AM, Pedro Tammela wrote: > > > > The current code only checks flags in 'bpf_ringbuf_output()'. > > > > Signed-off-by: Pedro Tammela > > --- > >

[PATCH bpf-next] libbpf: Add '_wait()' and '_nowait()' macros for 'bpf_ring_buffer__poll()'

2021-03-28 Thread Pedro Tammela
'bpf_ring_buffer__poll()' abstracts the polling method, so abstract the constants that make the implementation don't wait or wait indefinetly for data. Signed-off-by: Pedro Tammela --- tools/lib/bpf/libbpf.h | 3 +++ tools/testing/selft

[PATCH bpf-next] bpf: check flags in 'bpf_ringbuf_discard()' and 'bpf_ringbuf_submit()'

2021-03-28 Thread Pedro Tammela
The current code only checks flags in 'bpf_ringbuf_output()'. Signed-off-by: Pedro Tammela --- include/uapi/linux/bpf.h | 8 kernel/bpf/ringbuf.c | 13 +++-- tools/include/uapi/linux/bpf.h | 8 3 files changed, 19 insertions(+), 10 deletion

[PATCH bpf-next] bpf: add 'BPF_RB_MAY_WAKEUP' flag

2021-03-28 Thread Pedro Tammela
ore descriptive notation for this value. Signed-off-by: Pedro Tammela --- include/uapi/linux/bpf.h | 8 tools/include/uapi/linux/bpf.h | 8 tools/testing/selftests/bpf/progs/ima.c| 2 +- tools/testing/selftes

[PATCH bpf-next] libbpf: fix bail out from 'ringbuf_process_ring()' on error

2021-03-25 Thread Pedro Tammela
patch makes positive returns from the callback a no-op. Signed-off-by: Pedro Tammela --- tools/lib/bpf/ringbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/ringbuf.c b/tools/lib/bpf/ringbuf.c index 8caaafe7e312..e7a8d847161f 100644 --- a/tools/lib/bpf/ringbuf.c

[PATCH bpf-next v2 2/2] bpf: selftests: add tests for batched ops in LPM trie maps

2021-03-22 Thread Pedro Tammela
From: Pedro Tammela Uses the already existing infrastructure for testing batched ops. The testing code is essentially the same, with minor tweaks for this use case. Suggested-by: Jamal Hadi Salim Signed-off-by: Pedro Tammela --- .../map_tests/lpm_trie_map_batch_ops.c (new) | 158

[PATCH bpf-next v2 1/2] bpf: add support for batched ops in LPM trie maps

2021-03-22 Thread Pedro Tammela
From: Pedro Tammela Suggested-by: Jamal Hadi Salim Signed-off-by: Pedro Tammela --- kernel/bpf/lpm_trie.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c index cec792a17e5f..1b7b8a6f34ee 100644 --- a/kernel/bpf/lpm_trie.c +++ b/kernel/bpf

[PATCH bpf-next v2 0/2] add support for batched ops in LPM trie

2021-03-22 Thread Pedro Tammela
The patch itself is straightforward thanks to the infrastructure that is already in-place. The tests follows the other '*_map_batch_ops' tests with minor tweaks. v1 -> v2: Fixes for checkpatch warnings Pedro Tammela (2): bpf: add support for batched operations in LPM tr

[PATCH bpf-next 2/2] bpf: selftests: add tests for batched ops in LPM trie maps

2021-03-21 Thread Pedro Tammela
From: Pedro Tammela Uses the already existing infrastructure for testing batched ops. The testing code is essentially the same, with minor tweaks for this use case. Suggested-by: Jamal Hadi Salim Signed-off-by: Pedro Tammela --- .../map_tests/lpm_trie_map_batch_ops.c (new) | 158

[PATCH bpf-next 1/2] bpf: add support for batched operations in LPM trie maps

2021-03-21 Thread Pedro Tammela
From: Pedro Tammela Suggested-by: Jamal Hadi Salim Signed-off-by: Pedro Tammela --- kernel/bpf/lpm_trie.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c index cec792a17e5f..1b7b8a6f34ee 100644 --- a/kernel/bpf/lpm_trie.c +++ b/kernel/bpf

[PATCH bpf-next 0/2] add support for batched ops in LPM trie

2021-03-21 Thread Pedro Tammela
The patch itself is straightforward thanks to the infrastructure that is already in-place. The tests follows the other '*_map_batch_ops' tests with minor tweaks. Pedro Tammela (2): bpf: add support for batched operations in LPM trie maps bpf: selftests: add tests for batched ops i

[PATCH] bpf: selftests: remove unused 'nospace_err' in tests for batched ops in array maps

2021-03-15 Thread Pedro Tammela
This seems to be a reminiscent from the hashmap tests. Signed-off-by: Pedro Tammela --- tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c | 5 - 1 file changed, 5 deletions(-) diff --git a/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c b/tools/testing/selftests/bpf

[PATCH] libbpf: avoid inline hint definition from 'linux/stddef.h'

2021-03-14 Thread Pedro Tammela
t hints inline to clang. This change now enforces the proper definition for BPF programs regardless of the include order. Signed-off-by: Pedro Tammela --- tools/lib/bpf/bpf_helpers.h | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/lib/bpf/bpf_helpers.h b/too