[PATCH bpf v2] bpf: don't leave partial mangled prog in jit_subprogs error path

2018-07-12 Thread Daniel Borkmann
ons. Instead we should just bail out entirely and return an error to the user who is trying to load the program. Fixes: 1c2a088a6626 ("bpf: x64: add JIT support for multi-function programs") Reported-by: syzbot+7d427828b2ea6e592...@syzkaller.appspotmail.com Signed-off-by: Daniel B

Re: [PATCH 00/14] ARM BPF jit compiler improvements

2018-07-12 Thread Daniel Borkmann
On 07/11/2018 11:30 AM, Russell King - ARM Linux wrote: > Hi, > > This series improves the ARM BPF JIT compiler by: > - enumerating the stack layout rather than using constants that happen > to be multiples of four > - rejig the BPF "register" accesses to use negative numbers instead of >

Re: [PATCH bpf-next 0/3] bpf: install eBPF helper man page along with bpftool doc

2018-07-12 Thread Daniel Borkmann
On 07/12/2018 01:52 PM, Quentin Monnet wrote: > The three patches in this series are related to the documentation for eBPF > helpers. The first patch brings minor formatting edits to the documentation > in include/uapi/linux/bpf.h, and the second one updates the related header > file under tools/.

[PATCH bpf] bpf: don't leave partially mangled prog in jit_subprogs error path

2018-07-12 Thread Daniel Borkmann
ons. Instead we should just bail out entirely and return an error to the user who is trying to load the program. Fixes: 1c2a088a6626 ("bpf: x64: add JIT support for multi-function programs") Reported-by: syzbot+7d427828b2ea6e592...@syzkaller.appspotmail.com Signed-off-by: Daniel Bor

Re: [PATCH bpf-next] bpf: better availability probing for seg6 helpers

2018-07-11 Thread Daniel Borkmann
On 07/10/2018 09:20 PM, Daniel Borkmann wrote: > On 07/10/2018 06:54 PM, Mathieu Xhonneux wrote: >> bpf_lwt_seg6_* helpers require CONFIG_IPV6_SEG6_BPF, and currently >> return -EOPNOTSUPP to indicate unavailability. This patch forces the >> BPF verifier to reject programs usi

Re: [PATCH bpf-next v3 00/13] tools: bpf: extend bpftool prog load

2018-07-11 Thread Daniel Borkmann
On 07/10/2018 11:42 PM, Jakub Kicinski wrote: > Hi! > > This series starts with two minor clean ups to test_offload.py > selftest script. > > The next 11 patches extend the abilities of bpftool prog load > beyond the simple cgroup use cases. Three new parameters are > added: > > - type -

[PATCH bpf] bpf: fix panic due to oob in bpf_prog_test_run_skb

2018-07-11 Thread Daniel Borkmann
orted-by: syzbot+709412e651e55ed96...@syzkaller.appspotmail.com Reported-by: syzbot+54f39d6ab58f39720...@syzkaller.appspotmail.com Signed-off-by: Daniel Borkmann --- net/bpf/test_run.c | 17 ++--- tools/testing/selftests/bpf/test_verifier.c | 23 ++- 2 f

Re: [PATCH bpf-next] bpf: better availability probing for seg6 helpers

2018-07-10 Thread Daniel Borkmann
On 07/10/2018 06:54 PM, Mathieu Xhonneux wrote: > bpf_lwt_seg6_* helpers require CONFIG_IPV6_SEG6_BPF, and currently > return -EOPNOTSUPP to indicate unavailability. This patch forces the > BPF verifier to reject programs using these helpers when > !CONFIG_IPV6_SEG6_BPF, allowing users to more

Re: [PATCH net-next 01/13] ARM: net: bpf: enumerate the JIT scratch stack layout

2018-07-10 Thread Daniel Borkmann
Hi Russell, thanks a lot for your work on the arm32 JIT! On 07/10/2018 02:36 PM, Russell King wrote: > Enumerate the contents of the JIT scratch stack layout used for storing > some of the JITs 64-bit registers, tail call counter and AX register. > > XXX: what about the skb_copy_bits buffer -

Re: [PATCH bpf-next v2 11/12] tools: libbpf: allow map reuse

2018-07-10 Thread Daniel Borkmann
On 07/10/2018 08:09 PM, Jakub Kicinski wrote: > On Mon, 9 Jul 2018 21:23:20 -0700, Andrey Ignatov wrote: >> Jakub Kicinski [Mon, 2018-07-09 19:49 -0700]: >>> On Mon, 9 Jul 2018 13:22:54 -0700, Andrey Ignatov wrote: Jakub Kicinski [Mon, 2018-07-09 11:01 -0700]: fd of every map

Re: [PATCH bpf] bpf: fix ldx in ld_abs rewrite for large offsets

2018-07-10 Thread Daniel Borkmann
On 07/10/2018 12:14 PM, Mark Rutland wrote: > On Tue, Jul 10, 2018 at 12:43:22AM +0200, Daniel Borkmann wrote: >> Mark reported that syzkaller triggered a KASAN detected slab-out-of-bounds >> bug in ___bpf_prog_run() with a BPF_LD | BPF_ABS word load at offset 0x8001. &

[PATCH bpf] bpf: fix ldx in ld_abs rewrite for large offsets

2018-07-09 Thread Daniel Borkmann
than S16_MAX offsets into it. For this synthetical case we need to move the full address into tmp register instead and do the LDX without immediate value. Fixes: e0cea7ce988c ("bpf: implement ld_abs/ld_ind in native bpf") Reported-by: syzbot Reported-by: Mark Rutland Signed-off-

Re: [PATCH bpf-next v2 0/6] nfp: bpf: add multiplication and divide support on NFP JIT

2018-07-06 Thread Daniel Borkmann
On 07/07/2018 12:13 AM, Jakub Kicinski wrote: > Jiong says: > > NFP supports u16 and u32 multiplication. Multiplication is done 8-bits per > step, therefore we need 2 steps for u16 and 4 steps for u32. > > We also need one start instruction to initialize the sequence and one or > two

Re: [PATCH bpf-next 11/11] tools: bpftool: allow reuse of maps with bpftool prog load

2018-07-06 Thread Daniel Borkmann
On 07/06/2018 12:57 AM, Jakub Kicinski wrote: > On Thu, 5 Jul 2018 10:35:24 +0200, Daniel Borkmann wrote: >> On 07/04/2018 04:54 AM, Jakub Kicinski wrote: >>> Add map parameter to prog load which will allow reuse of existing >>> maps instead of creating new ones. &

Re: [PATCH bpf-next 11/11] tools: bpftool: allow reuse of maps with bpftool prog load

2018-07-05 Thread Daniel Borkmann
On 07/04/2018 04:54 AM, Jakub Kicinski wrote: > Add map parameter to prog load which will allow reuse of existing > maps instead of creating new ones. > > Signed-off-by: Jakub Kicinski > Reviewed-by: Quentin Monnet [...] > + > + fd = map_parse_fd(, ); > +

Re: [offlist] Re: Crash in netlink/sk_filter_trim_cap on ARMv7 on 4.18rc1

2018-07-05 Thread Daniel Borkmann
On 07/05/2018 09:31 AM, Russell King - ARM Linux wrote: > On Thu, Jul 05, 2018 at 12:41:54AM +0100, Russell King - ARM Linux wrote: >> Subject says offlist, but this isn't... >> >> On Wed, Jul 04, 2018 at 08:33:20AM +0100, Peter Robinson wrote: >>> Sorry for the delay on this from my end. I

Re: [offlist] Re: Crash in netlink/sk_filter_trim_cap on ARMv7 on 4.18rc1

2018-07-04 Thread Daniel Borkmann
On 07/04/2018 09:33 AM, Peter Robinson wrote: > On Tue, Jun 26, 2018 at 1:52 PM, Daniel Borkmann wrote: >> On 06/26/2018 02:23 PM, Peter Robinson wrote: >>>>>> On 06/24/2018 11:24 AM, Peter Robinson wrote: >>>>>>>>> I'm seeing this

Re: [RFC bpf-next 5/6] net/mlx5e: Add XDP RX meta data support

2018-07-04 Thread Daniel Borkmann
On 06/27/2018 04:46 AM, Saeed Mahameed wrote: [...] > @@ -935,11 +958,16 @@ static inline bool mlx5e_xdp_handle(struct mlx5e_rq *rq, > return false; > > xdp.data = va + *rx_headroom; > - xdp_set_data_meta_invalid(); > xdp.data_end = xdp.data + *len; >

Re: [RFC bpf-next 2/6] net: xdp: RX meta data infrastructure

2018-07-04 Thread Daniel Borkmann
On 07/04/2018 02:57 AM, Saeed Mahameed wrote: > On Tue, 2018-07-03 at 16:01 -0700, Alexei Starovoitov wrote: [...] >> How about we make driver+firmware provide a BTF definition of >> metadata that they >> can provide? There can be multiple definitions of such structs. >> Then in userpsace we can

Re: [PATCH bpf] bpf: hash_map: decrement counter on error

2018-07-03 Thread Daniel Borkmann
On 07/03/2018 10:28 PM, Alexei Starovoitov wrote: > On Sun, Jul 01, 2018 at 11:33:58AM -0500, Mauricio Vasquez wrote: >> On 06/30/2018 06:20 PM, Daniel Borkmann wrote: >>> On 06/29/2018 02:48 PM, Mauricio Vasquez B wrote: >>>> Decrement the number of elements in

pull-request: bpf-next 2018-07-03

2018-07-03 Thread Daniel Borkmann
BPF hooks with TFO Daniel Borkmann (1): Merge branch 'bpf-bpftool-libbpf-improvements' Jakub Kicinski (8): tools: bpftool: use correct make variable type to improve compilation time tools: libbpf: add section names for missing program types tools: libbpf: allow setting

Re: [bpf PATCH 1/2] bpf: sockmap, error path can not release psock in multi-map case

2018-07-03 Thread Daniel Borkmann
On 06/30/2018 03:51 PM, John Fastabend wrote: > The current code, in the error path of sock_hash_ctx_update_elem, > checks if the sock has a psock in the user data and if so decrements > the reference count of the psock. However, if the error happens early > in the error path we may have never

Re: [PATCH bpf 3/3] bpf: undo prog rejection on read-only lock failure

2018-07-02 Thread Daniel Borkmann
On 07/02/2018 08:48 PM, Kees Cook wrote: > On Fri, Jun 29, 2018 at 4:47 PM, Daniel Borkmann wrote: >> On 06/29/2018 08:42 PM, Kees Cook wrote: >>> On Thu, Jun 28, 2018 at 2:34 PM, Daniel Borkmann >>> wrote: >>>> Kees suggested that if set_

Re: [RFC bpf-next 2/6] net: xdp: RX meta data infrastructure

2018-07-02 Thread Daniel Borkmann
On 06/27/2018 07:55 PM, Saeed Mahameed wrote: > On Wed, 2018-06-27 at 16:15 +0200, Jesper Dangaard Brouer wrote: >> On Tue, 26 Jun 2018 19:46:11 -0700 >> Saeed Mahameed wrote: >> >>> diff --git a/include/net/xdp.h b/include/net/xdp.h >>> index 2deea7166a34..afe302613ae1 100644 >>> ---

Re: [bpf PATCH v5 0/4] BPF fixes for sockhash

2018-06-30 Thread Daniel Borkmann
On 06/30/2018 03:17 PM, John Fastabend wrote: > This addresses two syzbot issues that lead to identifying (by Eric and > Wei) a class of bugs where we don't correctly check for IPv4/v6 > sockets and their associated state. The second issue was a locking > omission in sockhash. > > The first patch

pull-request: bpf 2018-07-01

2018-06-30 Thread Daniel Borkmann
' Anders Roxell (1): selftests: bpf: add missing NET_SCHED to config Daniel Borkmann (5): Merge branch 'bpf-bpftool-fixes' bpf, arm32: fix to use bpf_jit_binary_lock_ro api bpf, s390: fix potential memleak when later bpf_jit_prog fails bpf: undo prog rejection on read

Re: [PATCH bpf] bpf: hash_map: decrement counter on error

2018-06-30 Thread Daniel Borkmann
On 06/29/2018 02:48 PM, Mauricio Vasquez B wrote: > Decrement the number of elements in the map in case the allocation > of a new node fails. > > Signed-off-by: Mauricio Vasquez B Thanks for the fix, Mauricio! Could you reply with a Fixes: tag in order to track the commit originally

Re: [PATCH bpf-next 0/8] tools: bpf: updates to bpftool and libbpf

2018-06-30 Thread Daniel Borkmann
On 06/28/2018 11:41 PM, Jakub Kicinski wrote: > Hi! > > Set of random updates to bpftool and libbpf. I'm preparing for > extending bpftool prog load, but there is a good number of > improvements that can be made before bpf -> bpf-next merge > helping to keep the later patch set to a manageable

Re: [PATCH net-next v2 3/4] net: check tunnel option type in tunnel flags

2018-06-30 Thread Daniel Borkmann
On 06/29/2018 07:01 PM, Jakub Kicinski wrote: > On Fri, 29 Jun 2018 09:04:15 +0200, Daniel Borkmann wrote: >> On 06/28/2018 06:54 PM, Jakub Kicinski wrote: >>> On Thu, 28 Jun 2018 09:42:06 +0200, Jiri Benc wrote: >>>> On Wed, 27 Jun 2018 11:49:49 +0200, Daniel Bork

Re: [PATCH bpf 3/3] bpf: undo prog rejection on read-only lock failure

2018-06-29 Thread Daniel Borkmann
On 06/29/2018 08:42 PM, Kees Cook wrote: > On Thu, Jun 28, 2018 at 2:34 PM, Daniel Borkmann wrote: >> Kees suggested that if set_memory_*() can fail, we should annotate it with >> __must_check, and all callers need to deal with it gracefully given those >> set_memory_*() mark

Re: [bpf PATCH v4 3/4] bpf: sockhash fix omitted bucket lock in sock_close

2018-06-29 Thread Daniel Borkmann
On 06/25/2018 05:34 PM, John Fastabend wrote: [...] > @@ -2302,9 +2347,12 @@ static int sock_hash_ctx_update_elem(struct > bpf_sock_ops_kern *skops, > goto bucket_err; > } > > - e->hash_link = l_new; > - e->htab = container_of(map, struct bpf_htab, map); > +

Re: [RFC v2 PATCH 1/4] eBPF: Add new eBPF prog type BPF_PROG_TYPE_SOCKET_SG_FILTER

2018-06-29 Thread Daniel Borkmann
On 06/29/2018 09:25 AM, Daniel Borkmann wrote: > On 06/19/2018 08:00 PM, Tushar Dave wrote: >> Add new eBPF prog type BPF_PROG_TYPE_SOCKET_SG_FILTER which uses the >> existing socket filter infrastructure for bpf program attach and load. >> SOCKET_SG_FILTER eBPF program receiv

Re: [RFC v2 PATCH 2/4] ebpf: Add sg_filter_run and sg helper

2018-06-29 Thread Daniel Borkmann
On 06/19/2018 08:00 PM, Tushar Dave wrote: [...] > +int sg_filter_run(struct sock *sk, struct scatterlist *sg) > +{ > + struct sk_filter *filter; > + int err; > + > + rcu_read_lock(); > + filter = rcu_dereference(sk->sk_filter); > + if (filter) { > + struct

Re: [RFC v2 PATCH 1/4] eBPF: Add new eBPF prog type BPF_PROG_TYPE_SOCKET_SG_FILTER

2018-06-29 Thread Daniel Borkmann
On 06/19/2018 08:00 PM, Tushar Dave wrote: > Add new eBPF prog type BPF_PROG_TYPE_SOCKET_SG_FILTER which uses the > existing socket filter infrastructure for bpf program attach and load. > SOCKET_SG_FILTER eBPF program receives struct scatterlist as bpf context > contrast to SOCKET_FILTER which

Re: [RFC v2 PATCH 2/4] ebpf: Add sg_filter_run and sg helper

2018-06-29 Thread Daniel Borkmann
On 06/19/2018 08:00 PM, Tushar Dave wrote: > When sg_filter_run() is invoked it runs the attached eBPF > SOCKET_SG_FILTER program which deals with struct scatterlist. > > In addition, this patch also adds bpf_sg_next helper function that > allows users to retrieve the next sg element from sg

Re: [RFC v2 PATCH 1/4] eBPF: Add new eBPF prog type BPF_PROG_TYPE_SOCKET_SG_FILTER

2018-06-29 Thread Daniel Borkmann
On 06/19/2018 08:00 PM, Tushar Dave wrote: > Add new eBPF prog type BPF_PROG_TYPE_SOCKET_SG_FILTER which uses the > existing socket filter infrastructure for bpf program attach and load. > SOCKET_SG_FILTER eBPF program receives struct scatterlist as bpf context > contrast to SOCKET_FILTER which

Re: [PATCH net-next v2 3/4] net: check tunnel option type in tunnel flags

2018-06-29 Thread Daniel Borkmann
On 06/28/2018 06:54 PM, Jakub Kicinski wrote: > On Thu, 28 Jun 2018 09:42:06 +0200, Jiri Benc wrote: >> On Wed, 27 Jun 2018 11:49:49 +0200, Daniel Borkmann wrote: >>> Looks good to me, and yes in BPF case a mask like TUNNEL_OPTIONS_PRESENT is >>> right approach since thi

Re: [PATCH v3 bpf-net] bpf: Change bpf_fib_lookup to return lookup status

2018-06-28 Thread Daniel Borkmann
On 06/27/2018 01:21 AM, dsah...@kernel.org wrote: > From: David Ahern > > For ACLs implemented using either FIB rules or FIB entries, the BPF > program needs the FIB lookup status to be able to drop the packet. > Since the bpf_fib_lookup API has not reached a released kernel yet, > change the

Re: [PATCH] test_bpf: flag tests that cannot be jited on s390

2018-06-28 Thread Daniel Borkmann
On 06/27/2018 05:19 PM, Kleber Sacilotto de Souza wrote: > Flag with FLAG_EXPECTED_FAIL the BPF_MAXINSNS tests that cannot be jited > on s390 because they exceed BPF_SIZE_MAX and fail when > CONFIG_BPF_JIT_ALWAYS_ON is set. Also set .expected_errcode to -ENOTSUPP > so the tests pass in that case.

Re: [bpf-next PATCH 0/2] xdp/bpf: extend XDP samples/bpf xdp_rxq_info

2018-06-28 Thread Daniel Borkmann
On 06/25/2018 04:27 PM, Jesper Dangaard Brouer wrote: > While writing an article about XDP, the samples/bpf xdp_rxq_info > program were extended to cover some more use-cases. Applied to bpf-next, thanks guys!

[PATCH bpf 3/3] bpf: undo prog rejection on read-only lock failure

2018-06-28 Thread Daniel Borkmann
always succeed the undo part. Reported-by: syzbot+a4eb8c7766952a1ca...@syzkaller.appspotmail.com Reported-by: syzbot+d866d1925855328ea...@syzkaller.appspotmail.com Fixes: 9facc336876f ("bpf: reject any prog that failed read-only lock") Cc: Laura Abbott Cc: Kees Cook Signed-off-by:

[PATCH bpf 1/3] bpf, arm32: fix to use bpf_jit_binary_lock_ro api

2018-06-28 Thread Daniel Borkmann
: 39c13c204bb1 ("arm: eBPF JIT compiler") Signed-off-by: Daniel Borkmann Acked-by: Alexei Starovoitov --- arch/arm/net/bpf_jit_32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c index 6e8b716..f6a62ae 100644 ---

[PATCH bpf 0/3] Three BPF fixes

2018-06-28 Thread Daniel Borkmann
6_64, arm64 and s390x, and kbuild bot wasn't yelling either for the rest. For details, please see patches as usual, thanks! Daniel Borkmann (3): bpf, arm32: fix to use bpf_jit_binary_lock_ro api bpf, s390: fix potential memleak when later bpf_jit_prog fails bpf: undo prog rejection on read-only

[PATCH bpf 2/3] bpf, s390: fix potential memleak when later bpf_jit_prog fails

2018-06-28 Thread Daniel Borkmann
for clobbered registers, program size and to fill in addrs arrray for jump targets, this is more of a theoretical one, but at least make sure this doesn't break with future changes. Fixes: 054623105728 ("s390/bpf: Add s390x eBPF JIT compiler backend") Signed-off-by: Daniel Borkmann

Re: [PATCH bpf 4/4] xsk: fix potential race in SKB TX completion code

2018-06-27 Thread Daniel Borkmann
On 06/27/2018 05:55 PM, Eric Dumazet wrote: > On 06/27/2018 07:02 AM, Magnus Karlsson wrote: >> There was a potential race in the TX completion code for >> the SKB case when the TX napi thread and the error path >> of the sendmsg code could both call the SKB destructor >> at the same time. Fixed

Re: s390x BPF JIT failures with test_bpf

2018-06-27 Thread Daniel Borkmann
On 06/27/2018 12:13 PM, Kleber Souza wrote: > On 06/27/18 12:01, Daniel Borkmann wrote: >> On 06/27/2018 11:40 AM, Kleber Souza wrote: >> [...] >>> When I load the test_bpf module from mainline (v4.18-rc2) with >>> CONFIG_BPF_JIT_ALWAYS_ON=y on a s390x

Re: s390x BPF JIT failures with test_bpf

2018-06-27 Thread Daniel Borkmann
Hi Kleber, On 06/27/2018 11:40 AM, Kleber Souza wrote: [...] > When I load the test_bpf module from mainline (v4.18-rc2) with > CONFIG_BPF_JIT_ALWAYS_ON=y on a s390x system I get the following errors: > > test_bpf: #289 BPF_MAXINSNS: Ctx heavy transformations FAIL to > prog_create err=-524

Re: [PATCH net-next v2 3/4] net: check tunnel option type in tunnel flags

2018-06-27 Thread Daniel Borkmann
iated with them. > > Make sure all users of the infrastructure set correct flags, for the BPF > helper we have to set all bits to keep backward compatibility. > > Signed-off-by: Pieter Jansen van Vuuren > Signed-off-by: Jakub Kicinski > --- > CC: Daniel Borkmann > >

Re: [PATCH bpf-next] selftests/bpf: Test sys_connect BPF hooks with TFO

2018-06-27 Thread Daniel Borkmann
On 06/26/2018 11:22 PM, Andrey Ignatov wrote: > TCP Fast Open is triggered by sys_sendmsg with MSG_FASTOPEN flag for > SOCK_STREAM socket. > > Even though it's sys_sendmsg, it eventually calls __inet_stream_connect > the same way sys_connect does for TCP. __inet_stream_connect, in turn, >

Re: [PATCH RESEND bpf-next v6 1/2] trace_helpers.c: Add helpers to poll multiple perf FDs for events

2018-06-27 Thread Daniel Borkmann
On 06/25/2018 02:25 PM, Toke Høiland-Jørgensen wrote: > Add two new helper functions to trace_helpers that supports polling > multiple perf file descriptors for events. These are used to the XDP > perf_event_output example, which needs to work with one perf fd per CPU. > > Reviewed-by: Jakub

Re: [PATCH bpf-next] nfp: bpf: allow source ptr type be map ptr in memcpy optimization

2018-06-27 Thread Daniel Borkmann
On 06/27/2018 04:48 AM, Jakub Kicinski wrote: > From: Jiong Wang > > Map read has been supported on NFP, this patch enables optimization > for memcpy from map to packet. > > This patch also fixed one latent bug which will cause copying from > unexpected address once memcpy for map pointer

Re: [PATCH bpf-next 2/7] lib: reciprocal_div: implement the improved algorithm on the paper mentioned

2018-06-27 Thread Daniel Borkmann
On 06/26/2018 10:52 PM, Jakub Kicinski wrote: > On Mon, 25 Jun 2018 23:21:10 -0700, Song Liu wrote: >>> +struct reciprocal_value_adv reciprocal_value_adv(u32 d, u8 prec) >>> +{ >>> + struct reciprocal_value_adv R; >>> + u32 l, post_shift; >>> + u64 mhigh, mlow; >>> + >>> +

Re: [offlist] Re: Crash in netlink/sk_filter_trim_cap on ARMv7 on 4.18rc1

2018-06-26 Thread Daniel Borkmann
On 06/26/2018 02:23 PM, Peter Robinson wrote: On 06/24/2018 11:24 AM, Peter Robinson wrote: >>> I'm seeing this netlink/sk_filter_trim_cap crash on ARMv7 across quite >>> a few ARMv7 platforms on Fedora with 4.18rc1. I've tested RPi2/RPi3 >>> (doesn't happen on aarch64), AllWinner

Re: [PATCH bpf] nfp: bpf: don't stop offload if replace failed

2018-06-26 Thread Daniel Borkmann
On 06/22/2018 08:56 PM, Jakub Kicinski wrote: > Stopping offload completely if replace of program failed dates > back to days of transparent offload. Back then we wanted to > silently fall back to the in-driver processing. Today we mark > programs for offload when they are loaded into the

Re: [PATCH v2 bpf-net] bpf: Change bpf_fib_lookup to return lookup status

2018-06-26 Thread Daniel Borkmann
Hi David, first off all sorry for my late reply, been mostly offline last week. I think there's still an issue with the current patch, more below: On 06/21/2018 05:00 AM, dsah...@kernel.org wrote: > From: David Ahern > > For ACLs implemented using either FIB rules or FIB entries, the BPF >

Re: Crash in netlink/sk_filter_trim_cap on ARMv7 on 4.18rc1

2018-06-25 Thread Daniel Borkmann
On 06/24/2018 11:24 AM, Peter Robinson wrote: >>> I'm seeing this netlink/sk_filter_trim_cap crash on ARMv7 across quite >>> a few ARMv7 platforms on Fedora with 4.18rc1. I've tested RPi2/RPi3 >>> (doesn't happen on aarch64), AllWinner H3, BeagleBone and a few >>> others, both LPAE/normal kernels.

bpf-next is OPEN

2018-06-23 Thread Daniel Borkmann
Merge window is over so new bpf-next development round begins. Due to travel this whole week till this Sun mostly offline, but feel free to push your patches out already so they land in patchwork meanwhile.

Re: [PATCH bpf] tools/bpf: fix test_sockmap failure

2018-06-21 Thread Daniel Borkmann
On 06/21/2018 07:02 PM, Yonghong Song wrote: > On one of our production test machine, when running > bpf selftest test_sockmap, I got the following error: > # sudo ./test_sockmap > libbpf: failed to create map (name: 'sock_map'): Operation not permitted > libbpf: failed to load object

Re: [PATCH bpf 0/2] tools: bpftool: small fixes for error handling in prog load

2018-06-21 Thread Daniel Borkmann
On 06/20/2018 08:42 PM, Jakub Kicinski wrote: > Hi! > > Two small fixes for error handling in bpftool prog load, first patch > removes a duplicated message, second one frees resources correctly. > Multiple error messages break JSON: > > # bpftool -jp prog load tracex1_kern.o /sys/fs/bpf/a > { >

Re: [PATCH net] bpf: enforce correct alignment for instructions

2018-06-21 Thread Daniel Borkmann
On 06/21/2018 06:08 AM, Eric Dumazet wrote: > On 06/20/2018 08:46 PM, David Miller wrote: >> From: Eric Dumazet >> Date: Wed, 20 Jun 2018 17:24:09 -0700 >> >>> After commit 9facc336876f ("bpf: reject any prog that failed read-only >>> lock") >>> offsetof(struct bpf_binary_header, image) became 3

Re: [PATCH] tc, bpf: add option to dump bpf verifier as C program fragment

2018-06-19 Thread Daniel Borkmann
On 06/18/2018 11:44 PM, David Ahern wrote: > On 6/18/18 2:18 PM, Jakub Kicinski wrote: >> On Sun, 17 Jun 2018 08:48:41 +, Ophir Munk wrote: >>> Similar to cbpf used within tcpdump utility with a "-d" option to dump >>> the compiled packet-matching code in a human readable form - tc has the >>>

pull-request: bpf 2018-06-16

2018-06-15 Thread Daniel Borkmann
-06-15 23:47:15 +0200) Alexei Starovoitov (1): Merge branch 'bpf-fixes' Anders Roxell (1): selftests: bpf: config: add config fragments Björn Töpel (1): xsk: re-add queue id check for XDP_SKB path Daniel Borkmann (3

Re: [PATCH bpf v2] xdp: Fix handling of devmap in generic XDP

2018-06-15 Thread Daniel Borkmann
On 06/14/2018 11:33 AM, Jesper Dangaard Brouer wrote: > On Thu, 14 Jun 2018 18:00:22 +0900 > Toshiaki Makita wrote: >> On 2018/06/14 17:49, Jesper Dangaard Brouer wrote: >>> On Thu, 14 Jun 2018 11:07:42 +0900 >>> Toshiaki Makita wrote: >>> Commit 67f29e07e131 ("bpf: devmap introduce

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

2018-06-15 Thread Daniel Borkmann
On 06/15/2018 09:31 PM, Alexei Starovoitov wrote: > On Fri, Jun 15, 2018 at 02:30:46AM +0200, Daniel Borkmann wrote: >> First one is a panic I ran into while testing the second >> one where we got several syzkaller reports. Series here >> fixes both. >> >

Re: [PATCH bpf-net] selftests/bpf: delete xfrm tunnel when test exits.

2018-06-15 Thread Daniel Borkmann
On 06/15/2018 02:43 PM, William Tu wrote: > On Thu, Jun 14, 2018 at 10:24 PM, Eyal Birger wrote: >> >> >>> On 14 Jun 2018, at 15:01, William Tu wrote: >>> >>> Make the printting of bpf xfrm tunnel better and >>> cleanup xfrm state and policy when xfrm test finishes. >> >> Yeah the ‘tee’ was

Re: [PATCH bpf-net] selftests/bpf: delete xfrm tunnel when test exits.

2018-06-14 Thread Daniel Borkmann
On 06/15/2018 02:05 AM, Daniel Borkmann wrote: > On 06/15/2018 12:30 AM, Martin KaFai Lau wrote: >> On Thu, Jun 14, 2018 at 05:01:06AM -0700, William Tu wrote: >>> Make the printting of bpf xfrm tunnel better and >>> cleanup xfrm state and policy when xfrm test finishes

Re: [PATCH 1/1] selftest: check tunnel type more accurately

2018-06-14 Thread Daniel Borkmann
On 06/13/2018 06:53 PM, Y Song wrote: > On Wed, Jun 13, 2018 at 5:03 AM, Wang Jian wrote: >> Grep tunnel type directly to make sure 'ip' command supports it. >> >> Signed-off-by: Jian Wang > > Acked-by: Yonghong Song Applied to bpf, thanks Jian!

Re: [PATCH bpf 0/2] bpf: fix the load time reporting and make offload test more resilient

2018-06-14 Thread Daniel Borkmann
On 06/14/2018 08:06 PM, Jakub Kicinski wrote: > Hi! > > This small series allows test_offload.py selftest to run on modern > distributions which may create BPF programs for cgroups at boot, > like Ubuntu 18.04. We still expect the program list to not be > altered by any other agent while the

[PATCH net 2/2] tls: fix waitall behavior in tls_sw_recvmsg

2018-06-14 Thread Daniel Borkmann
and returning to application. This is done if currently no ctx->recv_pkt is ready, otherwise continue to process it from our strparser backlog. Fixes: c46234ebb4d1 ("tls: RX path for ktls") Signed-off-by: Daniel Borkmann Acked-by: Dave Watson --- net/tls/tls_sw.c | 6 +- 1 file changed,

[PATCH net 1/2] tls: fix use-after-free in tls_push_record

2018-06-14 Thread Daniel Borkmann
2810a6a05f11d...@syzkaller.appspotmail.com Signed-off-by: Daniel Borkmann Acked-by: Dave Watson --- net/tls/tls_sw.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index 34895b7..2945a3b 100644 --- a/net/tls/tls_s

[PATCH net 0/2] Two tls fixes

2018-06-14 Thread Daniel Borkmann
First one is syzkaller trigered uaf and second one noticed while writing test code with tls ulp. For details please see individual patches. Thanks! Daniel Borkmann (2): tls: fix use-after-free in tls_push_record tls: fix waitall behavior in tls_sw_recvmsg net/tls/tls_sw.c | 32

[PATCH bpf 0/2] Two bpf fixes

2018-06-14 Thread Daniel Borkmann
First one is a panic I ran into while testing the second one where we got several syzkaller reports. Series here fixes both. Thanks! Daniel Borkmann (2): bpf: fix panic in prog load calls cleanup bpf: reject any prog that failed read-only lock include/linux/filter.h | 63

[PATCH bpf 2/2] bpf: reject any prog that failed read-only lock

2018-06-14 Thread Daniel Borkmann
Reported-by: syzbot+3b889862e65a98317...@syzkaller.appspotmail.com Reported-by: syzbot+9e762b52dd17e616a...@syzkaller.appspotmail.com Signed-off-by: Daniel Borkmann --- include/linux/filter.h | 60 -- kernel/bpf/core.c

[PATCH bpf 1/2] bpf: fix panic in prog load calls cleanup

2018-06-14 Thread Daniel Borkmann
and fix that. Fixes: 1c2a088a6626 ("bpf: x64: add JIT support for multi-function programs") Signed-off-by: Daniel Borkmann --- include/linux/filter.h | 3 +++ kernel/bpf/core.c | 14 ++ kernel/bpf/syscall.c | 8 ++-- 3 files changed, 19 insertions(+), 6 deletion

Re: [PATCH bpf-net] selftests/bpf: delete xfrm tunnel when test exits.

2018-06-14 Thread Daniel Borkmann
On 06/15/2018 12:30 AM, Martin KaFai Lau wrote: > On Thu, Jun 14, 2018 at 05:01:06AM -0700, William Tu wrote: >> Make the printting of bpf xfrm tunnel better and >> cleanup xfrm state and policy when xfrm test finishes. > LGTM. The subject tag actually meant s/bpf-net/bpf-next/? > > It makes

Re: [PATCH net-queue] i40e: Fix incorrect skb reserved size on rx

2018-06-13 Thread Daniel Borkmann
On 06/13/2018 10:08 AM, Toshiaki Makita wrote: > i40e_build_skb() reserves I40E_SKB_PAD + (xdp->data - > xdp->data_hard_start) but obviously I40E_SKB_PAD is unnecessary here > and mac_header/data feilds in skb becomes incorrect, and breaks normal > skb receive path as well as XDP receive path. >

[PATCH net/jkirsher] bpf, xdp, i40e: fix i40e_build_skb skb reserve and truesize

2018-06-13 Thread Daniel Borkmann
ot;bpf, i40e: add meta data support") Fixes: 0c8493d90b6b ("i40e: add XDP support for pass and drop actions") Reported-by: Keith Busch Reported-by: Toshiaki Makita Signed-off-by: Daniel Borkmann Cc: Björn Töpel Cc: John Fastabend --- drivers/net/ethernet/intel/i40e/i40e_txrx.c

Re: [bpf PATCH] bpf: selftest fix for sockmap

2018-06-12 Thread Daniel Borkmann
On 06/11/2018 08:47 PM, John Fastabend wrote: > In selftest test_maps the sockmap test case attempts to add a socket > in listening state to the sockmap. This is no longer a valid operation > so it fails as expected. However, the test wrongly reports this as an > error now. Fix the test to avoid

Re: [PATCH bpf v3] tools/bpftool: fix a bug in bpftool perf

2018-06-12 Thread Daniel Borkmann
On 06/12/2018 07:35 AM, Yonghong Song wrote: > Commit b04df400c302 ("tools/bpftool: add perf subcommand") > introduced bpftool subcommand perf to query bpf program > kuprobe and tracepoint attachments. > > The perf subcommand will first test whether bpf subcommand > BPF_TASK_FD_QUERY is supported

Re: [PATCH net] tls: fix NULL pointer dereference on poll

2018-06-12 Thread Daniel Borkmann
On 06/12/2018 07:37 AM, Christoph Hellwig wrote: >> Looks like the recent conversion from poll to poll_mask callback started >> in 152524231023 ("net: add support for ->poll_mask in proto_ops") missed >> to eventually convert kTLS, too: TCP's ->poll was converted over to the >> ->poll_mask in

Re: [PATCH bpf] xsk: re-add queue id check for XDP_SKB path

2018-06-12 Thread Daniel Borkmann
On 06/12/2018 12:02 PM, Björn Töpel wrote: > From: Björn Töpel > > Commit 173d3adb6f43 ("xsk: add zero-copy support for Rx") introduced a > regression on the XDP_SKB receive path, when the queue id checks were > removed. Now, they are back again. > > Fixes: 173d3adb6f43 ("xsk: add zero-copy

pull-request: bpf 2018-06-12

2018-06-11 Thread Daniel Borkmann
: bpf: fix urandom_read build issue Björn Töpel (1): xsk: silence warning on memory allocation failure Daniel Borkmann (1): bpf: implement dummy fops for bpf objects kernel/bpf/inode.c | 14 -- net/xdp/xdp_umem.c | 3 ++- tools/testing

Re: [bpf PATCH v2 1/2] bpf: sockmap, fix crash when ipv6 sock is added

2018-06-11 Thread Daniel Borkmann
Hi John, On 06/08/2018 05:06 PM, John Fastabend wrote: > This fixes a crash where we assign tcp_prot to IPv6 sockets instead > of tcpv6_prot. > > Previously we overwrote the sk->prot field with tcp_prot even in the > AF_INET6 case. This patch ensures the correct tcp_prot and tcpv6_prot > are

Re: [PATCH bpf] xsk: silence warning on memory allocation failure

2018-06-11 Thread Daniel Borkmann
On 06/11/2018 01:57 PM, Björn Töpel wrote: > From: Björn Töpel > > syzkaller reported a warning from xdp_umem_pin_pages(): > > WARNING: CPU: 1 PID: 4537 at mm/slab_common.c:996 kmalloc_slab+0x56/0x70 > mm/slab_common.c:996 > ... > __do_kmalloc mm/slab.c:3713 [inline] >

[PATCH net] tls: fix NULL pointer dereference on poll

2018-06-11 Thread Daniel Borkmann
d one which is now NULL. Convert kTLS over to use ->poll_mask instead. Also instead of POLLIN | POLLRDNORM use the proper EPOLLIN | EPOLLRDNORM bits as the case in tcp_poll_mask() as well that is mangled here. Fixes: 2c7d3dacebd4 ("net/tcp: convert to ->poll_mask") Signed-off-by: D

Re: [PATCH v2] selftests: bpf: fix urandom_read build issue

2018-06-11 Thread Daniel Borkmann
On 06/08/2018 08:51 AM, Anders Roxell wrote: > gcc complains that urandom_read gets built twice. > > gcc -o tools/testing/selftests/bpf/urandom_read > -static urandom_read.c -Wl,--build-id > gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../lib/bpf > -I../../../../include/generated

Re: KASAN: slab-out-of-bounds Read in bpf_skb_change_proto

2018-06-11 Thread Daniel Borkmann
On 06/11/2018 11:52 AM, Dmitry Vyukov wrote: > On Mon, Jun 11, 2018 at 11:42 AM, Daniel Borkmann > wrote: >> On 06/10/2018 05:27 PM, syzbot wrote: >>> Hello, >>> >>> syzbot found the following crash on: >>> >>> HEAD commit:a16afaf7928

Re: KASAN: slab-out-of-bounds Read in bpf_skb_change_proto

2018-06-11 Thread Daniel Borkmann
On 06/10/2018 05:27 PM, syzbot wrote: > Hello, > > syzbot found the following crash on: > > HEAD commit:    a16afaf7928b Merge tag 'for-v4.18' of git://git.kernel.org.. > git tree:   upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=1338f6bf80 > kernel config: 

Re: [bpf PATCH v2 2/2] bpf: sockmap only allow ESTABLISHED sock state

2018-06-09 Thread Daniel Borkmann
Hi John, On 06/08/2018 05:06 PM, John Fastabend wrote: > Per the note in the TLS ULP (which is actually a generic statement > regarding ULPs) > > /* The TLS ulp is currently supported only for TCP sockets > * in ESTABLISHED state. > * Supporting sockets in LISTEN state will require us > *

Re: [RFC PATCH 1/3] ebpf: add next_skb_frag bpf helper for sk filter

2018-06-08 Thread Daniel Borkmann
On 06/08/2018 11:00 PM, Tushar Dave wrote: > Today socket filter only deals with linear skbs. This change allows > ebpf programs to look into non-linear skb e.g. skb frags. This will be > useful when users need to look into data which is not contained in the > linear part of skb. Hmm, I don't

[PATCH bpf] bpf: implement dummy fops for bpf objects

2018-06-08 Thread Daniel Borkmann
unconditionally with -EIO. Fixes: b2197755b263 ("bpf: add support for persistent maps/progs") Reported-by: syzbot+2e7fcab0f56fdbb33...@syzkaller.appspotmail.com Signed-off-by: Daniel Borkmann --- kernel/bpf/inode.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-)

pull-request: bpf 2018-06-08

2018-06-07 Thread Daniel Borkmann
to c09290c5637692a9bfe7740e4c5e693efff12810: bpf, xdp: fix crash in xdp_umem_unaccount_pages (2018-06-07 15:32:28 -0700) Daniel Borkmann (2): bpf: reject passing modified ctx to helper functions bpf, xdp: fix crash

Re: [PATCH bpf-next v6 1/2] trace_helpers.c: Add helpers to poll multiple perf FDs for events

2018-06-07 Thread Daniel Borkmann
Hi Toke, On 06/06/2018 07:58 PM, Toke Høiland-Jørgensen wrote: > Add two new helper functions to trace_helpers that supports polling > multiple perf file descriptors for events. These are used to the XDP > perf_event_output example, which needs to work with one perf fd per CPU. > > Reviewed-by:

Re: [PATCH bpf] tools/bpf: fix selftest get_cgroup_id_user

2018-06-07 Thread Daniel Borkmann
On 06/06/2018 06:12 PM, Yonghong Song wrote: > Commit f269099a7e7a ("tools/bpf: add a selftest for > bpf_get_current_cgroup_id() helper") added a test > for bpf_get_current_cgroup_id() helper. The bpf program > is attached to tracepoint syscalls/sys_enter_nanosleep > and will record the cgroup id

[PATCH bpf] bpf, xdp: fix crash in xdp_umem_unaccount_pages

2018-06-07 Thread Daniel Borkmann
r follow-up introduced the bug via a49049ea2576 ("xsk: simplified umem setup"). Fixes: a49049ea2576 ("xsk: simplified umem setup") Reported-by: syzbot+979217770b09ebf5c...@syzkaller.appspotmail.com Signed-off-by: Daniel Borkmann --- net/xdp/xdp_umem.c | 6 -- 1 file chan

[PATCH bpf] bpf: reject passing modified ctx to helper functions

2018-06-07 Thread Daniel Borkmann
yzkaller.appspotmail.com Reported-by: syzbot+efae31b384d5badbd...@syzkaller.appspotmail.com Signed-off-by: Daniel Borkmann Acked-by: Alexei Starovoitov --- kernel/bpf/verifier.c | 48 +++- tools/testing/selftests/bpf/test_verifier.c | 58 +

pull-request: bpf-next 2018-06-05

2018-06-05 Thread Daniel Borkmann
d MEM_TYPE_ZERO_COPY xsk: add zero-copy support for Rx samples/bpf: xdpsock: use skb Tx path for XDP_SKB Colin Ian King (1): bpf: devmap: remove redundant assignment of dev = dev Daniel Borkmann (17): Merge branch 'bpf-sendmsg-hook' Merge branch 'bpf-ir-decoder'

bpf-next is CLOSED

2018-06-05 Thread Daniel Borkmann
Please only submit bug fixes at this time due to merge window, thank you.

Re: [PATCH bpf-next v3 1/2] trace_helpers.c: Add helpers to poll multiple perf FDs for events

2018-06-05 Thread Daniel Borkmann
Hi Toke, On 06/05/2018 01:14 PM, Toke Høiland-Jørgensen wrote: > Signed-off-by: Toke Høiland-Jørgensen Please no empty commit message. Not sure why from the previous patch you removed it here. > --- > tools/testing/selftests/bpf/trace_helpers.c | 47 > ++- >

Re: AF_XDP. Was: [net-next 00/12][pull request] Intel Wired LAN Driver Updates 2018-06-04

2018-06-05 Thread Daniel Borkmann
On 06/05/2018 10:44 AM, Björn Töpel wrote: > Den tis 5 juni 2018 kl 03:46 skrev Alexander Duyck > : >> On Mon, Jun 4, 2018 at 4:32 PM, Alexei Starovoitov >> wrote: >>> On Mon, Jun 04, 2018 at 03:02:31PM -0700, Alexander Duyck wrote: On Mon, Jun 4, 2018 at 2:27 PM, David Miller wrote: >

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