Re: [bpf-next PATCH v3 5/5] bpf: selftests, test probe_* helpers from SCHED_CLS

2020-05-21 Thread John Fastabend
Andrii Nakryiko wrote: > On Thu, May 21, 2020 at 7:36 AM John Fastabend > wrote: > > > > Lets test using probe* in SCHED_CLS network programs as well just > > to be sure these keep working. Its cheap to add the extra test > > and provides a second context to test

Re: [bpf-next PATCH v3 4/5] bpf: selftests, add sk_msg helpers load and attach test

2020-05-21 Thread John Fastabend
John Fastabend wrote: > Andrii Nakryiko wrote: > > On Thu, May 21, 2020 at 7:36 AM John Fastabend > > wrote: > > > > > > The test itself is not particularly useful but it encodes a common > > > pattern we have. > > > > > > Namely

Re: [bpf-next PATCH v3 4/5] bpf: selftests, add sk_msg helpers load and attach test

2020-05-21 Thread John Fastabend
Andrii Nakryiko wrote: > On Thu, May 21, 2020 at 7:36 AM John Fastabend > wrote: > > > > The test itself is not particularly useful but it encodes a common > > pattern we have. > > > > Namely do a sk storage lookup then depending on data here deci

Re: [bpf-next PATCH v3 4/5] bpf: selftests, add sk_msg helpers load and attach test

2020-05-21 Thread John Fastabend
Yonghong Song wrote: > > > On 5/21/20 7:35 AM, John Fastabend wrote: > > The test itself is not particularly useful but it encodes a common > > pattern we have. > > > > Namely do a sk storage lookup then depending on data here decide if > > we need to do

[bpf-next PATCH v3 5/5] bpf: selftests, test probe_* helpers from SCHED_CLS

2020-05-21 Thread John Fastabend
Lets test using probe* in SCHED_CLS network programs as well just to be sure these keep working. Its cheap to add the extra test and provides a second context to test outside of sk_msg after we generalized probe* helpers to all networking types. Signed-off-by: John Fastabend --- .../testing

[bpf-next PATCH v3 4/5] bpf: selftests, add sk_msg helpers load and attach test

2020-05-21 Thread John Fastabend
-by: John Fastabend --- .../selftests/bpf/prog_tests/sockmap_basic.c | 57 .../selftests/bpf/progs/test_skmsg_load_helpers.c | 48 + 2 files changed, 105 insertions(+) create mode 100644 tools/testing/selftests/bpf/progs/test_skmsg_load_helpers.c

[bpf-next PATCH v3 2/5] bpf: extend bpf_base_func_proto helpers with probe_* and *current_task*

2020-05-21 Thread John Fastabend
ing, BPF_FUNC_get_current_task BPF_FUNC_current_task_under_cgroup BPF_FUNC_probe_read_user BPF_FUNC_probe_read_kernel BPF_FUNC_probe_read_user_str BPF_FUNC_probe_read_kernel_str Signed-off-by: John Fastabend Acked-by: Yonghong Song --- kernel/bpf/helpers.c | 27 +++ ker

[bpf-next PATCH v3 3/5] bpf: sk_msg add get socket storage helpers

2020-05-21 Thread John Fastabend
Add helpers to use local socket storage. Signed-off-by: John Fastabend Acked-by: Yonghong Song --- include/uapi/linux/bpf.h |2 ++ net/core/filter.c | 15 +++ tools/include/uapi/linux/bpf.h |2 ++ 3 files changed, 19 insertions(+) diff --git a/include

[bpf-next PATCH v3 1/5] bpf: sk_msg add some generic helpers that may be useful from sk_msg

2020-05-21 Thread John Fastabend
BPF_FUNC_get_current_ancestor_cgroup_id BPF_FUNC_get_cgroup_classid Acked-by: Yonghong Song Signed-off-by: John Fastabend --- net/core/filter.c | 16 1 file changed, 16 insertions(+) diff --git a/net/core/filter.c b/net/core/filter.c index 822d662..a56046a 100644 --- a/net/core

[bpf-next PATCH v3 0/5] bpf: Add sk_msg and networking helpers

2020-05-21 Thread John Fastabend
now in bpf-next so use perfmon_capable() check instead of CAP_SYS_ADMIN. Drop old probe helpers, probe_read() and probe_read_str() Added tests. Thanks to Daniel and Yonghong for review and feedback. --- John Fastabend (5): bpf: sk_msg add some generic helpers that may be useful from

Re: [PATCH v5 bpf-next 00/11] net: Add support for XDP in egress path

2020-05-18 Thread John Fastabend
David Ahern wrote: > On 5/18/20 12:10 PM, John Fastabend wrote: > >> > >> host ingress to VM is one use case; VM to VM on the same host is another. > > > > But host ingress to VM would still work with tail calls because the XDP > > packet came from anot

Re: [bpf-next PATCH 1/4] bpf: verifier track null pointer branch_taken with JNE and JEQ

2020-05-18 Thread John Fastabend
Andrii Nakryiko wrote: > On Mon, May 18, 2020 at 1:05 PM John Fastabend > wrote: > > > > Current verifier when considering which branch may be taken on a > > conditional test with pointer returns -1 meaning either branch may > > be taken. But, we track if pointers

RE: [bpf-next PATCH 1/4] bpf: verifier track null pointer branch_taken with JNE and JEQ

2020-05-18 Thread John Fastabend
John Fastabend wrote: > Current verifier when considering which branch may be taken on a > conditional test with pointer returns -1 meaning either branch may > be taken. But, we track if pointers can be NULL by using dedicated > types for valid pointers (pointers that can not be NULL).

[bpf-next PATCH 3/4] bpf: selftests, verifier case for non null pointer map value branch

2020-05-18 Thread John Fastabend
When we have pointer type that is known to be non-null we only follow the non-null branch. This adds tests to cover the map_value pointer returned from a map lookup. To force an error if both branches are followed we do an ALU op on R10. Signed-off-by: John Fastabend --- .../testing/selftests

[bpf-next PATCH 4/4] bpf: selftests, add printk to test_sk_lookup_kern to encode null ptr check

2020-05-18 Thread John Fastabend
r one. Signed-off-by: John Fastabend --- .../selftests/bpf/progs/test_sk_lookup_kern.c |1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c b/tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c index d2b38fa..e83d0b4 100644 --- a/

[bpf-next PATCH 0/4] verifier, improve ptr is_branch_taken logic

2020-05-18 Thread John Fastabend
much in the way of test overhead. --- John Fastabend (4): bpf: verifier track null pointer branch_taken with JNE and JEQ bpf: selftests, verifier case for non null pointer check branch taken bpf: selftests, verifier case for non null pointer map value branch bpf: selftests

[bpf-next PATCH 1/4] bpf: verifier track null pointer branch_taken with JNE and JEQ

2020-05-18 Thread John Fastabend
0x0'. After the above additional logic is added the C code above passes as expected. This makes the assumption that all pointer types PTR_TO_* that can be null have an equivalent type PTR_TO_*_OR_NULL logic. Suggested-by: Alexei Starovoitov Reported-by: Andrey Ignatov Signed-off-by: John F

[bpf-next PATCH 2/4] bpf: selftests, verifier case for non null pointer check branch taken

2020-05-18 Thread John Fastabend
When we have pointer type that is known to be non-null we only follow the non-null branch. This adds tests to cover this case for reference tracking. Signed-off-by: John Fastabend --- .../testing/selftests/bpf/verifier/ref_tracking.c | 16 1 file changed, 16 insertions

Re: [PATCH v5 bpf-next 00/11] net: Add support for XDP in egress path

2020-05-18 Thread John Fastabend
David Ahern wrote: > On 5/15/20 4:54 PM, John Fastabend wrote: > > Hi David, > > > > Another way to set up egress programs that I had been thinking about is to > > build a prog_array map with a slot per interface then after doing the > > redirect (or I guess

Re: [PATCH v5 bpf-next 00/11] net: Add support for XDP in egress path

2020-05-15 Thread John Fastabend
David Ahern wrote: > On 5/13/20 4:43 AM, Toke Høiland-Jørgensen wrote: > > I don't like this. I makes the egress hook asymmetrical with the ingress > > hook (ingress hook sees all traffic, egress only some of it). If the > > performance hit of disabling GSO is the concern, maybe it's better to > >

[bpf-next PATCH v2 5/5] bpf: selftests, test probe_* helpers from SCHED_CLS

2020-05-15 Thread John Fastabend
Lets test using probe* in SCHED_CLS network programs as well just to be sure these keep working. Its cheap to add the extra test and provides a second context to test outside of sk_msg after we generalized probe* helpers to all networking types. Signed-off-by: John Fastabend --- .../testing

[bpf-next PATCH v2 1/5] bpf: sk_msg add some generic helpers that may be useful from sk_msg

2020-05-15 Thread John Fastabend
BPF_FUNC_get_current_ancestor_cgroup_id BPF_FUNC_get_cgroup_classid Acked-by: Yonghong Song Signed-off-by: John Fastabend --- net/core/filter.c | 16 1 file changed, 16 insertions(+) diff --git a/net/core/filter.c b/net/core/filter.c index f8a3c7e..7dac2b6 100644 --- a/net/core

[bpf-next PATCH v2 2/5] bpf: extend bpf_base_func_proto helpers with probe_* and *current_task*

2020-05-15 Thread John Fastabend
ing, BPF_FUNC_get_current_task BPF_FUNC_current_task_under_cgroup BPF_FUNC_probe_read_user BPF_FUNC_probe_read_kernel BPF_FUNC_probe_read_user_str BPF_FUNC_probe_read_kernel_str Signed-off-by: John Fastabend --- kernel/bpf/helpers.c | 27 +++ kernel/trace/bpf_trace.c |

[bpf-next PATCH v2 3/5] bpf: sk_msg add get socket storage helpers

2020-05-15 Thread John Fastabend
Add helpers to use local socket storage. Signed-off-by: John Fastabend --- include/uapi/linux/bpf.h |2 ++ net/core/filter.c| 15 +++ 2 files changed, 17 insertions(+) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index b9b8a0f..d394b09 100644 --- a

[bpf-next PATCH v2 4/5] bpf: selftests, add sk_msg helpers load and attach test

2020-05-15 Thread John Fastabend
-by: John Fastabend --- tools/include/uapi/linux/bpf.h |2 + .../selftests/bpf/prog_tests/sockmap_basic.c | 57 .../selftests/bpf/progs/test_skmsg_load_helpers.c | 48 + 3 files changed, 107 insertions(+) create mode 100644

[bpf-next PATCH v2 0/5] bpf: Add sk_msg and networking helpers

2020-05-15 Thread John Fastabend
str() Added tests. Thanks to Daniel and Yonghong for review and feedback. --- John Fastabend (5): bpf: sk_msg add some generic helpers that may be useful from sk_msg bpf: extend bpf_base_func_proto helpers with probe_* and *current_task* bpf: sk_msg add get socket storage help

RE: [PATCH bpf 2/3] bpf: add bpf_probe_read_{user, kernel}_str() to do_refine_retval_range

2020-05-14 Thread John Fastabend
ame issue as in 849fa50662fbc ("bpf/verifier: > refine retval R0 state for bpf_get_stack helper"). > > Signed-off-by: Daniel Borkmann > Cc: John Fastabend > Cc: Yonghong Song > --- Acked-by: John Fastabend

Re: [bpf-next PATCH 2/3] bpf: sk_msg helpers for probe_* and *current_task*

2020-05-14 Thread John Fastabend
Yonghong Song wrote: > > > On 5/13/20 12:24 PM, John Fastabend wrote: > > Often it is useful when applying policy to know something about the > > task. If the administrator has CAP_SYS_ADMIN rights then they can > > use kprobe + sk_msg and link the two programs toge

[bpf-next PATCH 3/3] bpf: sk_msg add get socket storage helpers

2020-05-13 Thread John Fastabend
Add helpers to use local socket storage. Signed-off-by: John Fastabend --- include/uapi/linux/bpf.h |2 ++ net/core/filter.c| 15 +++ 2 files changed, 17 insertions(+) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index bfb31c1..3ca7cfd 100644 --- a

[bpf-next PATCH 2/3] bpf: sk_msg helpers for probe_* and *current_task*

2020-05-13 Thread John Fastabend
BPF_FUNC_current_task_under_cgroup BPF_FUNC_probe_read_user BPF_FUNC_probe_read_kernel BPF_FUNC_probe_read BPF_FUNC_probe_read_user_str BPF_FUNC_probe_read_kernel_str BPF_FUNC_probe_read_str Signed-off-by: John Fastabend --- kernel/trace/bpf_trace.c | 16 net/core/filter.c| 34

[bpf-next PATCH 1/3] bpf: sk_msg add some generic helpers that may be useful from sk_msg

2020-05-13 Thread John Fastabend
BPF_FUNC_get_current_ancestor_cgroup_id BPF_FUNC_get_cgroup_classid Signed-off-by: John Fastabend --- net/core/filter.c | 16 1 file changed, 16 insertions(+) diff --git a/net/core/filter.c b/net/core/filter.c index da06349..45b4a16 100644 --- a/net/core/filter.c +++ b/net/core

[bpf-next PATCH 0/3] bpf: Add sk_msg helpers

2020-05-13 Thread John Fastabend
BPF_FUNC_probe_read_kernel_str BPF_FUNC_probe_read_str BPF_FUNC_sk_storage_get BPF_FUNC_sk_storage_delete I have an RFC test for sk_storage_* patch that is pending merge of other sockmap_test patches. --- John Fastabend (3): bpf: sk_msg add some generic helpers that may be useful from sk_msg bpf

[bpf-next PATCH v2 11/12] bpf: selftests, add blacklist to test_sockmap

2020-05-13 Thread John Fastabend
This adds a blacklist to test_sockmap. For example, now we can run all apply and cork tests except those with timeouts by doing, $ ./test_sockmap --whitelist "apply,cork" --blacklist "hang" Reviewed-by: Jakub Sitnicki Signed-off-by: John Fastabend --- tools/t

[bpf-next PATCH v2 10/12] bpf: selftests, add whitelist option to test_sockmap

2020-05-13 Thread John Fastabend
Allow running specific tests with a comma deliminated whitelist. For example to run all apply and cork tests. $ ./test_sockmap --whitelist="cork,apply" Reviewed-by: Jakub Sitnicki Signed-off-by: John Fastabend --- tools/testing/selftests/bpf/test_sockma

[bpf-next PATCH v2 12/12] bpf: selftests, add ktls tests to test_sockmap

2020-05-13 Thread John Fastabend
Until now we have only had minimal ktls+sockmap testing when being used with helpers and different sendmsg/sendpage patterns. Add a pass with ktls here. To run just ktls tests, $ ./test_sockmap --whitelist="ktls" Reviewed-by: Jakub Sitnicki Signed-off-by: John Fastabend --- too

[bpf-next PATCH v2 08/12] bpf: selftests, break down test_sockmap into subtests

2020-05-13 Thread John Fastabend
default output prints subtests like this, $ ./test_sockmap # 1/ 6 sockmap:txmsg test passthrough:OK ... #22/ 1 sockhash:txmsg test push/pop data:OK Pass: 22 Fail: 0 Reviewed-by: Jakub Sitnicki Signed-off-by: John Fastabend --- tools/testing/selftests/bpf/test_sockmap.c | 723

[bpf-next PATCH v2 09/12] bpf: selftests, provide verbose option for selftests execution

2020-05-13 Thread John Fastabend
: Jakub Sitnicki Signed-off-by: John Fastabend --- tools/testing/selftests/bpf/test_sockmap.c | 179 +++- 1 file changed, 71 insertions(+), 108 deletions(-) diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c index ad0540a

[bpf-next PATCH v2 07/12] bpf: selftests, improve test_sockmap total bytes counter

2020-05-13 Thread John Fastabend
better job of accounting for total bytes when pop helpers are used. Reviewed-by: Jakub Sitnicki Signed-off-by: John Fastabend --- tools/testing/selftests/bpf/test_sockmap.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/bpf/test_sockmap.c

[bpf-next PATCH v2 06/12] bpf: selftests, print error in test_sockmap error cases

2020-05-13 Thread John Fastabend
Its helpful to know the error value if an error occurs. Reviewed-by: Jakub Sitnicki Signed-off-by: John Fastabend --- tools/testing/selftests/bpf/test_sockmap.c | 25 + 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/bpf

[bpf-next PATCH v2 05/12] bpf: selftests, sockmap test prog run without setting cgroup

2020-05-13 Thread John Fastabend
tests. Reviewed-by: Jakub Sitnicki Signed-off-by: John Fastabend --- tools/testing/selftests/bpf/test_sockmap.c | 28 ++-- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf

[bpf-next PATCH v2 04/12] bpf: selftests, remove prints from sockmap tests

2020-05-13 Thread John Fastabend
half the programs and cleanup bpf side. Reviewed-by: Jakub Sitnicki Signed-off-by: John Fastabend --- .../selftests/bpf/progs/test_sockmap_kern.h| 158 tools/testing/selftests/bpf/test_sockmap.c | 25 +-- 2 files changed, 9 insertions(+), 174 dele

[bpf-next PATCH v2 02/12] bpf: sockmap, bpf_tcp_ingress needs to subtract bytes from sg.size

2020-05-13 Thread John Fastabend
173.700109] tcp_bpf_sendpage+0x3ce/0x5d0 Fixes: 604326b41a6fb ("bpf, sockmap: convert to generic sk_msg interface") Signed-off-by: John Fastabend --- 0 files changed diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h index 8a709f6..ad31c9f 100644 --- a/include/linux/skmsg.h +++ b/include/lin

[bpf-next PATCH v2 03/12] bpf: selftests, move sockmap bpf prog header into progs

2020-05-13 Thread John Fastabend
Moves test_sockmap_kern.h into progs directory but does not change code at all. Reviewed-by: Jakub Sitnicki Signed-off-by: John Fastabend --- .../selftests/bpf/progs/test_sockmap_kern.h| 451 tools/testing/selftests/bpf/test_sockmap_kern.h| 451

[bpf-next PATCH v2 01/12] bpf: sockmap, msg_pop_data can incorrecty set an sge length

2020-05-13 Thread John Fastabend
took us a while to hit this case because typically we pop headers which seem to rarely be at the end of a scatterlist elements but we can't rely on this. Fixes: 7246d8ed4dcce ("bpf: helper to pop data from messages") Signed-off-by: John Fastabend --- 0 files changed diff --git

[bpf-next PATCH v2 00/12] bpf: selftests, test_sockmap improvements

2020-05-13 Thread John Fastabend
ernel/git/netdev/net.git/commit/?id=81aabbb9fb7b4b1efd073b62f0505d3adad442f3 v1->v2: Addressed Jakub's comments, exit to _exit and strerror typo. Added Jakubs Reviewed-by tag, Thanks! --- John Fastabend (12): bpf: sockmap, msg_pop_data can incorrecty set an sge length bpf: sockm

Re: [bpf-next PATCH 00/10] bpf: selftests, test_sockmap improvements

2020-05-09 Thread John Fastabend
Andrii Nakryiko wrote: > On Tue, May 5, 2020 at 1:50 PM John Fastabend > wrote: > > > > Update test_sockmap to add ktls tests and in the process make output > > easier to understand and reduce overall runtime significantly. Before > > this series test_sockmap d

RE: [PATCH bpf-next 3/3] selftest/bpf: add BPF triggring benchmark

2020-05-08 Thread John Fastabend
tem, which rules it out. > Fentry, though, seems to be adding the least amoung of overhead and achieves > 97.3% of performance of baseline no-BPF-attached syscall. > > Using getpgid() seems to be preferable to set_task_comm() approach from > test_overhead, as it's about 2.35x faster in a baseline performance. > > Signed-off-by: Andrii Nakryiko > --- Nice. Acked-by: John Fastabend

RE: [PATCH bpf-next 2/3] selftest/bpf: fmod_ret prog and implement test_overhead as part of bench

2020-05-08 Thread John Fastabend
> task_rename raw_tp 4506K events per sec > task_rename fentry 4381K events per sec > task_rename fexit 4349K events per sec > task_rename fmod_ret4130K events per sec > > Signed-off-by: Andrii Nakryiko > --- LGTM Acked-by: John Fastabend

RE: [PATCH bpf-next 1/3] selftests/bpf: add benchmark runner infrastructure

2020-05-08 Thread John Fastabend
Andrii Nakryiko wrote: > While working on BPF ringbuf implementation, testing, and benchmarking, I've > developed a pretty generic and modular benchmark runner, which seems to be > generically useful, as I've already used it for one more purpose (testing > fastest way to trigger BPF program, to min

Re: [bpf-next PATCH 00/10] bpf: selftests, test_sockmap improvements

2020-05-07 Thread John Fastabend
Jakub Sitnicki wrote: > On Tue, 05 May 2020 13:49:36 -0700 > John Fastabend wrote: > > > Update test_sockmap to add ktls tests and in the process make output > > easier to understand and reduce overall runtime significantly. Before > > this series test_sockmap did

Re: [bpf-next PATCH 03/10] bpf: selftests, sockmap test prog run without setting cgroup

2020-05-07 Thread John Fastabend
Jakub Sitnicki wrote: > On Tue, 05 May 2020 13:50:35 -0700 > John Fastabend wrote: > > > Running test_sockmap with arguments to specify a test pattern requires > > including a cgroup argument. Instead of requiring this if the option is > > not provided create one &

Re: XDP bpf_tail_call_redirect(): yea or nay?

2020-05-07 Thread John Fastabend
Toke Høiland-Jørgensen wrote: > Björn Töpel writes: > > > On Thu, 7 May 2020 at 15:44, Toke Høiland-Jørgensen wrote: > >> > >> Björn Töpel writes: > >> > >> > Before I start hacking on this, I might as well check with the XDP > >> > folks if this considered a crappy idea or not. :-) > >> > > >>

RE: [bpf-next PATCH 00/10] bpf: selftests, test_sockmap improvements

2020-05-05 Thread John Fastabend
John Fastabend wrote: > Update test_sockmap to add ktls tests and in the process make output > easier to understand and reduce overall runtime significantly. Before > this series test_sockmap did a poor job of tracking sent bytes causing > the recv thread to wait for a timeout eve

[bpf-next PATCH 10/10] bpf: selftests, add ktls tests to test_sockmap

2020-05-05 Thread John Fastabend
Until now we have only had minimal ktls+sockmap testing when being used with helpers and different sendmsg/sendpage patterns. Add a pass with ktls here. To run just ktls tests, $ ./test_sockmap --whitelist="ktls" Signed-off-by: John Fastabend --- tools/testing/selftests/bpf/test

[bpf-next PATCH 09/10] bpf: selftests, add blacklist to test_sockmap

2020-05-05 Thread John Fastabend
This adds a blacklist to test_sockmap. For example, now we can run all apply and cork tests except those with timeouts by doing, $ ./test_sockmap --whitelist "apply,cork" --blacklist "hang" Signed-off-by: John Fastabend --- tools/testing/selftests/bpf/t

[bpf-next PATCH 07/10] bpf: selftests, provide verbose option for selftests execution

2020-05-05 Thread John Fastabend
: John Fastabend --- tools/testing/selftests/bpf/test_sockmap.c | 179 +++- 1 file changed, 71 insertions(+), 108 deletions(-) diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c index 6782d51..0f944c3 100644 --- a/tools

[bpf-next PATCH 08/10] bpf: selftests, add whitelist option to test_sockmap

2020-05-05 Thread John Fastabend
Allow running specific tests with a comma deliminated whitelist. For example to run all apply and cork tests. $ ./test_sockmap --whitelist="cork,apply" Signed-off-by: John Fastabend --- tools/testing/selftests/bpf/test_sockmap.c | 31 +++- 1 file c

[bpf-next PATCH 06/10] bpf: selftests, break down test_sockmap into subtests

2020-05-05 Thread John Fastabend
default output prints subtests like this, $ ./test_sockmap # 1/ 6 sockmap:txmsg test passthrough:OK ... #22/ 1 sockhash:txmsg test push/pop data:OK Pass: 22 Fail: 0 Signed-off-by: John Fastabend --- tools/testing/selftests/bpf/test_sockmap.c | 723 +--- 1 file

[bpf-next PATCH 03/10] bpf: selftests, sockmap test prog run without setting cgroup

2020-05-05 Thread John Fastabend
tests. Signed-off-by: John Fastabend --- tools/testing/selftests/bpf/test_sockmap.c | 28 ++-- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c index 6bdacc4..a0884f8

[bpf-next PATCH 05/10] bpf: selftests, improve test_sockmap total bytes counter

2020-05-05 Thread John Fastabend
better job of accounting for total bytes when pop helpers are used. Signed-off-by: John Fastabend --- tools/testing/selftests/bpf/test_sockmap.c |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf

[bpf-next PATCH 04/10] bpf: selftests, print error in test_sockmap error cases

2020-05-05 Thread John Fastabend
Its helpful to know the error value if an error occurs. Signed-off-by: John Fastabend --- tools/testing/selftests/bpf/test_sockmap.c | 25 + 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing

[bpf-next PATCH 02/10] bpf: selftests, remove prints from sockmap tests

2020-05-05 Thread John Fastabend
half the programs and cleanup bpf side. Signed-off-by: John Fastabend --- .../selftests/bpf/progs/test_sockmap_kern.h| 158 tools/testing/selftests/bpf/test_sockmap.c | 25 +-- 2 files changed, 9 insertions(+), 174 deletions(-) diff --git a/tools/te

[bpf-next PATCH 00/10] bpf: selftests, test_sockmap improvements

2020-05-05 Thread John Fastabend
option. To whitelist and blacklist tests use the new --whitelist and --blacklist flags added. For example to run cork sockhash tests but only ones that don't have a receive hang (used to test negative cases) we could do, $ ./test_sockmap --whitelist="cork" --blacklist="sockmap,

[bpf-next PATCH 01/10] bpf: selftests, move sockmap bpf prog header into progs

2020-05-05 Thread John Fastabend
Moves test_sockmap_kern.h into progs directory but does not change code at all. Signed-off-by: John Fastabend --- .../selftests/bpf/progs/test_sockmap_kern.h| 451 tools/testing/selftests/bpf/test_sockmap_kern.h| 451 2 files changed, 451

[PATCH 2/2] bpf: sockmap, bpf_tcp_ingress needs to subtract bytes from sg.size

2020-05-04 Thread John Fastabend
173.700109] tcp_bpf_sendpage+0x3ce/0x5d0 Fixes: 604326b41a6fb ("bpf, sockmap: convert to generic sk_msg interface") Signed-off-by: John Fastabend --- include/linux/skmsg.h |1 + net/ipv4/tcp_bpf.c|1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/skmsg.h b/i

[PATCH 1/2] bpf: sockmap, msg_pop_data can incorrecty set an sge length

2020-05-04 Thread John Fastabend
took us a while to hit this case because typically we pop headers which seem to rarely be at the end of a scatterlist elements but we can't rely on this. Fixes: 7246d8ed4dcce ("bpf: helper to pop data from messages") Signed-off-by: John Fastabend --- net/core/filter.c |2 +- 1 f

[PATCH 0/2] sockmap, fix for some error paths with helpers

2020-05-04 Thread John Fastabend
In these two cases sk_msg layout was getting confused with some helper sequences. I found these while cleaning up test_sockmap to do a better job covering the different scenarios. Those patches will go to bpf-next and include tests that cover these two cases. --- John Fastabend (2): bpf

RE: [PATCH bpf-next v3] bpf: bpf_{g,s}etsockopt for struct bpf_sock_addr

2020-05-01 Thread John Fastabend
bpf_sock_addr context instead of doing > generic bpf_sock argument (as suggested by Daniel). Even with > try_socket_lock that doesn't sleep we have a problem where context sk > is already locked and socket lock is non-nestable. > > v2: > * s/BPF_PROG_TYPE_CGROUP_

Re: [PATCH bpf-next 2/3] selftests/bpf: Test that lookup on SOCKMAP/SOCKHASH is allowed

2020-05-01 Thread John Fastabend
Jakub Sitnicki wrote: > On Wed, Apr 29, 2020 at 09:23 PM CEST, John Fastabend wrote: > > Jakub Sitnicki wrote: > >> Now that bpf_map_lookup_elem() is white-listed for SOCKMAP/SOCKHASH, > >> replace the tests which check that verifier prevents lookup on these map >

RE: [PATCH bpf-next v3 0/3] tools: bpftool: probe features for unprivileged users

2020-04-29 Thread John Fastabend
on/bpftool | 2 +- > tools/bpf/bpftool/feature.c | 143 +++--- > 4 files changed, 143 insertions(+), 27 deletions(-) > > -- > 2.20.1 > For the series, Acked-by: John Fastabend

RE: [PATCH bpf-next 3/3] selftests/bpf: Use SOCKMAP for server sockets in bpf_sk_assign test

2020-04-29 Thread John Fastabend
Jakub Sitnicki wrote: > Update bpf_sk_assign test to fetch the server socket from SOCKMAP, now that > map lookup from BPF in SOCKMAP is enabled. This way the test TC BPF program > doesn't need to know what address server socket is bound to. > > Signed-off-by: Jakub Sitnicki &

RE: [PATCH bpf-next 2/3] selftests/bpf: Test that lookup on SOCKMAP/SOCKHASH is allowed

2020-04-29 Thread John Fastabend
et reference. > > Signed-off-by: Jakub Sitnicki > --- For completeness would be nice to add a test passing this into sk_select_reuseport to cover that case as well. Could come as a follow up patch imo. Acked-by: John Fastabend

RE: [PATCH bpf-next 1/3] bpf: Allow bpf_map_lookup_elem for SOCKMAP and SOCKHASH

2020-04-29 Thread John Fastabend
> BPF socket lookup helpers, such as bpf_sk_lookup_tcp. In particular, they > can be used with bpf_sk_assign to direct packets toward a socket on TC > ingress path. > > Suggested-by: Lorenz Bauer > Signed-off-by: Jakub Sitnicki > --- LGTM thanks! Acked-by: John Fastabend

RE: [PATCH bpf-next] bpf: bpf_{g,s}etsockopt for struct bpf_sock

2020-04-28 Thread John Fastabend
we can override CC before the connection is made. > > Signed-off-by: Stanislav Fomichev > --- LGTM. Acked-by: John Fastabend

Re: [RFC PATCH v2 bpf-next 00/15] xdp_flow: Flow offload to XDP

2019-10-22 Thread John Fastabend
Toshiaki Makita wrote: > On 2019/10/19 0:22, John Fastabend wrote: > > Toshiaki Makita wrote: > >> This is a PoC for an idea to offload flow, i.e. TC flower and nftables, > >> to XDP. > >> > > > > I've only read the cover letter so far but

Re: [bpf-next PATCH] bpf: libbpf, support older style kprobe load

2019-10-21 Thread John Fastabend
Andrii Nakryiko wrote: > On Sat, Oct 19, 2019 at 1:30 AM John Fastabend > wrote: > > > > Following ./Documentation/trace/kprobetrace.rst add support for loading > > kprobes programs on older kernels. > > > > My main concern with this is that this code is born

Re: [bpf-next PATCH] bpf: libbpf, add kernel version section parsing back

2019-10-18 Thread John Fastabend
Alexei Starovoitov wrote: > On Fri, Oct 18, 2019 at 9:52 AM Andrii Nakryiko wrote: > > > > On 10/18/19 7:41 AM, John Fastabend wrote: > > > With commit "libbpf: stop enforcing kern_version,..." we removed the > > > kernel version section parsing in f

Re: [bpf-next PATCH] bpf: libbpf, support older style kprobe load

2019-10-18 Thread John Fastabend
Daniel Borkmann wrote: > On Fri, Oct 18, 2019 at 07:54:26AM -0700, John Fastabend wrote: > > Following ./Documentation/trace/kprobetrace.rst add support for loading > > kprobes programs on older kernels. > > > > Signed-off-by: John Fastabend > > --- &

RE: [RFC PATCH v2 bpf-next 00/15] xdp_flow: Flow offload to XDP

2019-10-18 Thread John Fastabend
Toshiaki Makita wrote: > This is a PoC for an idea to offload flow, i.e. TC flower and nftables, > to XDP. > I've only read the cover letter so far but... > * Motivation > > The purpose is to speed up flow based network features like TC flower and > nftables by making use of XDP. > > I chose f

[bpf-next PATCH] bpf: libbpf, support older style kprobe load

2019-10-18 Thread John Fastabend
Following ./Documentation/trace/kprobetrace.rst add support for loading kprobes programs on older kernels. Signed-off-by: John Fastabend --- tools/lib/bpf/libbpf.c | 81 +++- 1 file changed, 73 insertions(+), 8 deletions(-) diff --git a/tools/lib

Re: [PATCH bpf-next 1/2] libbpf: stop enforcing kern_version, populate it for users

2019-10-18 Thread John Fastabend
John Fastabend wrote: > Andrii Nakryiko wrote: > > On Fri, Oct 4, 2019 at 7:36 AM Alexei Starovoitov wrote: > > > > > > On 10/4/19 7:32 AM, Andrii Nakryiko wrote: > > > >> If we are not going to validate the section should we also skip > > >

[bpf-next PATCH] bpf: libbpf, add kernel version section parsing back

2019-10-18 Thread John Fastabend
result. However, keep most the kernel uname() discovery bits so users are not required to insert the version except in these odd cases. Fixes: 5e61f27070292 ("libbpf: stop enforcing kern_version, populate it for users") Signed-off-by: John Fastabend --- tools/lib/bpf/libbpf.c | 21

Re: [PATCH bpf-next v3 1/5] bpf: Support chain calling multiple BPF programs after each other

2019-10-14 Thread John Fastabend
Toke Høiland-Jørgensen wrote: > Alexei Starovoitov writes: > > > On Wed, Oct 09, 2019 at 10:03:43AM +0200, Toke Høiland-Jørgensen wrote: > >> Alexei Starovoitov writes: > >> > >> > Please implement proper indirect calls and jumps. > >> > >> I am still not convinced this will actually solve our

RE: [PATCH bpf-next] libbpf: handle invalid typedef emitted by old GCC

2019-10-11 Thread John Fastabend
Andrii Nakryiko wrote: > Old GCC versions are producing invalid typedef for __gnuc_va_list > pointing to void. Special-case this and emit valid: > > typedef __builtin_va_list __gnuc_va_list; > > Reported-by: John Fastabend > Signed-off-by: Andrii Nakryiko > --- Acked-by: John Fastabend

Re: [PATCH bpf] libbpf: fix compatibility for kernels without need_wakeup

2019-10-11 Thread John Fastabend
Magnus Karlsson wrote: > On Tue, Oct 8, 2019 at 9:29 PM John Fastabend > wrote: > > > > Magnus Karlsson wrote: > > > When the need_wakeup flag was added to AF_XDP, the format of the > > > XDP_MMAP_OFFSETS getsockopt was extended. Code was added to the kernel

RE: [PATCH bpf-next 1/3] libbpf: fix struct end padding in btf_dump

2019-10-08 Thread John Fastabend
ion") > Reported-by: John Fastabend > Signed-off-by: Andrii Nakryiko > --- Tested a few different kernels and seems to have resolved the issue I was seeing. Tested-by: John Fastabend

RE: [PATCH bpf] libbpf: fix compatibility for kernels without need_wakeup

2019-10-08 Thread John Fastabend
Magnus Karlsson wrote: > When the need_wakeup flag was added to AF_XDP, the format of the > XDP_MMAP_OFFSETS getsockopt was extended. Code was added to the kernel > to take care of compatibility issues arrising from running > applications using any of the two formats. However, libbpf was not > exte

RE: [PATCH bpf-next v3 0/5] xdp: Support multiple programs on a single interface through chain calls

2019-10-07 Thread John Fastabend
Toke Høiland-Jørgensen wrote: > This series adds support for executing multiple XDP programs on a single > interface in sequence, through the use of chain calls, as discussed at the > Linux > Plumbers Conference last month: > > https://linuxplumbersconf.org/event/4/contributions/460/ > Can we a

RE: [PATCH bpf-next 02/10] bpf: add typecast to bpf helpers to help BTF generation

2019-10-05 Thread John Fastabend
\ > u64 ##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)) > -- > 2.20.0 > Acked-by: John Fastabend

RE: [PATCH bpf-next 01/10] bpf: add typecast to raw_tracepoints to help BTF generation

2019-10-05 Thread John Fastabend
t useful bug reports out next week. For now I work around them with some code on my side but can confuse tracing programs. Acked-by: John Fastabend

Re: [PATCH bpf-next 1/2] libbpf: stop enforcing kern_version, populate it for users

2019-10-04 Thread John Fastabend
Andrii Nakryiko wrote: > On Fri, Oct 4, 2019 at 7:36 AM Alexei Starovoitov wrote: > > > > On 10/4/19 7:32 AM, Andrii Nakryiko wrote: > > >> If we are not going to validate the section should we also skip > > >> collect'ing it? > > > Well, if user supplied version, we will parse and use it to over

Re: [PATCH bpf-next 1/2] libbpf: stop enforcing kern_version, populate it for users

2019-10-04 Thread John Fastabend
Alexei Starovoitov wrote: > On 10/4/19 7:32 AM, Andrii Nakryiko wrote: > >> If we are not going to validate the section should we also skip > >> collect'ing it? > > Well, if user supplied version, we will parse and use it to override > > out prepopulated one, so in that sense we do have validation

RE: [PATCH net-next 0/6] net/tls: separate the TLS TOE code out

2019-10-04 Thread John Fastabend
oe.c | 139 ++ > 9 files changed, 257 insertions(+), 158 deletions(-) > create mode 100644 include/net/tls_toe.h > create mode 100644 net/tls/tls_toe.c > > -- > 2.21.0 > Looks good to me, nice bit of cleanup. Acked-by: John Fastabend

RE: [PATCH bpf-next 1/2] libbpf: stop enforcing kern_version, populate it for users

2019-10-04 Thread John Fastabend
Andrii Nakryiko wrote: > Kernel version enforcement for kprobes/kretprobes was removed from > 5.0 kernel in 6c4fc209fcf9 ("bpf: remove useless version check for prog > load"). > Since then, BPF programs were specifying SEC("version") just to please > libbpf. We should stop enforcing this in libbpf

Re: [PATCH bpf-next 1/2] bpf, x86: Small optimization in comparing against imm0

2019-10-03 Thread John Fastabend
ing remembering the differences between cmd, and, or, and test. Also wonder if at some point we should clean up the jit a bit and add some defines/helpers for all the open coded opcodes and such. Acked-by: John Fastabend

Re: [PATCH bpf-next 0/9] xdp: Support multiple programs on a single interface through chain calls

2019-10-03 Thread John Fastabend
Jesper Dangaard Brouer wrote: > On Thu, 03 Oct 2019 09:48:22 +0200 > Toke Høiland-Jørgensen wrote: > > > John Fastabend writes: > > > > > Toke Høiland-Jørgensen wrote: > > >> John Fastabend writes: > > >> > > >>

Re: [PATCH bpf-next 0/9] xdp: Support multiple programs on a single interface through chain calls

2019-10-03 Thread John Fastabend
Edward Cree wrote: > On 03/10/2019 15:33, Toke Høiland-Jørgensen wrote: > > In all cases, the sysadmin can't (or doesn't want to) modify any of the > > XDP programs. In fact, they may just be installed as pre-compiled .so > > BPF files on his system. So he needs to be able to configure the call > >

Re: [PATCH bpf-next 1/2] bpf/flow_dissector: add mode to enforce global BPF flow dissector

2019-10-03 Thread John Fastabend
Andrii Nakryiko wrote: > On Thu, Oct 3, 2019 at 9:01 AM Stanislav Fomichev wrote: > > > > On 10/02, Andrii Nakryiko wrote: > > > On Wed, Oct 2, 2019 at 6:43 PM Stanislav Fomichev > > > wrote: > > > > > > > > On 10/02, Andrii Nakryiko wrote: > > > > > On Wed, Oct 2, 2019 at 10:35 AM Stanislav Fom

RE: [PATCH v2 bpf-next 4/7] selftests/bpf: split off tracing-only helpers into bpf_tracing.h

2019-10-03 Thread John Fastabend
Andrii Nakryiko wrote: > Split-off PT_REGS-related helpers into bpf_tracing.h header. Adjust > selftests and samples to include it where necessary. > > Signed-off-by: Andrii Nakryiko > --- Acked-by: John Fastabend

RE: [PATCH v2 bpf-next 2/7] selftests/bpf: samples/bpf: split off legacy stuff from bpf_helpers.h

2019-10-03 Thread John Fastabend
map_in_map() and friends so we can drop legacy. Assuming this is what you have in mind but agree thats a next step. Acked-by: John Fastabend

<    1   2   3   4   5   6   7   8   9   10   >