Re: RFC: Fixing SK_REUSEPORT from sk_lookup_* helpers

2019-05-21 Thread Alexei Starovoitov
On Tue, May 21, 2019 at 04:47:58PM +0100, Lorenz Bauer wrote: > On Fri, 17 May 2019 at 00:38, Nitin Hande wrote: > > > > On Thu, May 16, 2019 at 2:57 PM Alexei Starovoitov > > wrote: > > > > > > On Thu, May 16, 2019 at 09:41:34AM +0100, Lorenz Bauer wrot

[PATCH bpf-next 0/3] bpf: optimize explored_states

2019-05-21 Thread Alexei Starovoitov
Convert explored_states array into hash table and use simple hash to reduce verifier peak memory consumption for programs with bpf2bpf calls. More details in patch 3. Alexei Starovoitov (3): bpf: cleanup explored_states bpf: split explored_states bpf: convert explored_states to hash table

[PATCH bpf-next 2/3] bpf: split explored_states

2019-05-21 Thread Alexei Starovoitov
split explored_states into prune_point boolean mark and link list of explored states. This removes STATE_LIST_MARK hack and allows marks to be separate from states. Signed-off-by: Alexei Starovoitov --- include/linux/bpf_verifier.h | 1 + kernel/bpf/verifier.c| 31

[PATCH bpf-next 3/3] bpf: convert explored_states to hash table

2019-05-21 Thread Alexei Starovoitov
better vs this patch. They can be improved in the future. Hit/miss heuristic is not counting index miscompare as a miss. Otherwise verifier stats become unstable when experimenting with different hash functions. Signed-off-by: Alexei Starovoitov --- include/linux/bpf_verifier.h | 1 + kernel/bpf

[PATCH bpf-next 1/3] bpf: cleanup explored_states

2019-05-21 Thread Alexei Starovoitov
clean up explored_states to prep for introduction of hashtable No functional changes. Signed-off-by: Alexei Starovoitov --- kernel/bpf/verifier.c | 30 +- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c

[PATCH bpf-next 0/3] bpf: increase jmp sequence limit

2019-05-21 Thread Alexei Starovoitov
Patch 1 - jmp sequence limit Patch 2 - improve existing tests Patch 3 - add pyperf-based realistic bpf program that takes advantage of higher limit and use it as a stress test Alexei Starovoitov (3): bpf: bump jmp sequence limit selftests/bpf: adjust verifier scale test selftests/bpf: add

[PATCH bpf-next 2/3] selftests/bpf: adjust verifier scale test

2019-05-21 Thread Alexei Starovoitov
in bpf_fill_scale2. It was testing a bit shorter sequence of jumps than intended. Signed-off-by: Alexei Starovoitov --- tools/testing/selftests/bpf/test_verifier.c | 31 +++-- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/bpf

[PATCH bpf-next 1/3] bpf: bump jmp sequence limit

2019-05-21 Thread Alexei Starovoitov
The limit of 1024 subsequent jumps was causing otherwise valid programs to be rejected. Bump it to 8192 and make the error more verbose. Signed-off-by: Alexei Starovoitov --- kernel/bpf/verifier.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/verifier.c b

[PATCH bpf-next 3/3] selftests/bpf: add pyperf scale test

2019-05-21 Thread Alexei Starovoitov
ned-off-by: Alexei Starovoitov --- .../bpf/prog_tests/bpf_verif_scale.c | 31 +- tools/testing/selftests/bpf/progs/pyperf.h| 268 ++ tools/testing/selftests/bpf/progs/pyperf100.c | 4 + tools/testing/selftests/bpf/progs/pyperf180.c | 4 + tools/testing/selftests

Re: [PATCH bpf-next 3/3] selftests/bpf: add pyperf scale test

2019-05-21 Thread Alexei Starovoitov
On 5/21/19 5:36 PM, Andrii Nakryiko wrote: >> --- /dev/null >> +++ b/tools/testing/selftests/bpf/progs/pyperf.h >> @@ -0,0 +1,268 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +// Copyright (c) 2019 Facebook > > Maybe let's include a link to an up-to-date real tool, that was used > to create this

Re: [PATCH bpf-next 3/3] bpf: convert explored_states to hash table

2019-05-21 Thread Alexei Starovoitov
On Tue, May 21, 2019 at 05:55:06PM -0700, Andrii Nakryiko wrote: > On Tue, May 21, 2019 at 4:08 PM Alexei Starovoitov wrote: > > > > All prune points inside a callee bpf function most likely will have > > different callsites. For example, if function foo() is called from

[PATCH v2 bpf-next 0/3] bpf: increase jmp sequence limit

2019-05-21 Thread Alexei Starovoitov
Patch 1 - jmp sequence limit Patch 2 - improve existing tests Patch 3 - add pyperf-based realistic bpf program that takes advantage of higher limit and use it as a stress test v1->v2: fixed nit in patch 3. added Andrii's acks Alexei Starovoitov (3): bpf: bump jmp sequence limit selft

[PATCH v2 bpf-next 1/3] bpf: bump jmp sequence limit

2019-05-21 Thread Alexei Starovoitov
The limit of 1024 subsequent jumps was causing otherwise valid programs to be rejected. Bump it to 8192 and make the error more verbose. Signed-off-by: Alexei Starovoitov Acked-by: Andrii Nakryiko --- kernel/bpf/verifier.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff

[PATCH v2 bpf-next 3/3] selftests/bpf: add pyperf scale test

2019-05-21 Thread Alexei Starovoitov
ned-off-by: Alexei Starovoitov Acked-by: Andrii Nakryiko --- .../bpf/prog_tests/bpf_verif_scale.c | 31 +- tools/testing/selftests/bpf/progs/pyperf.h| 268 ++ tools/testing/selftests/bpf/progs/pyperf100.c | 4 + tools/testing/selftests/bpf/progs/pyperf180.c | 4 + too

[PATCH v2 bpf-next 2/3] selftests/bpf: adjust verifier scale test

2019-05-21 Thread Alexei Starovoitov
in bpf_fill_scale2. It was testing a bit shorter sequence of jumps than intended. Signed-off-by: Alexei Starovoitov Acked-by: Andrii Nakryiko --- tools/testing/selftests/bpf/test_verifier.c | 31 +++-- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/tools/testing

[PATCH v2 bpf-next 1/3] bpf: cleanup explored_states

2019-05-21 Thread Alexei Starovoitov
clean up explored_states to prep for introduction of hashtable No functional changes. Signed-off-by: Alexei Starovoitov --- kernel/bpf/verifier.c | 29 - 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c

[PATCH v2 bpf-next 0/3] bpf: optimize explored_states

2019-05-21 Thread Alexei Starovoitov
Convert explored_states array into hash table and use simple hash to reduce verifier peak memory consumption for programs with bpf2bpf calls. More details in patch 3. v1->v2: fixed Jakub's small nit in patch 1 Alexei Starovoitov (3): bpf: cleanup explored_states bpf: split explore

[PATCH v2 bpf-next 3/3] bpf: convert explored_states to hash table

2019-05-21 Thread Alexei Starovoitov
better vs this patch. They can be improved in the future. Hit/miss heuristic is not counting index miscompare as a miss. Otherwise verifier stats become unstable when experimenting with different hash functions. Signed-off-by: Alexei Starovoitov --- include/linux/bpf_verifier.h | 1 + kernel/bpf

[PATCH v2 bpf-next 2/3] bpf: split explored_states

2019-05-21 Thread Alexei Starovoitov
split explored_states into prune_point boolean mark and link list of explored states. This removes STATE_LIST_MARK hack and allows marks to be separate from states. Signed-off-by: Alexei Starovoitov --- include/linux/bpf_verifier.h | 1 + kernel/bpf/verifier.c| 31

Re: [PATCH bpf-next 3/3] bpf: convert explored_states to hash table

2019-05-21 Thread Alexei Starovoitov
On 5/21/19 9:09 PM, Andrii Nakryiko wrote: > >> Hit/miss heuristic is not counting index miscompare as a miss. >> Otherwise verifier stats become unstable when experimenting >> with different hash functions. >> >> If insn comparison is done inside states_equal() then >> miss > hit * 3 + 3 he

Re: [PATCH bpf-next] libbpf: emit diff of mismatched public API, if any

2019-05-22 Thread Alexei Starovoitov
On 5/22/19 9:15 AM, Andrii Nakryiko wrote: > It's easy to have a mismatch of "intended to be public" vs really > exposed API functions. While Makefile does check for this mismatch, if > it actually occurs it's not trivial to determine which functions are > accidentally exposed. This patch dumps out

Re: [PATCH bpf-next v2 0/3] bpf: implement bpf_send_signal() helper

2019-05-22 Thread Alexei Starovoitov
On 5/22/19 9:38 AM, Stanislav Fomichev wrote: > On 05/21, Yonghong Song wrote: >> This patch tries to solve the following specific use case. >> >> Currently, bpf program can already collect stack traces >> through kernel function get_perf_callchain() >> when certain events happens (e.g., cache miss

Re: [RFC PATCH 00/11] bpf, trace, dtrace: DTrace BPF program type implementation and sample use

2019-05-22 Thread Alexei Starovoitov
On Wed, May 22, 2019 at 01:23:27AM -0400, Kris Van Hees wrote: > > Userspace aside, there are various features that are not currently available > such as retrieving the ppid of the current task, and various other data items > that relate to the current task that triggered a probe. There are ways

Re: [PATCH v2 bpf-next] libbpf: emit diff of mismatched public API, if any

2019-05-22 Thread Alexei Starovoitov
On Wed, May 22, 2019 at 10:53 AM Andrii Nakryiko wrote: > > It's easy to have a mismatch of "intended to be public" vs really > exposed API functions. While Makefile does check for this mismatch, if > it actually occurs it's not trivial to determine which functions are > accidentally exposed. This

Re: [PATCH v7 bpf-next 01/16] bpf: verifier: mark verified-insn with sub-register zext flag

2019-05-22 Thread Alexei Starovoitov
On Wed, May 22, 2019 at 07:54:57PM +0100, Jiong Wang wrote: > eBPF ISA specification requires high 32-bit cleared when low 32-bit > sub-register is written. This applies to destination register of ALU32 etc. > JIT back-ends must guarantee this semantic when doing code-gen. x86_64 and > AArch64 ISA

Re: [PATCH v7 bpf-next 01/16] bpf: verifier: mark verified-insn with sub-register zext flag

2019-05-23 Thread Alexei Starovoitov
On Thu, May 23, 2019 at 03:28:15PM +0100, Jiong Wang wrote: > > > On 23 May 2019, at 03:07, Alexei Starovoitov > > wrote: > > > > On Wed, May 22, 2019 at 07:54:57PM +0100, Jiong Wang wrote: > >> eBPF ISA specification requires high 32-bit cleared when low

Re: [PATCH v7 bpf-next 01/16] bpf: verifier: mark verified-insn with sub-register zext flag

2019-05-23 Thread Alexei Starovoitov
On Thu, May 23, 2019 at 09:20:15PM +0100, Jiong Wang wrote: > > Alexei Starovoitov writes: > > > > > well, it made me realize that we're probably doing it wrong, > > since after calling check_reg_arg() we need to re-parse insn encoding. > > How

Re: [PATCH v8 bpf-next 05/16] bpf: introduce new bpf prog load flags "BPF_F_TEST_RND_HI32"

2019-05-24 Thread Alexei Starovoitov
"poisoning" useless bits. High > 32-bit of a definition is randomized if it is identified as not used by any > later insn. Such randomization is only enabled under testing mode which is > gated by the new bpf prog load flags "BPF_F_TEST_RND_HI32". > > Suggested-by:

Re: [PATCH v3 bpf-next 00/12] BTF-to-C converter

2019-05-24 Thread Alexei Starovoitov
On Fri, May 24, 2019 at 11:59 AM Andrii Nakryiko wrote: > > This patch set adds BTF-to-C dumping APIs to libbpf, allowing to output > a subset of BTF types as a compilable C type definitions. This is useful by > itself, as raw BTF output is not easy to inspect and comprehend. But it's also > a big

Re: [PATCH v9 bpf-next 00/17] bpf: eliminate zero extensions for sub-register writes

2019-05-24 Thread Alexei Starovoitov
On Fri, May 24, 2019 at 11:25:11PM +0100, Jiong Wang wrote: > v9: > - Split patch 5 in v8. > make bpf uapi header file sync a separate patch. (Alexei) 9th time's a charm? ;) Applied. Thanks a lot for all the hard work. It's a great milestone. Please follow up with an optimization for bpf_p

Re: [PATCH bpf-next v3 2/3] libbpf: add bpf_object__load_xattr() API function to pass log_level

2019-05-28 Thread Alexei Starovoitov
On Fri, May 24, 2019 at 3:36 AM Quentin Monnet wrote: > > libbpf was recently made aware of the log_level attribute for programs, > used to specify the level of information expected to be dumped by the > verifier. Function bpf_prog_load_xattr() got support for this log_level > parameter. > > But s

Re: [PATCH net-next 0/7] net: add struct nexthop to fib{6}_info

2019-05-30 Thread Alexei Starovoitov
net/ipv4/nexthop.c | 111 - > net/ipv4/route.c | 5 +- > net/ipv6/addrconf.c| 5 + > net/ipv6/ip6_fib.c | 22 +- > net/ipv6/ndisc.c

Re: [PATCH net-next 0/7] net: add struct nexthop to fib{6}_info

2019-05-30 Thread Alexei Starovoitov
On Thu, May 30, 2019 at 8:16 AM David Ahern wrote: > > On 5/30/19 9:06 AM, Alexei Starovoitov wrote: > > Huge number of core changes and zero tests. > > As mentioned in a past response, there are a number of tests under > selftests that exercise the code paths affected by thi

Re: [PATCH net-next 0/7] net: add struct nexthop to fib{6}_info

2019-05-30 Thread Alexei Starovoitov
On Thu, May 30, 2019 at 11:01 AM David Miller wrote: > > From: Alexei Starovoitov > Date: Thu, 30 May 2019 08:18:10 -0700 > > > On Thu, May 30, 2019 at 8:16 AM David Ahern wrote: > >> > >> On 5/30/19 9:06 AM, Alexei Starovoitov wrote: > >>

Re: [PATCH net-next 0/7] net: add struct nexthop to fib{6}_info

2019-05-30 Thread Alexei Starovoitov
On Thu, May 30, 2019 at 11:52 AM David Ahern wrote: > > On 5/30/19 12:27 PM, Alexei Starovoitov wrote: > > On Thu, May 30, 2019 at 11:01 AM David Miller wrote: > >> > >> From: Alexei Starovoitov > >> Date: Thu, 30 May 2019 08:18:10 -0700 > >> &

Re: [PATCH v4 bpf-next 0/6] bpf: Propagate cn to TCP

2019-05-31 Thread Alexei Starovoitov
On Fri, May 31, 2019 at 11:13 AM Martin Lau wrote: > > On Tue, May 28, 2019 at 04:59:34PM -0700, brakmo wrote: > > This patchset adds support for propagating congestion notifications (cn) > > to TCP from cgroup inet skb egress BPF programs. > Acked-by: Martin KaFai Lau Applied. Thanks

Re: [PATCH v2 bpf-next] bpf: doc: update answer for 32-bit subregister question

2019-05-31 Thread Alexei Starovoitov
On Thu, May 30, 2019 at 1:42 PM Song Liu wrote: > > On Thu, May 30, 2019 at 1:23 PM Jiong Wang wrote: > > > > There has been quite a few progress around the two steps mentioned in the > > answer to the following question: > > > > Q: BPF 32-bit subregister requirements > > > > This patch updates

Re: [PATCH net-next 0/7] net: add struct nexthop to fib{6}_info

2019-05-31 Thread Alexei Starovoitov
On Fri, May 31, 2019 at 2:38 PM David Ahern wrote: > > On 5/31/19 3:29 PM, David Miller wrote: > > David, can you add some supplementary information to your cover letter > > et al. which seems to be part of what Alexei is asking for and seems > > quite reasonable? > > > > It is not clear to me wh

Re: [PATCH bpf-next v5] selftests/bpf: measure RTT from xdp using xdping

2019-05-31 Thread Alexei Starovoitov
On Fri, May 31, 2019 at 6:37 PM Song Liu wrote: > > > > > On May 31, 2019, at 10:47 AM, Alan Maguire wrote: > > > > xdping allows us to get latency estimates from XDP. Output looks > > like this: > > > > ./xdping -I eth4 192.168.55.8 > > Setting up XDP for eth4, please wait... > > XDP setup disr

Re: [PATCH net-next 0/7] net: add struct nexthop to fib{6}_info

2019-05-31 Thread Alexei Starovoitov
On Fri, May 31, 2019 at 7:59 PM David Ahern wrote: > > On 5/31/19 8:51 PM, Alexei Starovoitov wrote: > > From single sentence of commit log it's not clear at all > > whether they're related to this thread. > > Will they fail if run w/o this set? > > >

pull-request: bpf-next 2019-05-31

2019-05-31 Thread Alexei Starovoitov
flow_dissector.c selftests/bpf: measure RTT from xdp using xdping Alexei Starovoitov (11): bpf: bump jmp sequence limit selftests/bpf: adjust verifier scale test selftests/bpf: add pyperf scale test bpf: cleanup explored_states bpf: split explored_states bpf

Re: [bpf:master 3/3] kernel/bpf/arraymap.c:657:36: error: invalid application of 'sizeof' to incomplete type 'struct perf_sample_data'

2019-06-01 Thread Alexei Starovoitov
Hi Matt, due to this build issue I removed your commit from bpf tree. Please fix and resubmit. Thanks! On Fri, May 31, 2019 at 10:48 PM kbuild test robot wrote: > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git master > head: 0b21b5502f561940e0d29f7ec5f840309e4a0243 > co

Re: [PATCH bpf-next] selftests/bpf: add real-world BPF verifier scale test program

2019-06-01 Thread Alexei Starovoitov
On Fri, May 31, 2019 at 11:39:52PM -0700, Andrii Nakryiko wrote: > This patch adds a new test program, based on real-world production > application, for testing BPF verifier scalability w/ realistic > complexity. Thanks! > - const char *pyperf[] = { > + const char *tp_progs[] = { I had v

Re: [PATCH bpf 0/2] bpf: udp: A few reuseport's bpf_prog for udp lookup

2019-06-03 Thread Alexei Starovoitov
On Fri, May 31, 2019 at 3:29 PM Martin KaFai Lau wrote: > > This series has fixes when running reuseport's bpf_prog for udp lookup. > If there is reuseport's bpf_prog, the common issue is the reuseport code > path expects skb->data pointing to the transport header (udphdr here). > A couple of comm

Re: [RFC PATCH bpf-next 6/8] libbpf: allow specifying map definitions using BTF

2019-06-03 Thread Alexei Starovoitov
On 6/3/19 6:02 PM, Stanislav Fomichev wrote: > Do we want to lock everyone out of new libbpf features? BTF is mandatory for _any_ new feature. It's for introspection and debuggability in the first place. Good debugging is not optional.

Re: [patch net-next v3 0/8] expose flash update status to user

2019-06-04 Thread Alexei Starovoitov
recording which shows flashing FW on a Mellanox > Spectrum device: > https://asciinema.org/a/247926 from api perspective it looks good to me. Thanks! Acked-by: Alexei Starovoitov

Re: [PATCH] bpf: fix uapi bpf_prog_info fields alignment

2019-06-04 Thread Alexei Starovoitov
On Tue, Jun 4, 2019 at 4:40 AM Baruch Siach wrote: > > Merge commit 1c8c5a9d38f60 ("Merge > git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next") undid the > fix from commit 36f9814a494 ("bpf: fix uapi hole for 32 bit compat > applications") by taking the gpl_compatible 1-bit field defini

Re: [PATCH] bpf: fix uapi bpf_prog_info fields alignment

2019-06-04 Thread Alexei Starovoitov
On Tue, Jun 04, 2019 at 05:23:46PM +0200, Geert Uytterhoeven wrote: > Hi Alexei, > > On Tue, Jun 4, 2019 at 5:17 PM Alexei Starovoitov > wrote: > > On Tue, Jun 4, 2019 at 4:40 AM Baruch Siach wrote: > > > Merge commit 1c8c5a9d38f60 ("Merge > > > git:

Re: [PATCH v3 net-next 0/7] net: add struct nexthop to fib{6}_info

2019-06-04 Thread Alexei Starovoitov
On Tue, Jun 4, 2019 at 7:28 PM David Miller wrote: > > From: David Ahern > Date: Mon, 3 Jun 2019 20:19:48 -0700 > > > Set 10 of 11 to improve route scalability via support for nexthops as > > standalone objects for fib entries. > > https://lwn.net/Articles/763950/ > > Series applied, thanks

Re: [PATCH] bpf: fix uapi bpf_prog_info fields alignment

2019-06-04 Thread Alexei Starovoitov
On Tue, Jun 4, 2019 at 9:06 PM Baruch Siach wrote: > > Hi Alexei, > > (Adding Arnd and linux-arch to Cc) > > On Tue, Jun 04, 2019 at 08:30:29AM -0700, Alexei Starovoitov wrote: > > On Tue, Jun 04, 2019 at 05:23:46PM +0200, Geert Uytterhoeven wrote: > > > On T

Re: [PATCH bpf 1/2] bpf: fix unconnected udp hooks

2019-06-05 Thread Alexei Starovoitov
On Wed, Jun 5, 2019 at 5:09 PM Daniel Borkmann wrote: > > >> tools/bpf/bpftool/cgroup.c | 5 - > >> tools/include/uapi/linux/bpf.h | 2 ++ > > Should the bpf.h sync to tools/ be in a separate patch? > > I was thinking about it, but concluded for such small change, it's not > really worth

Re: [PATCH net-next v2 1/2] bpf_xdp_redirect_map: Add flag to return XDP_PASS on map lookup failure

2019-06-06 Thread Alexei Starovoitov
On Thu, Jun 6, 2019 at 8:51 AM Daniel Borkmann wrote: > > On 06/06/2019 03:24 PM, Toke Høiland-Jørgensen wrote: > > From: Toke Høiland-Jørgensen > > > > The bpf_redirect_map() helper used by XDP programs doesn't return any > > indication of whether it can successfully redirect to the map index it

Re: [RFC PATCH bpf-next 6/8] libbpf: allow specifying map definitions using BTF

2019-06-06 Thread Alexei Starovoitov
On 6/6/19 4:02 PM, Andrii Nakryiko wrote: >> struct { >> int type; >> int max_entries; >> } my_map __attribute__((map(int,struct my_value))) = { >> .type = BPF_MAP_TYPE_ARRAY, >> .max_entries = 16, >> }; >> >> Of course this would need BPF backend support, but at

Re: [PATCH bpf v3 0/6] Fix unconnected bpf cgroup hooks

2019-06-06 Thread Alexei Starovoitov
On Thu, Jun 6, 2019 at 4:49 PM Daniel Borkmann wrote: > > Please refer to the patch 1/6 as the main patch with the details > on the current sendmsg hook API limitations and proposal to fix > it in order to work with basic applications like DNS. Remaining > patches are the usual uapi and tooling up

Re: [RFC PATCH bpf-next 6/8] libbpf: allow specifying map definitions using BTF

2019-06-06 Thread Alexei Starovoitov
On 6/6/19 5:10 PM, Jakub Kicinski wrote: > On Thu, 6 Jun 2019 23:27:36 +0000, Alexei Starovoitov wrote: >> On 6/6/19 4:02 PM, Andrii Nakryiko wrote: >>>> struct { >>>> int type; >>>> int max_entries; >>

explicit maps. Was: [RFC PATCH bpf-next 6/8] libbpf: allow specifying map definitions using BTF

2019-06-09 Thread Alexei Starovoitov
On 6/6/19 6:02 PM, Jakub Kicinski wrote: > On Fri, 7 Jun 2019 00:27:52 +0000, Alexei Starovoitov wrote: >> the solution we're discussing should solve BPF_ANNOTATE_KV_PAIR too. >> That hack must go. > > I see. > >> If I understood your objections to Andrii

Re: [PATCH v2 bpf-next] selftests/bpf: fix "alu with different scalars 1" on s390

2019-07-15 Thread Alexei Starovoitov
On Thu, Jul 4, 2019 at 1:53 AM Ilya Leoshkevich wrote: > > BPF_LDX_MEM is used to load the least significant byte of the retrieved > test_val.index, however, on big-endian machines it ends up retrieving > the most significant byte. > > Use the correct least significant byte offset on big-endian ma

Re: [RFC bpf-next 0/8] bpf: accelerate insn patching speed

2019-07-16 Thread Alexei Starovoitov
On Tue, Jul 16, 2019 at 09:50:25AM +0100, Jiong Wang wrote: > > Let me digest a little bit and do some coding, then I will come back. Some > issues can only shown up during in-depth coding. I kind of feel handling > aux reference in verifier layer is the part that will still introduce some > un-cl

Re: [PATCH bpf v3] selftests/bpf: fix "alu with different scalars 1" on s390

2019-07-16 Thread Alexei Starovoitov
On Tue, Jul 16, 2019 at 12:53:53PM +0200, Ilya Leoshkevich wrote: > BPF_LDX_MEM is used to load the least significant byte of the retrieved > test_val.index, however, on big-endian machines it ends up retrieving > the most significant byte. > > Change the test to load the whole int in order to mak

Re: [PATCH bpf v2] selftests/bpf: skip nmi test when perf hw events are disabled

2019-07-16 Thread Alexei Starovoitov
On Tue, Jul 16, 2019 at 07:57:04AM -0700, Andrii Nakryiko wrote: > On Tue, Jul 16, 2019 at 3:56 AM Ilya Leoshkevich wrote: > > > > Some setups (e.g. virtual machines) might run with hardware perf events > > disabled. If this is the case, skip the test_send_signal_nmi test. > > > > Add a separate t

Re: [PATCH bpf] libbpf: fix another GCC8 warning for strncpy

2019-07-16 Thread Alexei Starovoitov
On Tue, Jul 16, 2019 at 10:31 AM Magnus Karlsson wrote: > > On Tue, Jul 16, 2019 at 5:59 AM Andrii Nakryiko wrote: > > > > Similar issue was fixed in cdfc7f888c2a ("libbpf: fix GCC8 warning for > > strncpy") already. This one was missed. Fixing now. > > Thanks Andrii. > > Acked-by: Magnus Karlsso

Re: [PATCH bpf] selftests/bpf: make directory prerequisites order-only

2019-07-16 Thread Alexei Starovoitov
On Mon, Jul 15, 2019 at 3:22 PM Daniel Borkmann wrote: > > On 7/12/19 3:56 PM, Ilya Leoshkevich wrote: > > When directories are used as prerequisites in Makefiles, they can cause > > a lot of unnecessary rebuilds, because a directory is considered changed > > whenever a file in this directory is a

Re: [RFC bpf-next 0/8] bpf: accelerate insn patching speed

2019-07-16 Thread Alexei Starovoitov
On Tue, Jul 16, 2019 at 3:12 PM Jakub Kicinski wrote: > > On Tue, 16 Jul 2019 09:17:03 -0700, Alexei Starovoitov wrote: > > I don't think we have a test for such 'dead prog only due to verifier walk' > > situation. I wonder what happens :) > > FWIW we do ha

Re: [PATCH bpf 1/2] selftests/bpf: fix test_verifier/test_maps make dependencies

2019-07-16 Thread Alexei Starovoitov
On Tue, Jul 16, 2019 at 5:22 PM Andrii Nakryiko wrote: > > Makefile becomes hairier by the day, thx for cleaning it up a bit :-) > > > > > But I also don't think we need to worry about creating them, because > > > there is always at least one test (otherwise those tests are useless > > > anyways)

Re: [PATCH bpf] selftests/bpf: fix perf_buffer on s390

2019-07-16 Thread Alexei Starovoitov
On Tue, Jul 16, 2019 at 10:42 AM Andrii Nakryiko wrote: > > On Tue, Jul 16, 2019 at 5:59 AM Ilya Leoshkevich wrote: > > > > perf_buffer test fails for exactly the same reason test_attach_probe > > used to fail: different nanosleep syscall kprobe name. > > > > Reuse the test_attach_probe fix. > >

Re: [bpf-next RFC 3/6] bpf: add bpf_tcp_gen_syncookie helper

2019-07-16 Thread Alexei Starovoitov
On Tue, Jul 16, 2019 at 09:59:26AM +0200, Eric Dumazet wrote: > > > On 7/16/19 2:26 AM, Petar Penkov wrote: > > From: Petar Penkov > > > > This helper function allows BPF programs to try to generate SYN > > cookies, given a reference to a listener socket. The function works > > from XDP and wit

Re: [PATCH bpf v2] bpf: fix narrower loads on s390

2019-07-18 Thread Alexei Starovoitov
On Thu, Jul 18, 2019 at 05:01:03PM +0200, Ilya Leoshkevich wrote: > The very first check in test_pkt_md_access is failing on s390, which > happens because loading a part of a struct __sk_buff field produces > an incorrect result. > > The preprocessed code of the check is: > > { > __u8 tmp =

Re: [PATCH bpf] selftests/bpf: fix "valid read map access into a read-only array 1" on s390

2019-07-18 Thread Alexei Starovoitov
On Thu, Jul 18, 2019 at 2:14 AM Ilya Leoshkevich wrote: > > This test looks up a 32-bit map element and then loads it using a 64-bit > load. This does not work on s390, which is a big-endian machine. > > Since the point of this test doesn't seem to be loading a smaller value > using a larger load,

Re: [PATCH bpf] selftests/bpf: fix test_xdp_noinline on s390

2019-07-18 Thread Alexei Starovoitov
On Wed, Jul 17, 2019 at 5:29 AM Ilya Leoshkevich wrote: > > test_xdp_noinline fails on s390 due to a handful of endianness issues. > Use ntohs for parsing eth_proto. > Replace bswaps with ntohs/htons. > > Signed-off-by: Ilya Leoshkevich > Acked-by: Vasily Gorbik Applied. Thanks

pull-request: bpf 2019-07-18

2019-07-18 Thread Alexei Starovoitov
Hi David, The following pull-request contains BPF updates for your *net* tree. The main changes are: 1) verifier precision propagation fix, from Andrii. 2) BTF size fix for typedefs, from Andrii. 3) a bunch of big endian fixes, from Ilya. 4) wide load from bpf_sock_addr fixes, from Stanislav.

Re: [PATCH bpf] libbpf: fix SIGSEGV when BTF loading fails, but .BTF.ext exists

2019-07-19 Thread Alexei Starovoitov
On 7/19/19 12:32 PM, Andrii Nakryiko wrote: > In case when BTF loading fails despite sanitization, but BPF object has > .BTF.ext loaded as well, we free and null obj->btf, but not > obj->btf_ext. This leads to an attempt to relocate .BTF.ext later on > during bpf_object__load(), which assumes obj->

Re: [PATCH bpf] libbpf: sanitize VAR to conservative 1-byte INT

2019-07-19 Thread Alexei Starovoitov
On 7/19/19 12:46 PM, Andrii Nakryiko wrote: > If VAR in non-sanitized BTF was size less than 4, converting such VAR > into an INT with size=4 will cause BTF validation failure due to > violationg of STRUCT (into which DATASEC was converted) member size. > Fix by conservatively using size=1. > > Si

Re: [bpf-next 6/6] selftests/bpf: add test for bpf_tcp_gen_syncookie

2019-07-23 Thread Alexei Starovoitov
On Tue, Jul 23, 2019 at 10:37:29AM +0100, Lorenz Bauer wrote: > On Tue, 23 Jul 2019 at 01:20, Petar Penkov wrote: > > +static __always_inline __s64 gen_syncookie(void *data_end, struct bpf_sock > > *sk, > > + void *iph, __u32 ip_size, > > +

Re: [PATCH bpf v3] bpf: fix narrower loads on s390

2019-07-23 Thread Alexei Starovoitov
On Fri, Jul 19, 2019 at 2:18 AM Ilya Leoshkevich wrote: > > The very first check in test_pkt_md_access is failing on s390, which > happens because loading a part of a struct __sk_buff field produces > an incorrect result. > > The preprocessed code of the check is: > > { > __u8 tmp = *((vol

Re: [PATCH v2 00/10] XDP unaligned chunk placement support

2019-07-23 Thread Alexei Starovoitov
Johnathan, Bjorn, Jakub, Please review! The patch set has been pending for a week. On Tue, Jul 16, 2019 at 4:21 AM Kevin Laatz wrote: > > This patch set adds the ability to use unaligned chunks in the XDP umem. > > Currently, all chunk addresses passed to the umem are masked to be chunk > size al

Re: [PATCH bpf 0/2] bpf: gso_segs fixes

2019-07-23 Thread Alexei Starovoitov
On Tue, Jul 23, 2019 at 3:15 AM Eric Dumazet wrote: > > First patch changes the kernel, second patch > adds a new test. > > Note that other patches might be needed to take > care of similar issues in sock_ops_convert_ctx_access() > and SOCK_OPS_GET_FIELD() Nice catch! Applied to bpf tree. Thanks

Re: [PATCH bpf] libbpf: fix using uninitialized ioctl results

2019-07-23 Thread Alexei Starovoitov
On Tue, Jul 23, 2019 at 5:08 AM Ilya Maximets wrote: > > 'channels.max_combined' initialized only on ioctl success and > errno is only valid on ioctl failure. > > The code doesn't produce any runtime issues, but makes memory > sanitizers angry: > > Conditional jump or move depends on uninitialise

Re: [PATCH v2 bpf-next] libbpf: provide more helpful message on uninitialized global var

2019-07-23 Thread Alexei Starovoitov
On 7/23/19 3:03 PM, Song Liu wrote: >> On Jul 23, 2019, at 2:11 PM, Andrii Nakryiko wrote: >> >> When BPF program defines uninitialized global variable, it's put into >> a special COMMON section. Libbpf will reject such programs, but will >> provide very unhelpful message with garbage-looking sect

Re: [PATCH v2 bpf-next 0/5] switch samples and tests to libbpf perf buffer API

2019-07-23 Thread Alexei Starovoitov
On 7/23/19 2:34 PM, Andrii Nakryiko wrote: > There were few more tests and samples that were using custom perf buffer setup > code from trace_helpers.h. This patch set gets rid of all the usages of those > and removes helpers themselves. Libbpf provides nicer, but equally powerful > set of APIs to

Re: [PATCH v2 bpf] libbpf: silence GCC8 warning about string truncation

2019-07-25 Thread Alexei Starovoitov
On Wed, Jul 24, 2019 at 10:46 PM Andrii Nakryiko wrote: > > Despite a proper NULL-termination after strncpy(..., ..., IFNAMSIZ - 1), > GCC8 still complains about *expected* string truncation: > > xsk.c:330:2: error: 'strncpy' output may be truncated copying 15 bytes > from a string of length 1

pull-request: bpf 2019-07-25

2019-07-25 Thread Alexei Starovoitov
) Alexei Starovoitov (1): Merge branch 'fix-gso_segs' Andrii Nakryiko (3): libbpf: fix SIGSEGV when BTF loading fails, but .BTF.ext exists libbpf: sanitize VAR to conservative 1-byte INT libbpf: silence GCC8 warning about string truncation Arnaldo Carvalho

Re: [PATCH bpf-next v2 1/7] bpf/flow_dissector: pass input flags to BPF flow dissector program

2019-07-25 Thread Alexei Starovoitov
On Thu, Jul 25, 2019 at 08:33:36AM -0700, Stanislav Fomichev wrote: > C flow dissector supports input flags that tell it to customize parsing > by either stopping early or trying to parse as deep as possible. Pass > those flags to the BPF flow dissector so it can make the same > decisions. In the n

Re: [PATCH bpf-next 02/10] libbpf: implement BPF CO-RE offset relocation algorithm

2019-07-25 Thread Alexei Starovoitov
On Wed, Jul 24, 2019 at 12:27:34PM -0700, Andrii Nakryiko wrote: > This patch implements the core logic for BPF CO-RE offsets relocations. > All the details are described in code comments. > > Signed-off-by: Andrii Nakryiko > --- > tools/lib/bpf/libbpf.c | 866 +++

Re: [PATCH bpf-next 06/10] selftests/bpf: add CO-RE relocs array tests

2019-07-25 Thread Alexei Starovoitov
On Wed, Jul 24, 2019 at 12:27:38PM -0700, Andrii Nakryiko wrote: > Add tests for various array handling/relocation scenarios. > > Signed-off-by: Andrii Nakryiko ... > + > +#define CORE_READ(dst, src) \ > + bpf_probe_read(dst, sizeof(*src), __builtin_preserve_access_index(src)) This is the ke

Re: [PATCH bpf-next v10 0/2] bpf: Allow bpf_skb_event_output for more prog types

2019-07-25 Thread Alexei Starovoitov
On Tue, Jul 23, 2019 at 5:07 PM Allan Zhang wrote: > > Software event output is only enabled by a few prog types right now (TC, > LWT out, XDP, sockops). Many other skb based prog types need > bpf_skb_event_output to produce software event. > > More prog types are enabled to access bpf_skb_event_o

Re: [PATCH bpf-next v3 0/7] bpf/flow_dissector: support input flags

2019-07-25 Thread Alexei Starovoitov
On Thu, Jul 25, 2019 at 3:52 PM Stanislav Fomichev wrote: > > C flow dissector supports input flags that tell it to customize parsing > by either stopping early or trying to parse as deep as possible. > BPF flow dissector always parses as deep as possible which is sub-optimal. > Pass input flags t

Re: [PATCH bpf-next 2/6] bpf: add BPF_MAP_DUMP command to dump more than one entry per call

2019-07-25 Thread Alexei Starovoitov
On Thu, Jul 25, 2019 at 6:24 PM Brian Vazquez wrote: > > On Thu, Jul 25, 2019 at 4:54 PM Alexei Starovoitov > wrote: > > > > On Thu, Jul 25, 2019 at 04:25:53PM -0700, Brian Vazquez wrote: > > > > > > If prev_key is deleted before map_get_next_k

Re: [PATCH bpf] libbpf: fix erroneous multi-closing of BTF FD

2019-07-26 Thread Alexei Starovoitov
On Fri, Jul 26, 2019 at 2:25 PM Andrii Nakryiko wrote: > > Libbpf stores associated BTF FD per each instance of bpf_program. When > program is unloaded, that FD is closed. This is wrong, because leads to > a race and possibly closing of unrelated files, if application > simultaneously opens new fi

Re: [PATCH bpf-next 4/9] libbpf: add libbpf_swap_print to get previous print func

2019-07-26 Thread Alexei Starovoitov
On Fri, Jul 26, 2019 at 02:47:28PM -0700, Andrii Nakryiko wrote: > On Fri, Jul 26, 2019 at 2:28 PM Stanislav Fomichev wrote: > > > > On 07/26, Andrii Nakryiko wrote: > > > libbpf_swap_print allows to restore previously set print function. > > > This is useful when running many independent test wit

Re: [PATCH bpf-next 6/9] selftests/bpf: abstract away test log output

2019-07-26 Thread Alexei Starovoitov
On Fri, Jul 26, 2019 at 03:26:52PM -0700, Stanislav Fomichev wrote: > On 07/26, Andrii Nakryiko wrote: > > On Fri, Jul 26, 2019 at 2:31 PM Stanislav Fomichev wrote: > > > > > > On 07/26, Andrii Nakryiko wrote: > > > > This patch changes how test output is printed out. By default, if test > > > > h

Re: next-20190723: bpf/seccomp - systemd/journald issue?

2019-07-26 Thread Alexei Starovoitov
On Fri, Jul 26, 2019 at 2:19 PM Sedat Dilek wrote: > > On Fri, Jul 26, 2019 at 11:10 PM Yonghong Song wrote: > > > > > > > > On 7/26/19 2:02 PM, Sedat Dilek wrote: > > > On Fri, Jul 26, 2019 at 10:38 PM Sedat Dilek > > > wrote: > > >> > > >> Hi Yonghong Song, > > >> > > >> On Fri, Jul 26, 2019

Re: [PATCH bpf-next v5 0/6] xdp: Add devmap_hash map type

2019-07-26 Thread Alexei Starovoitov
On Fri, Jul 26, 2019 at 9:06 AM Toke Høiland-Jørgensen wrote: > > This series adds a new map type, devmap_hash, that works like the existing > devmap type, but using a hash-based indexing scheme. This is useful for the > use > case where a devmap is indexed by ifindex (for instance for use with t

Re: [PATCH bpf-next 02/10] libbpf: implement BPF CO-RE offset relocation algorithm

2019-07-27 Thread Alexei Starovoitov
On 7/26/19 11:25 PM, Andrii Nakryiko wrote: >>> + } else if (class == BPF_ST && BPF_MODE(insn->code) == BPF_MEM) { >>> + if (insn->imm != orig_off) >>> + return -EINVAL; >>> + insn->imm = new_off; >>> + pr_debug("prog '%s': patched insn #%

Re: [PATCH v2 bpf-next 0/9] Revamp test_progs as a test running framework

2019-07-27 Thread Alexei Starovoitov
On Sat, Jul 27, 2019 at 12:02 PM Andrii Nakryiko wrote: > > This patch set makes a number of changes to test_progs selftest, which is > a collection of many other tests (and sometimes sub-tests as well), to provide > better testing experience and allow to start convering many individual test > pro

Re: [PATCH v3 bpf-next 0/9] Revamp test_progs as a test running framework

2019-07-27 Thread Alexei Starovoitov
On Sat, Jul 27, 2019 at 8:25 PM Andrii Nakryiko wrote: > > This patch set makes a number of changes to test_progs selftest, which is > a collection of many other tests (and sometimes sub-tests as well), to provide > better testing experience and allow to start convering many individual test > prog

Linux Plumbers BPF micro-conference CFP (reminder)

2019-07-28 Thread Alexei Starovoitov
Hey Folks, August 2nd deadline to submit a proposal for BPF uconf is quickly approaching. If you're attending LPC in Lisbon and interested in awesome BPF uconf you need to submit a proposal. Some of you already submitted them to lpc-bpf@vger per instructions that were sent back on July 12. Some p

Re: [bpf-next,v2 0/6] Introduce a BPF helper to generate SYN cookies

2019-07-29 Thread Alexei Starovoitov
On Mon, Jul 29, 2019 at 09:59:12AM -0700, Petar Penkov wrote: > From: Petar Penkov > > This patch series introduces a BPF helper function that allows generating SYN > cookies from BPF. Currently, this helper is enabled at both the TC hook and > the > XDP hook. > > The first two patches in the s

Re: [PATCH bpf-next v5 0/6] xdp: Add devmap_hash map type

2019-07-29 Thread Alexei Starovoitov
On Fri, Jul 26, 2019 at 7:26 PM Alexei Starovoitov wrote: > > On Fri, Jul 26, 2019 at 9:06 AM Toke Høiland-Jørgensen > wrote: > > > > This series adds a new map type, devmap_hash, that works like the existing > > devmap type, but using a hash-based indexing sch

Re: [PATCH 0/2] tools: bpftool: add net (un)load command to load XDP

2019-07-30 Thread Alexei Starovoitov
On Tue, Jul 30, 2019 at 03:59:15PM -0700, Jakub Kicinski wrote: > On Wed, 31 Jul 2019 03:48:19 +0900, Daniel T. Lee wrote: > > Currently, bpftool net only supports dumping progs loaded on the > > interface. To load XDP prog on interface, user must use other tool > > (eg. iproute2). By this patch, w

Re: [PATCH 0/2] tools: bpftool: add net (un)load command to load XDP

2019-07-30 Thread Alexei Starovoitov
On Tue, Jul 30, 2019 at 05:07:25PM -0700, Jakub Kicinski wrote: > On Tue, 30 Jul 2019 16:17:56 -0700, Alexei Starovoitov wrote: > > On Tue, Jul 30, 2019 at 03:59:15PM -0700, Jakub Kicinski wrote: > > > On Wed, 31 Jul 2019 03:48:19 +0900, Daniel T. Lee wrote: > > > &g

  1   2   3   4   5   6   7   8   9   10   >