[PATCH net 2/2] bpf: sync bpf.h to tools infrastructure

2019-08-08 Thread Daniel Borkmann
Pull in updates in BPF helper function description. Signed-off-by: Daniel Borkmann --- tools/include/uapi/linux/bpf.h | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index 4e455018da65..a5aa7d3ac6a1

[PATCH net 0/2] Fix collisions in socket cookie generation

2019-08-08 Thread Daniel Borkmann
gh it cleanly applies to net-next as well). Went for net tree instead of bpf tree here given the main change is in net/core/sock_diag.c, but either way would be fine with me. Thanks a lot! Daniel Borkmann (2): sock: make cookie generation global instead of per netns bpf: sync bpf.h to

bpf-next is OPEN

2019-07-22 Thread Daniel Borkmann
Merge window is closed, therefore new round begins. Thanks everyone, Daniel

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

2019-07-22 Thread Daniel Borkmann
On 7/19/19 11:06 AM, Ilya Leoshkevich wrote: > "sendmsg6: rewrite IP & port (C)" fails on s390, because the code in > sendmsg_v6_prog() assumes that (ctx->user_ip6[0] & 0x) refers to > leading IPv6 address digits, which is not the case on big-endian > machines. > > Since checking bitwise opera

Re: [GIT PULL 0/2] libbpf build fixes

2019-07-22 Thread Daniel Borkmann
On 7/19/19 4:34 PM, Arnaldo Carvalho de Melo wrote: > Hi Daniel, > > Please consider pulling or applying from the patches, if someone > has any issues, please holler, > > - Arnaldo > > Arnaldo Carvalho de Melo (2): > libbpf: Fix endianness macro usage for some compilers > libbpf: Avoid

Re: [PATCH bpf v4 00/14] sockmap/tls fixes

2019-07-22 Thread Daniel Borkmann
On 7/19/19 7:37 PM, Jakub Kicinski wrote: > On Fri, 19 Jul 2019 10:29:13 -0700, Jakub Kicinski wrote: >> John says: >> >> Resolve a series of splats discovered by syzbot and an unhash >> TLS issue noted by Eric Dumazet. > > Sorry for the delay, this code is quite tricky. According to my testing >

Re: [PATCH v2 bpf-next] selftests/bpf: remove logic duplication in test_verifier.c

2019-07-15 Thread Daniel Borkmann
On 7/12/19 7:44 PM, Andrii Nakryiko wrote: > test_verifier tests can specify single- and multi-runs tests. Internally > logic of handling them is duplicated. Get rid of it by making single run > retval/data specification to be a first run spec. > > Cc: Krzesimir Nowak > Signed-off-by: Andrii Nakr

Re: [PATCH bpf] selftests/bpf: put test_stub.o into $(OUTPUT)

2019-07-15 Thread Daniel Borkmann
On 7/12/19 3:59 PM, Ilya Leoshkevich wrote: > Add a rule to put test_stub.o in $(OUTPUT) and change the references to > it accordingly. This prevents test_stub.o from being created in the > source directory. > > Signed-off-by: Ilya Leoshkevich Applied, thanks!

Re: [PATCH bpf] samples/bpf: build with -D__TARGET_ARCH_$(SRCARCH)

2019-07-15 Thread Daniel Borkmann
On 7/15/19 11:11 AM, Ilya Leoshkevich wrote: > While $ARCH can be relatively flexible (see Makefile and > tools/scripts/Makefile.arch), $SRCARCH always corresponds to a directory > name under arch/. > > Therefore, build samples with -D__TARGET_ARCH_$(SRCARCH), since that > matches the expectations

Re: [PATCH bpf 0/5] bpf: allow wide (u64) aligned loads for some fields of bpf_sock_addr

2019-07-15 Thread Daniel Borkmann
On 7/15/19 6:39 PM, Stanislav Fomichev wrote: > When fixing selftests by adding support for wide stores, Yonghong > reported that he had seen some examples where clang generates > single u64 loads for two adjacent u32s as well: > http://lore.kernel.org/netdev/a66c937f-94c0-eaf8-5b37-8587d66c0...@fb

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

2019-07-15 Thread Daniel Borkmann
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 added, removed or modified. > > If the only thing a target is inte

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

2019-07-15 Thread Daniel Borkmann
On 7/12/19 3:41 PM, Ilya Leoshkevich wrote: > attach_probe test fails, because it cannot install a kprobe on a > non-existent sys_nanosleep symbol. > > Use the correct symbol name for the nanosleep syscall on 64-bit s390. > Don't bother adding one for 31-bit mode, since tests are compiled only > i

Re: [PATCH v3 bpf 0/3] fix BTF verification size resolution

2019-07-15 Thread Daniel Borkmann
On 7/12/19 7:25 PM, Andrii Nakryiko wrote: > BTF size resolution logic isn't always resolving type size correctly, leading > to erroneous map creation failures due to value size mismatch. > > This patch set: > 1. fixes the issue (patch #1); > 2. adds tests for trickier cases (patch #2); > 3. and c

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

2019-07-15 Thread Daniel Borkmann
On 7/16/19 12:13 AM, Alexei Starovoitov wrote: > 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

Re: [PATCH v2 bpf-next 0/3] fix BTF verification size resolution

2019-07-12 Thread Daniel Borkmann
On 07/12/2019 05:42 PM, Andrii Nakryiko wrote: > On Fri, Jul 12, 2019 at 5:59 AM Daniel Borkmann wrote: >> On 07/12/2019 08:03 AM, Yonghong Song wrote: >>> On 7/10/19 11:53 PM, Andrii Nakryiko wrote: >>>> BTF size resolution logic isn't always resolving type si

Re: [PATCH bpf-next] net: Don't uninstall an XDP program when none is installed

2019-07-12 Thread Daniel Borkmann
On 07/10/2019 01:16 PM, Maxim Mikityanskiy wrote: > On 2019-06-12 19:14, Maxim Mikityanskiy wrote: >> dev_change_xdp_fd doesn't perform any checks in case it uninstalls an >> XDP program. It means that the driver's ndo_bpf can be called with >> XDP_SETUP_PROG asking to set it to NULL even if it's a

Re: [PATCH bpf-next] selftests/bpf: remove logic duplication in test_verifier.c

2019-07-12 Thread Daniel Borkmann
On 07/12/2019 09:53 AM, Krzesimir Nowak wrote: > On Thu, Jul 11, 2019 at 4:43 PM Andrii Nakryiko > wrote: >> >> On Thu, Jul 11, 2019 at 5:13 AM Krzesimir Nowak wrote: >>> >>> On Thu, Jul 11, 2019 at 3:08 AM Andrii Nakryiko wrote: test_verifier tests can specify single- and multi-runs t

Re: [PATCH v4 bpf-next 0/4] selftests/bpf: fix compiling loop{1,2,3}.c on s390

2019-07-12 Thread Daniel Borkmann
On 07/12/2019 10:55 AM, Ilya Leoshkevich wrote: >> Am 11.07.2019 um 22:35 schrieb Stanislav Fomichev : >> >> On 07/11, Ilya Leoshkevich wrote: >>> Use PT_REGS_RC(ctx) instead of ctx->rax, which is not present on s390. >>> >>> This patch series consists of three preparatory commits, which make it >>

Re: [PATCH v3 bpf] selftests/bpf: do not ignore clang failures

2019-07-12 Thread Daniel Borkmann
On 07/11/2019 11:12 AM, Ilya Leoshkevich wrote: > When compiling an eBPF prog fails, make still returns 0, because > failing clang command's output is piped to llc and therefore its > exit status is ignored. > > When clang fails, pipe the string "clang failed" to llc. This will make > llc fail wit

Re: [PATCH] tools: bpftool: add raw_tracepoint_writable prog type to header

2019-07-12 Thread Daniel Borkmann
On 07/12/2019 03:35 AM, Daniel T. Lee wrote: > From commit 9df1c28bb752 ("bpf: add writable context for raw tracepoints"), > a new type of BPF_PROG, RAW_TRACEPOINT_WRITABLE has been added. > > Since this BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE is not listed at > bpftool's header, it causes a segfaul

Re: [PATCH v2 bpf] selftests/bpf: fix bpf_target_sparc check

2019-07-12 Thread Daniel Borkmann
On 07/10/2019 01:56 PM, Ilya Leoshkevich wrote: > bpf_helpers.h fails to compile on sparc: the code should be checking > for defined(bpf_target_sparc), but checks simply for bpf_target_sparc. > > Also change #ifdef bpf_target_powerpc to #if defined() for consistency. > > Signed-off-by: Ilya Leosh

Re: [PATCH bpf-next] libbpf: fix ptr to u64 conversion warning on 32-bit platforms

2019-07-12 Thread Daniel Borkmann
On 07/12/2019 02:56 PM, Matt Hart wrote: > On Tue, 9 Jul 2019 at 05:30, Yonghong Song wrote: >> On 7/8/19 9:00 PM, Andrii Nakryiko wrote: >>> On 32-bit platforms compiler complains about conversion: >>> >>> libbpf.c: In function ‘perf_event_open_probe’: >>> libbpf.c:4112:17: error: cast from point

Re: [PATCH bpf-next] bpf: fix precision bit propagation for BPF_ST instructions

2019-07-12 Thread Daniel Borkmann
On 07/09/2019 05:32 AM, Andrii Nakryiko wrote: > When backtracking instructions to propagate precision bit for registers > and stack slots, one class of instructions (BPF_ST) weren't handled > causing extra stack slots to be propagated into parent state. Parent > state might not have that much stac

Re: [PATCH v2 bpf-next 0/3] fix BTF verification size resolution

2019-07-12 Thread Daniel Borkmann
On 07/12/2019 08:03 AM, Yonghong Song wrote: > On 7/10/19 11:53 PM, Andrii Nakryiko wrote: >> BTF size resolution logic isn't always resolving type size correctly, leading >> to erroneous map creation failures due to value size mismatch. >> >> This patch set: >> 1. fixes the issue (patch #1); >> 2.

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

2019-07-12 Thread Daniel Borkmann
On 07/10/2019 09:10 PM, Allan Zhang wrote: > Sure, thanks. will do as suggested. Yep, bpf-next is currently closed due to merge window, please resubmit once it reopens. Thanks, Daniel

Re: [PATCH v6 bpf-next 0/3] bpf: add bpf_descendant_of helper

2019-07-12 Thread Daniel Borkmann
On 07/10/2019 08:00 PM, Javier Honduvilla Coto wrote: > Hi all, > > This patch adds the bpf_descendant_of helper which accepts a PID and > returns 1 if the PID of the process currently being executed is a > descendant of it or if it's itself. Returns 0 otherwise. The passed > PID should be the one

Re: [PATCH] MAINTAINERS: update BPF JIT S390 maintainers

2019-07-12 Thread Daniel Borkmann
On 07/11/2019 08:33 PM, David Miller wrote: > From: Vasily Gorbik > Date: Wed, 10 Jul 2019 13:34:54 +0200 > >> Dave, Alexei, Daniel, >> would you take it via one of your trees? Or should I take it via s390? > > I think it can go via the bpf tree. Yep, just applied to bpf, thanks!

Re: [PATCH bpf-next v3] virtio_net: add XDP meta data support

2019-07-09 Thread Daniel Borkmann
On 07/09/2019 05:04 AM, Jason Wang wrote: > On 2019/7/9 上午6:38, Daniel Borkmann wrote: >> On 07/02/2019 04:11 PM, Yuya Kusakabe wrote: >>> On 7/2/19 5:33 PM, Jason Wang wrote: >>>> On 2019/7/2 下午4:16, Yuya Kusakabe wrote: >>>>> This adds XDP

pull-request: bpf-next 2019-07-09

2019-07-08 Thread Daniel Borkmann
perf buffer API tools/bpftool: switch map event_pipe to libbpf's perf_buffer libbpf: add perf_buffer_ prefix to README selftests/bpf: fix test_attach_probe map definition Arnd Bergmann (1): bpf: avoid unused variable warning in tcp_bpf_rtt() Daniel Borkmann (4): Merg

Re: [PATCH bpf-next] selftests/bpf: fix test_reuseport_array on s390

2019-07-08 Thread Daniel Borkmann
On 07/03/2019 01:50 PM, Ilya Leoshkevich wrote: > Fix endianness issue: passing a pointer to 64-bit fd as a 32-bit key > does not work on big-endian architectures. So cast fd to 32-bits when > necessary. > > Signed-off-by: Ilya Leoshkevich Applied, thanks!

Re: [PATCH bpf-next v3 1/6] xsk: replace ndo_xsk_async_xmit with ndo_xsk_wakeup

2019-07-08 Thread Daniel Borkmann
On 07/04/2019 02:42 PM, Magnus Karlsson wrote: > This commit replaces ndo_xsk_async_xmit with ndo_xsk_wakeup. This new > ndo provides the same functionality as before but with the addition of > a new flags field that is used to specifiy if Rx, Tx or both should be > woken up. The previous ndo only

Re: [PATCH bpf-next v3] virtio_net: add XDP meta data support

2019-07-08 Thread Daniel Borkmann
On 07/02/2019 04:11 PM, Yuya Kusakabe wrote: > On 7/2/19 5:33 PM, Jason Wang wrote: >> On 2019/7/2 下午4:16, Yuya Kusakabe wrote: >>> This adds XDP meta data support to both receive_small() and >>> receive_mergeable(). >>> >>> Fixes: de8f3a83b0a0 ("bpf: add meta pointer for direct access") >>> Signed

bpf-next is CLOSED

2019-07-08 Thread Daniel Borkmann
Thanks everyone for the contributions! Only bug fixes from this point forward given the merge window is open. Still going through the remaining batch in patchwork and will send our the bpf-next PR to David later today. Thanks, Daniel

Re: [PATCH bpf-next] selftests/bpf: fix test_attach_probe map definition

2019-07-08 Thread Daniel Borkmann
On 07/06/2019 06:44 AM, Andrii Nakryiko wrote: > ef99b02b23ef ("libbpf: capture value in BTF type info for BTF-defined map > defs") changed BTF-defined maps syntax, while independently merged > 1e8611bbdfc9 ("selftests/bpf: add kprobe/uprobe selftests") added new > test using outdated syntax of map

Re: [PATCH net-next 1/2] bpf: skip sockopt hooks without CONFIG_NET

2019-07-08 Thread Daniel Borkmann
On 07/08/2019 05:06 PM, Yonghong Song wrote: > On 7/8/19 5:57 AM, Arnd Bergmann wrote: >> When CONFIG_NET is disabled, we get a link error: >> >> kernel/bpf/cgroup.o: In function `__cgroup_bpf_run_filter_setsockopt': >> cgroup.c:(.text+0x3010): undefined reference to `lock_sock_nested' >> cgroup.c:

Re: [PATCH bpf-next v3 0/3] bpf: allow wide (u64) aligned stores for some fields of bpf_sock_addr

2019-07-08 Thread Daniel Borkmann
On 07/01/2019 07:38 PM, Stanislav Fomichev wrote: > Clang can generate 8-byte stores for user_ip6 & msg_src_ip6, > let's support that on the verifier side. > > v3: > * fix comments spelling an -> and (Andrii Nakryiko) > > v2: > * Add simple cover letter (Yonghong Song) > * Update comments (Yongho

Re: [PATCH bpf-next] tools: bpftool: add completion for bpftool prog "loadall"

2019-07-08 Thread Daniel Borkmann
On 07/08/2019 03:05 PM, Quentin Monnet wrote: > Bash completion for proposing the "loadall" subcommand is missing. Let's > add it to the completion script. > > Add a specific case to propose "load" and "loadall" for completing: > > $ bpftool prog load >^ cursor is here

Re: [PATCH v7 bpf-next 0/5] libbpf: add perf buffer abstraction and API

2019-07-08 Thread Daniel Borkmann
On 07/06/2019 08:06 PM, Andrii Nakryiko wrote: > This patchset adds a high-level API for setting up and polling perf buffers > associated with BPF_MAP_TYPE_PERF_EVENT_ARRAY map. Details of APIs are > described in corresponding commit. > > Patch #1 adds a set of APIs to set up and work with perf bu

Re: [PATCH bpf-next] selftests/bpf: add test_tcp_rtt to .gitignore

2019-07-05 Thread Daniel Borkmann
On 07/03/2019 10:09 PM, Stanislav Fomichev wrote: > Forgot to add it in the original patch. > > Fixes: b55873984dab ("selftests/bpf: test BPF_SOCK_OPS_RTT_CB") > Reported-by: Andrii Nakryiko > Signed-off-by: Stanislav Fomichev Applied, thanks!

Re: [PATCH bpf-next] selftests/bpf: fix test_align liveliness expectations

2019-07-05 Thread Daniel Borkmann
On 07/03/2019 11:29 PM, Stanislav Fomichev wrote: > Commit 2589726d12a1 ("bpf: introduce bounded loops") caused a change > in the way some registers liveliness is reported in the test_align. > Add missing "_w" to a couple of tests. Note, there are no offset > changes! > > Fixes: 2589726d12a1 ("bpf

Re: [PATCHv2] tools bpftool: Fix json dump crash on powerpc

2019-07-05 Thread Daniel Borkmann
On 07/05/2019 07:26 PM, Quentin Monnet wrote: > 2019-07-05 10:24 UTC-0700 ~ Jakub Kicinski >> On Fri, 5 Jul 2019 14:10:31 +0200, Jiri Olsa wrote: >>> Michael reported crash with by bpf program in json mode on powerpc: >>> >>> # bpftool prog -p dump jited id 14 >>> [{ >>> "name": "0xd00

Re: [PATCH bpf-next v2] tools: bpftool: add "prog run" subcommand to test-run programs

2019-07-05 Thread Daniel Borkmann
On 07/05/2019 07:54 PM, Quentin Monnet wrote: > Add a new "bpftool prog run" subcommand to run a loaded program on input > data (and possibly with input context) passed by the user. > > Print output data (and output context if relevant) into a file or into > the console. Print return value and dur

Re: [PATCH v5 bpf-next 0/4] capture integers in BTF type info for map defs

2019-07-05 Thread Daniel Borkmann
On 07/05/2019 05:50 PM, Andrii Nakryiko wrote: > This patch set implements an update to how BTF-defined maps are specified. The > change is in how integer attributes, e.g., type, max_entries, map_flags, are > specified: now they are captured as part of map definition struct's BTF type > information

Re: [PATCH v5 bpf-next 4/9] libbpf: add kprobe/uprobe attach API

2019-07-05 Thread Daniel Borkmann
On 07/04/2019 02:57 AM, Andrii Nakryiko wrote: > On Wed, Jul 3, 2019 at 9:47 AM Andrii Nakryiko > wrote: [...] >> [1] >> https://lore.kernel.org/bpf/2019062104.4152743-4-andr...@fb.com/T/#m6cfc141e7b57970bc948134bf671a46972b95134 >> >>> with bpf_link with destructor looks good to me, but my

Re: [PATCH bpf-next v3] libbpf: add xsk_ring_prod__nb_free() function

2019-07-05 Thread Daniel Borkmann
On 07/03/2019 02:52 PM, Eelco Chaudron wrote: > When an AF_XDP application received X packets, it does not mean X > frames can be stuffed into the producer ring. To make it easier for > AF_XDP applications this API allows them to check how many frames can > be added into the ring. > > Signed-off-b

Re: pull-request: bpf-next 2019-07-03

2019-07-03 Thread Daniel Borkmann
On 07/04/2019 01:11 AM, Saeed Mahameed wrote: > On Wed, Jul 3, 2019 at 3:47 PM Daniel Borkmann wrote: >> >> Hi David, >> >> The following pull-request contains BPF updates for your *net-next* tree. >> >> There is a minor merge conflict in mlx5 due to 8960b38

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

2019-07-03 Thread Daniel Borkmann
Andrii Nakryiko (2): selftests/bpf: build tests with debug info libbpf: fix GCC8 warning for strncpy Colin Ian King (1): libbpf: fix spelling mistake "conflictling" -> "conflicting" Daniel Borkmann (3): Merge branch 'bpf-af-xdp-mlx5e'

pull-request: bpf 2019-07-03

2019-07-03 Thread Daniel Borkmann
Hi David, The following pull-request contains BPF updates for your *net* tree. The main changes are: 1) Fix the interpreter to properly handle BPF_ALU32 | BPF_ARSH on BE architectures, from Jiong. 2) Fix several bugs in the x32 BPF JIT for handling shifts by 0, from Luke and Xi. 3) Fix N

Re: [PATCH bpf v6 0/2] xdp: fix hang while unregistering device bound to xdp socket

2019-07-03 Thread Daniel Borkmann
On 06/28/2019 10:04 AM, Ilya Maximets wrote: > Version 6: > > * Better names for socket state. > > Version 5: > > * Fixed incorrect handling of rtnl_lock. > > Version 4: > > * 'xdp_umem_clear_dev' exposed to be used while unregistering. > * Added XDP socket state to track if re

Re: [PATCH bpf v2] selftests: bpf: fix inlines in test_lwt_seg6local

2019-07-03 Thread Daniel Borkmann
On 07/02/2019 07:40 PM, Jiri Benc wrote: > Selftests are reporting this failure in test_lwt_seg6local.sh: > > + ip netns exec ns2 ip -6 route add fb00::6 encap bpf in obj > test_lwt_seg6local.o sec encap_srh dev veth2 > Error fetching program/map! > Failed to parse eBPF program: Operation not per

Re: [PATCH bpf-next v2 0/8] bpf: TCP RTT sock_ops bpf callback

2019-07-03 Thread Daniel Borkmann
On 07/02/2019 06:13 PM, Stanislav Fomichev wrote: > Congestion control team would like to have a periodic callback to > track some TCP statistics. Let's add a sock_ops callback that can be > selectively enabled on a socket by socket basis and is executed for > every RTT. BPF program frequency can b

Re: [PATCH bpf-next] selftests: bpf: standardize to static __always_inline

2019-07-03 Thread Daniel Borkmann
On 07/02/2019 08:26 PM, Jiri Benc wrote: > The progs for bpf selftests use several different notations to force > function inlining. Standardize to what most of them use, > static __always_inline. > > Suggested-by: Song Liu > Signed-off-by: Jiri Benc Applied, thanks!

Re: [PATCH v4 bpf-next] bpf: Add support for fq's EDT to HBM

2019-07-03 Thread Daniel Borkmann
On 07/03/2019 12:09 AM, brakmo wrote: > Adds support for fq's Earliest Departure Time to HBM (Host Bandwidth > Manager). Includes a new BPF program supporting EDT, and also updates > corresponding programs. > > It will drop packets with an EDT of more than 500us in the future > unless the packet b

Re: [PATCH bpf-next] selftests/bpf: fix compiling loop{1,2,3}.c on s390

2019-07-03 Thread Daniel Borkmann
On 07/02/2019 05:39 PM, Ilya Leoshkevich wrote: > Use PT_REGS_RC(ctx) instead of ctx->rax, which is not present on s390. > > Pass -D__TARGET_ARCH_$(ARCH) to selftests in order to choose a proper > PT_REGS_RC variant. > > Fix s930 -> s390 typo. > > On s390, provide the forward declaration of stru

Re: [PATCH v5 bpf-next 4/9] libbpf: add kprobe/uprobe attach API

2019-07-03 Thread Daniel Borkmann
On 07/02/2019 01:58 AM, Andrii Nakryiko wrote: > Add ability to attach to kernel and user probes and retprobes. > Implementation depends on perf event support for kprobes/uprobes. > > Signed-off-by: Andrii Nakryiko > Reviewed-by: Stanislav Fomichev > --- > tools/lib/bpf/libbpf.c | 169 +++

Re: [PATCH v2 bpf-next] libbpf: fix GCC8 warning for strncpy

2019-07-03 Thread Daniel Borkmann
On 07/02/2019 05:16 PM, Andrii Nakryiko wrote: > GCC8 started emitting warning about using strncpy with number of bytes > exactly equal destination size, which is generally unsafe, as can lead > to non-zero terminated string being copied. Use IFNAMSIZ - 1 as number > of bytes to ensure name is alwa

Re: [PATCH bpf-next] bpf: fix precision tracking

2019-07-03 Thread Daniel Borkmann
On 06/28/2019 06:24 PM, Alexei Starovoitov wrote: > When equivalent state is found the current state needs to propagate precision > marks. > Otherwise the verifier will prune the search incorrectly. > > There is a price for correctness: > before beforebrokenfixe

Re: [PATCH v4 bpf-next 0/4] libbpf: add perf buffer abstraction and API

2019-07-03 Thread Daniel Borkmann
On 06/30/2019 08:51 AM, Andrii Nakryiko wrote: > This patchset adds a high-level API for setting up and polling perf buffers > associated with BPF_MAP_TYPE_PERF_EVENT_ARRAY map. Details of APIs are > described in corresponding commit. > > Patch #1 adds a set of APIs to set up and work with perf bu

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

2019-06-28 Thread Daniel Borkmann
; Thanks to Dmitry V. Levin his analysis of this bug history. > > Cc: Jiri Olsa > Cc: Daniel Borkmann > Cc: Geert Uytterhoeven > Cc: Linus Torvalds > Signed-off-by: Baruch Siach Applied, thanks!

Re: [PATCH bpf-next v6 0/5] xdp: Allow lookup into devmaps before redirect

2019-06-28 Thread Daniel Borkmann
On 06/28/2019 11:12 AM, Toke Høiland-Jørgensen wrote: > When using the bpf_redirect_map() helper to redirect packets from XDP, the > eBPF > program cannot currently know whether the redirect will succeed, which makes > it > impossible to gracefully handle errors. To properly fix this will probabl

Re: [PATCH bpf-next] selftests/bpf: fix -Wstrict-aliasing in test_sockopt_sk.c

2019-06-28 Thread Daniel Borkmann
On 06/28/2019 03:12 AM, Stanislav Fomichev wrote: > Let's use union with u8[4] and u32 members for sockopt buffer, > that should fix any possible aliasing issues. > > test_sockopt_sk.c: In function ‘getsetsockopt’: > test_sockopt_sk.c:115:2: warning: dereferencing type-punned pointer will > break

Re: [PATCH bpf-next v5 2/3] bpf_xdp_redirect_map: Perform map lookup in eBPF helper

2019-06-28 Thread Daniel Borkmann
On 06/28/2019 09:17 AM, Toke Høiland-Jørgensen wrote: > Daniel Borkmann writes: > >> On 06/23/2019 04:17 AM, 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 &

Re: [PATCH bpf-next v3 1/2] xsk: remove AF_XDP socket from map when the socket is released

2019-06-27 Thread Daniel Borkmann
On 06/20/2019 12:06 PM, Björn Töpel wrote: > From: Björn Töpel > > When an AF_XDP socket is released/closed the XSKMAP still holds a > reference to the socket in a "released" state. The socket will still > use the netdev queue resource, and block newly created sockets from > attaching to that que

Re: [PATCH bpf-next v5 1/3] devmap/cpumap: Use flush list instead of bitmap

2019-06-27 Thread Daniel Borkmann
On 06/23/2019 04:17 AM, Toke Høiland-Jørgensen wrote: > From: Toke Høiland-Jørgensen > > The socket map uses a linked list instead of a bitmap to keep track of > which entries to flush. Do the same for devmap and cpumap, as this means we > don't have to care about the map index when enqueueing th

Re: [PATCH bpf-next v5 2/3] bpf_xdp_redirect_map: Perform map lookup in eBPF helper

2019-06-27 Thread Daniel Borkmann
On 06/23/2019 04:17 AM, 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 was > given. Instead, BPF programs have to track this themselves,

Re: [PATCH bpf-next v5 2/3] bpf_xdp_redirect_map: Perform map lookup in eBPF helper

2019-06-27 Thread Daniel Borkmann
On 06/23/2019 04:17 AM, 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 was > given. Instead, BPF programs have to track this themselves,

Re: [PATCH v2 bpf-next 3/7] libbpf: add kprobe/uprobe attach API

2019-06-27 Thread Daniel Borkmann
On 06/27/2019 12:15 AM, Andrii Nakryiko wrote: > On Wed, Jun 26, 2019 at 7:25 AM Daniel Borkmann wrote: [...] >> What this boils down to is that this should get a proper abstraction, e.g. as >> in struct libbpf_event which holds the event object. There should be helper &g

Re: [PATCH v2 bpf-next 1/3] libbpf: add perf buffer API

2019-06-27 Thread Daniel Borkmann
On 06/26/2019 08:12 AM, Andrii Nakryiko wrote: > BPF_MAP_TYPE_PERF_EVENT_ARRAY map is often used to send data from BPF program > to user space for additional processing. libbpf already has very low-level API > to read single CPU perf buffer, bpf_perf_event_read_simple(), but it's hard to > use and

Re: [PATCH bpf-next V6 00/16] AF_XDP infrastructure improvements and mlx5e support

2019-06-26 Thread Daniel Borkmann
On 06/26/2019 04:35 PM, Tariq Toukan wrote: [...] > v6 changes: > > As Maxim is out of office, I rebased the series on behalf of him, > solved some conflicts, and re-spinned. Thanks for taking over the rebase, Tariq! > Series generated against bpf-next commit: > 572a6928f9e3 xdp: Make __mem_id_d

Re: [PATCH bpf-next] bpf: fix compiler warning with CONFIG_MODULES=n

2019-06-26 Thread Daniel Borkmann
On 06/26/2019 02:35 AM, Yonghong Song wrote: > With CONFIG_MODULES=n, the following compiler warning occurs: > /data/users/yhs/work/net-next/kernel/trace/bpf_trace.c:605:13: warning: > ‘do_bpf_send_signal’ defined but not used [-Wunused-function] > static void do_bpf_send_signal(struct ir

Re: [PATCH v2] samples: bpf: make the use of xdp samples consistent

2019-06-26 Thread Daniel Borkmann
On 06/25/2019 02:55 AM, Daniel T. Lee wrote: > Currently, each xdp samples are inconsistent in the use. > Most of the samples fetch the interface with it's name. > (ex. xdp1, xdp2skb, xdp_redirect_cpu, xdp_sample_pkts, etc.) > > But some of the xdp samples are fetching the interface with > ifindex

Re: [PATCH bpf-next] selftests/bpf: build tests with debug info

2019-06-26 Thread Daniel Borkmann
On 06/26/2019 12:56 AM, Andrii Nakryiko wrote: > Non-BPF (user land) part of selftests is built without debug info making > occasional debugging with gdb terrible. Build with debug info always. > > Signed-off-by: Andrii Nakryiko Applied, thanks!

Re: [PATCH bpf] bpf: fix BPF_ALU32 | BPF_ARSH on BE arches

2019-06-26 Thread Daniel Borkmann
On 06/25/2019 06:41 PM, Jiong Wang wrote: > Yauheni reported the following code do not work correctly on BE arches: > >ALU_ARSH_X: >DST = (u64) (u32) ((*(s32 *) &DST) >> SRC); >CONT; >ALU_ARSH_K: >DST = (u64) (u32) ((*(s32 *) &DST) >>

Re: [PATCH bpf] tools: bpftool: use correct argument in cgroup errors

2019-06-26 Thread Daniel Borkmann
On 06/25/2019 06:56 PM, Jakub Kicinski wrote: > cgroup code tries to use argv[0] as the cgroup path, > but if it fails uses argv[1] to report errors. > > Fixes: 5ccda64d38cc ("bpftool: implement cgroup bpf operations") > Signed-off-by: Jakub Kicinski > Reviewed-by: Quentin Monnet Applied, thank

Re: [PATCH v2 bpf-next 3/7] libbpf: add kprobe/uprobe attach API

2019-06-26 Thread Daniel Borkmann
On 06/21/2019 06:55 AM, Andrii Nakryiko wrote: > Add ability to attach to kernel and user probes and retprobes. > Implementation depends on perf event support for kprobes/uprobes. > > Signed-off-by: Andrii Nakryiko > --- > tools/lib/bpf/libbpf.c | 207 +++ >

Re: [PATCH v3 bpf-next 0/2] veth: Bulk XDP_TX

2019-06-25 Thread Daniel Borkmann
On 06/13/2019 11:39 AM, Toshiaki Makita wrote: > This introduces bulk XDP_TX in veth. > Improves XDP_TX performance by approximately 9%. The detailed > explanation and performance numbers are shown in patch 2. > > v2: > - Use stack for bulk queue instead of a global variable. > > v3: > - Add act

Re: Removing skb_orphan() from ip_rcv_core()

2019-06-25 Thread Daniel Borkmann
On 06/25/2019 08:37 AM, Eric Dumazet wrote: > On 6/24/19 8:17 PM, Joe Stringer wrote: >> On Fri, Jun 21, 2019 at 1:59 PM Florian Westphal wrote: >>> >>> Joe Stringer wrote: As discussed during LSFMM, I've been looking at adding something like an `skb_sk_assign()` helper to BPF so that l

Re: [PATCH] xsk: sample kernel code is now in libbpf

2019-06-24 Thread Daniel Borkmann
On 06/21/2019 10:13 PM, Eric Leblond wrote: > Fix documentation that mention xdpsock_kern.c which has been > replaced by code embedded in libbpf. > > Signed-off-by: Eric Leblond Applied, thanks!

Re: [PATCH bpf-next v5 00/16] AF_XDP infrastructure improvements and mlx5e support

2019-06-24 Thread Daniel Borkmann
On 06/20/2019 11:13 AM, Björn Töpel wrote: > On Tue, 18 Jun 2019 at 14:00, Maxim Mikityanskiy wrote: >> >> This series contains improvements to the AF_XDP kernel infrastructure >> and AF_XDP support in mlx5e. The infrastructure improvements are >> required for mlx5e, but also some of them benefit

Re: [PATCH bpf-next] bpftool: Add BPF_F_QUERY_EFFECTIVE support in bpftool cgroup [show|tree]

2019-06-24 Thread Daniel Borkmann
On 06/22/2019 12:33 AM, Takshak Chahande wrote: > With different bpf attach_flags available to attach bpf programs specially > with BPF_F_ALLOW_OVERRIDE and BPF_F_ALLOW_MULTI, the list of effective > bpf-programs available to any sub-cgroups really needs to be available for > easy debugging. > > U

Re: [PATCH bpf] samples/bpf: xdp_redirect, correctly get dummy program id

2019-06-24 Thread Daniel Borkmann
On 06/20/2019 08:58 AM, Prashant Bhole wrote: > When we terminate xdp_redirect, it ends up with following message: > "Program on iface OUT changed, not removing" > This results in dummy prog still attached to OUT interface. > It is because signal handler checks if the programs are the same that > w

Re: [PATCH bpf] bpf: fix NULL deref in btf_type_is_resolve_source_only

2019-06-24 Thread Daniel Borkmann
On 06/19/2019 09:01 PM, Stanislav Fomichev wrote: > Commit 1dc92851849c ("bpf: kernel side support for BTF Var and DataSec") > added invocations of btf_type_is_resolve_source_only before > btf_type_nosize_or_null which checks for the NULL pointer. > Swap the order of btf_type_nosize_or_null and > b

Re: [PATCH v2 bpf-next 09/11] selftests/bpf: switch BPF_ANNOTATE_KV_PAIR tests to BTF-defined maps

2019-06-17 Thread Daniel Borkmann
On 06/17/2019 11:41 PM, Song Liu wrote: >> On Jun 17, 2019, at 12:26 PM, Andrii Nakryiko wrote: >> >> Switch tests that already rely on BTF to BTF-defined map definitions. >> >> Signed-off-by: Andrii Nakryiko > > For 09 to 11: > > Acked-by: Song Liu I've added it to patch 10 by hand given the

Re: [PATCH v2 bpf-next 00/11] BTF-defined BPF map definitions

2019-06-17 Thread Daniel Borkmann
On 06/17/2019 11:17 PM, Daniel Borkmann wrote: > On 06/17/2019 09:26 PM, Andrii Nakryiko wrote: >> This patch set implements initial version (as discussed at LSF/MM2019 >> conference) of a new way to specify BPF maps, relying on BTF type >> information, >> which al

Re: [PATCH v2 bpf-next 00/11] BTF-defined BPF map definitions

2019-06-17 Thread Daniel Borkmann
On 06/17/2019 09:26 PM, Andrii Nakryiko wrote: > This patch set implements initial version (as discussed at LSF/MM2019 > conference) of a new way to specify BPF maps, relying on BTF type information, > which allows for easy extensibility, preserving forward and backward > compatibility. See details

Re: [PATCH bpf-next 1/4] bpf: export bpf_sock for BPF_PROG_TYPE_CGROUP_SOCK_ADDR prog type

2019-06-14 Thread Daniel Borkmann
On 06/12/2019 07:30 PM, Stanislav Fomichev wrote: > And let it use bpf_sk_storage_{get,delete} helpers to access socket > storage. Kernel context (struct bpf_sock_addr_kern) already has sk > member, so I just expose it to the BPF hooks. Using PTR_TO_SOCKET > instead of PTR_TO_SOCK_COMMON should be

Re: [PATCH v3 bpf-next 0/3] bpf: net: Detach BPF prog from reuseport sk

2019-06-14 Thread Daniel Borkmann
On 06/13/2019 11:59 PM, Martin KaFai Lau wrote: > v3: > - Use rcu_swap_protected (Stanislav Fomichev) > - Use 0x0047 for SO_DETACH_REUSEPORT_BPF for sparc (kbuild test robot > ) > > v2: > - Copy asm-generic/socket.h to tools/ in the new patch 2 (Stanislav Fomichev) > > This patch adds SO_DETACH_

Re: [PATCH bpf-next] samples/bpf: fix include path in Makefile

2019-06-14 Thread Daniel Borkmann
On 06/14/2019 08:43 AM, Prashant Bhole wrote: > Recent commit included libbpf.h in selftests/bpf/bpf_util.h. > Since some samples use bpf_util.h and samples/bpf/Makefile doesn't > have libbpf.h path included, build was failing. Let's add the path > in samples/bpf/Makefile. > > Signed-off-by: Prash

Re: [PATCH bpf 1/3] devmap: Fix premature entry free on destroying map

2019-06-14 Thread Daniel Borkmann
On 06/14/2019 03:09 PM, Toke Høiland-Jørgensen wrote: > Toshiaki Makita writes: [...] >>> Alternatively, since this entire series should probably go to stable, I >>> can respin mine on top of it? >> >> Indeed conflict will happen, as this is for 'bpf' not 'bpf-next'. >> Sorry for disturbing your w

Re: [PATCH bpf v2 1/2] bpf: simplify definition of BPF_FIB_LOOKUP related flags

2019-06-13 Thread Daniel Borkmann
On 06/12/2019 06:05 PM, Martynas Pumputis wrote: > Previously, the BPF_FIB_LOOKUP_{DIRECT,OUTPUT} flags were defined > with the help of BIT macro. This had the following issues: > > - In order to user any of the flags, a user was required to depend > on . > - No other flag in bpf.h uses the macr

Re: [PATCH net-next] net: sched: ingress: set 'unlocked' flag for Qdisc ops

2019-06-13 Thread Daniel Borkmann
On 06/13/2019 09:06 AM, Vlad Buslov wrote: > On Wed 12 Jun 2019 at 19:33, Daniel Borkmann wrote: >> On 06/12/2019 09:14 AM, Vlad Buslov wrote: >>> To remove rtnl lock dependency in tc filter update API when using ingress >>> Qdisc, set QDISC_CLASS_OPS_DOIT_UNLOCKED flag

Re: [PATCH net-next] net: sched: ingress: set 'unlocked' flag for Qdisc ops

2019-06-12 Thread Daniel Borkmann
On 06/12/2019 09:14 AM, Vlad Buslov wrote: > To remove rtnl lock dependency in tc filter update API when using ingress > Qdisc, set QDISC_CLASS_OPS_DOIT_UNLOCKED flag in ingress Qdisc_class_ops. > > Ingress Qdisc ops don't require any modifications to be used without rtnl > lock on tc filter updat

Re: [PATCH bpf] bpf: net: Set sk_bpf_storage back to NULL for cloned sk

2019-06-12 Thread Daniel Borkmann
On 06/11/2019 11:45 PM, Martin KaFai Lau wrote: > The cloned sk should not carry its parent-listener's sk_bpf_storage. > This patch fixes it by setting it back to NULL. > > Fixes: 6ac99e8f23d4 ("bpf: Introduce bpf sk local storage") > Signed-off-by: Martin KaFai Lau Applied, thanks!

Re: [PATCH v6 bpf-next 0/3] Add a new API libbpf_num_possible_cpus()

2019-06-11 Thread Daniel Borkmann
On 06/11/2019 02:56 AM, Hechao Li wrote: > Getting number of possible CPUs is commonly used for per-CPU BPF maps > and perf_event_maps. Add a new API libbpf_num_possible_cpus() that > helps user with per-CPU related operations and remove duplicate > implementations in bpftool and selftests. > > v2

Re: [PATCH v2 bpf-next] selftests/bpf : clean up feature/ when make clean

2019-06-11 Thread Daniel Borkmann
On 06/11/2019 02:43 AM, Hechao Li wrote: > An error "implicit declaration of function 'reallocarray'" can be thrown > with the following steps: > > $ cd tools/testing/selftests/bpf > $ make clean && make CC= > $ make clean && make CC= > > The cause is that the feature folder generated by GCC 4.8.

Re: [PATCH v2 bpf] bpf: lpm_trie: check left child of last leftmost node for NULL

2019-06-11 Thread Daniel Borkmann
On 06/08/2019 09:54 PM, Jonathan Lemon wrote: > If the leftmost parent node of the tree has does not have a child > on the left side, then trie_get_next_key (and bpftool map dump) will > not look at the child on the right. This leads to the traversal > missing elements. > > Lookup is not affected

Re: [PATCH v4 bpf-next 0/2] bpf: Add a new API

2019-06-07 Thread Daniel Borkmann
On 06/08/2019 01:25 AM, Roman Gushchin wrote: > On 06/07/2019 06:37 PM, Hechao Li wrote: >> Getting number of possible CPUs is commonly used for per-CPU BPF maps >> and perf_event_maps. Add a new API libbpf_num_possible_cpus() that >> helps user with per-CPU related operations and remove duplicate

Re: [PATCH v4 bpf-next 0/2] bpf: Add a new API libbpf_num_possible_cpus()

2019-06-07 Thread Daniel Borkmann
On 06/07/2019 06:37 PM, Hechao Li wrote: > Getting number of possible CPUs is commonly used for per-CPU BPF maps > and perf_event_maps. Add a new API libbpf_num_possible_cpus() that > helps user with per-CPU related operations and remove duplicate > implementations in bpftool and selftests. > > v4

pull-request: bpf 2019-06-07

2019-06-07 Thread Daniel Borkmann
32-bits for and/or/xor on ALU32 selftests: bpf: add zero extend checks for ALU32 and/or/xor Chang-Hsien Tsai (1): samples, bpf: fix to change the buffer size for read() Daniel Borkmann (7): Merge branch 'bpf-subreg-tests' bpf: fix unconnected udp hooks bpf:

[PATCH bpf v3 4/6] bpf, bpftool: enable recvmsg attach types

2019-06-06 Thread Daniel Borkmann
Trivial patch to bpftool in order to complete enabling attaching programs to BPF_CGROUP_UDP{4,6}_RECVMSG. Signed-off-by: Daniel Borkmann Acked-by: Andrey Ignatov Acked-by: Martin KaFai Lau --- tools/bpf/bpftool/Documentation/bpftool-cgroup.rst | 6 +- tools/bpf/bpftool/Documentation

<    4   5   6   7   8   9   10   11   12   13   >