Re: [PATCH] MAINTAINERS: XDP: restrict N: and K:

2020-07-09 Thread Daniel Borkmann
On 7/9/20 9:42 PM, Alexander A. Klimov wrote: Rationale: Documentation/arm/ixp4xx.rst contains "xdp" as part of "ixdp465" which has nothing to do with XDP. Signed-off-by: Alexander A. Klimov --- See also: https://lore.kernel.org/lkml/20200709132607.7fb42415@carbon/ MAINTAINERS | 4 ++--

Re: [PATCH bpf-next V3 0/2] BPF selftests test runner 'test_progs' use proper shell exit codes

2020-07-08 Thread Daniel Borkmann
On 7/7/20 9:12 AM, Jesper Dangaard Brouer wrote: This patchset makes it easier to use test_progs from shell scripts, by using proper shell exit codes. The process's exit status should be a number between 0 and 255 as defined in man exit(3) else it will be masked to comply. Shell exit codes used

Re: add an API to check if a streamming mapping needs sync calls

2020-07-08 Thread Daniel Borkmann
On 7/8/20 9:44 AM, Christoph Hellwig wrote: On Mon, Jun 29, 2020 at 03:39:01PM +0200, Björn Töpel wrote: On 2020-06-29 15:03, Christoph Hellwig wrote: Hi all, this series lifts the somewhat hacky checks in the XSK code if a DMA streaming mapping needs dma_sync_single_for_{device,cpu} calls to

Re: [PATCH v3 13/16] exit: Factor thread_group_exited out of pidfd_poll

2020-07-07 Thread Daniel Borkmann
On 7/7/20 7:09 PM, Eric W. Biederman wrote: Christian Brauner writes: On Fri, Jul 03, 2020 at 04:37:47PM -0500, Eric W. Biederman wrote: Alexei Starovoitov writes: On Thu, Jul 02, 2020 at 11:41:37AM -0500, Eric W. Biederman wrote: Create an independent helper thread_group_exited report

Re: [PATCH bpf v2] restore behaviour of CAP_SYS_ADMIN allowing the loading of networking bpf programs

2020-07-06 Thread Daniel Borkmann
) and creates maps and loads bpf programs for later use by Android's netd (which has NET_ADMIN but not SYS_ADMIN). Cc: Alexei Starovoitov Cc: Daniel Borkmann Reported-by: John Stultz Fixes: 2c78ee898d8f ("bpf: Implement CAP_BPF") Signed-off-by: Maciej Żenczykowski Thanks so much for help

Re: [PATCH] bpf: lsm: Disable or enable BPF LSM at boot time

2020-07-06 Thread Daniel Borkmann
On 7/6/20 6:57 PM, Lorenzo Fontana wrote: This option adds a kernel parameter 'bpf_lsm', which allows the BPF LSM to be disabled at boot. The purpose of this option is to allow a single kernel image to be distributed with the BPF LSM built in, but not necessarily enabled. Signed-off-by: Lorenzo

Re: [PATCH net] xsk: remove cheap_dma optimization

2020-06-30 Thread Daniel Borkmann
On 6/30/20 7:07 AM, Christoph Hellwig wrote: On Mon, Jun 29, 2020 at 05:18:38PM +0200, Daniel Borkmann wrote: On 6/29/20 5:10 PM, Björn Töpel wrote: On 2020-06-29 15:52, Daniel Borkmann wrote: Ok, fair enough, please work with DMA folks to get this properly integrated and restored

Re: [PATCH net] xsk: remove cheap_dma optimization

2020-06-29 Thread Daniel Borkmann
On 6/29/20 5:10 PM, Björn Töpel wrote: On 2020-06-29 15:52, Daniel Borkmann wrote: Ok, fair enough, please work with DMA folks to get this properly integrated and restored then. Applied, thanks! Daniel, you were too quick! Please revert this one; Christoph just submitted a 4-patch-series

Re: [PATCH net] xsk: remove cheap_dma optimization

2020-06-29 Thread Daniel Borkmann
On 6/28/20 7:16 PM, Björn Töpel wrote: On 2020-06-27 09:04, Christoph Hellwig wrote: On Sat, Jun 27, 2020 at 01:00:19AM +0200, Daniel Borkmann wrote: Given there is roughly a ~5 weeks window at max where this removal could still be applied in the worst case, could we come up with a fix

Re: [PATCH net] xsk: remove cheap_dma optimization

2020-06-26 Thread Daniel Borkmann
On 6/26/20 3:43 PM, Björn Töpel wrote: From: Björn Töpel When the AF_XDP buffer allocation API was introduced it had an optimization, "cheap_dma". The idea was that when the umem was DMA mapped, the pool also checked whether the mapping required a synchronization (CPU to device, and vice

Re: [PATCH][next] libbpf: fix spelling mistake "kallasyms" -> "kallsyms"

2020-06-24 Thread Daniel Borkmann
On 6/23/20 10:42 AM, Colin King wrote: From: Colin Ian King There is a spelling mistake in a pr_warn message. Fix it. Signed-off-by: Colin Ian King Applied, thanks!

Re: [PATCH] [bpf] xdp_redirect_cpu_user: Fix null pointer dereference

2020-06-16 Thread Daniel Borkmann
On 6/14/20 9:04 PM, Gaurav Singh wrote: Memset() on the pointer right after malloc() can cause a null pointer dereference if it failed to allocate memory. Fix this by replacing malloc/memset with a single calloc(). Signed-off-by: Gaurav Singh Squashed all three same fixes into one and pushed

Re: [PATCH] xdp_rxq_info_user: Add null check after malloc

2020-06-11 Thread Daniel Borkmann
On 6/10/20 5:01 AM, Gaurav Singh wrote: Signed-off-by: Gaurav Singh The memset call is made right after malloc call which can return a NULL pointer upon failure causing a segmentation fault. Fix this by adding a null check right after malloc() and then do memset(). The SoB should come after

Re: [PATCH] libbpf: Define __WORDSIZE if not available

2020-06-09 Thread Daniel Borkmann
On 6/9/20 11:16 PM, Arnaldo Carvalho de Melo wrote: Em Tue, Jun 09, 2020 at 10:37:48PM +0200, Daniel Borkmann escreveu: Hey Arnaldo, On 6/9/20 5:34 PM, Arnaldo Carvalho de Melo wrote: Some systems, such as Android, don't have a define for __WORDSIZE, do it in terms of __SIZEOF_LONG__, as done

Re: [PATCH] libbpf: Define __WORDSIZE if not available

2020-06-09 Thread Daniel Borkmann
Hey Arnaldo, On 6/9/20 5:34 PM, Arnaldo Carvalho de Melo wrote: Some systems, such as Android, don't have a define for __WORDSIZE, do it in terms of __SIZEOF_LONG__, as done in perf since 2012: http://git.kernel.org/torvalds/c/3f34f6c0233ae055b5 For reference:

Re: [PATCH] bpf_stats_record: Add null check after malloc

2020-06-08 Thread Daniel Borkmann
On 6/7/20 1:46 AM, gaurav singh wrote: Hi, The memset call is made right after malloc call. To fix this, add the null check right after malloc and then do memset. Please find the patch below. Thanks and regards, Gaurav. Hello Gaurav, your patch is whitespace damaged. Please try and resubmit

Re: [PATCH bpf v2] bpf: fix unused-var without NETDEVICES

2020-06-04 Thread Daniel Borkmann
On 6/3/20 10:45 PM, Song Liu wrote: On Wed, Jun 3, 2020 at 12:05 PM Matthieu Baerts wrote: A recent commit added new variables only used if CONFIG_NETDEVICES is set. A simple fix would be to only declare these variables if the same condition is valid but Alexei suggested an even simpler

Re: [PATCH] powerpc/bpf: Enable bpf_probe_read{, str}() on powerpc again

2020-05-28 Thread Daniel Borkmann
On 5/28/20 2:23 PM, Michael Ellerman wrote: Petr Mladek writes: On Thu 2020-05-28 11:03:43, Michael Ellerman wrote: Petr Mladek writes: The commit 0ebeea8ca8a4d1d453a ("bpf: Restrict bpf_probe_read{, str}() only to archs where they work") caused that bpf_probe_read{, str}() functions were

Re: [PATCH bpf 0/5] bpf: fix map permissions check and cleanup code around

2020-05-28 Thread Daniel Borkmann
On Wed, May 27, 2020 at 06:56:55PM +, Anton Protopopov wrote: > This series fixes a bug in the map_lookup_and_delete_elem() function which > should check for the FMODE_CAN_READ bit, because it returns data to user > space. > The rest of commits fix some typos and comment in selftests and

Re: [PATCH] bpf: Fix spelling in comment

2020-05-26 Thread Daniel Borkmann
On 5/26/20 1:00 AM, Chris Packham wrote: Change 'handeled' to 'handled'. Signed-off-by: Chris Packham Applied, thanks!

Re: [PATCH] MAINTAINERS: adjust entry in XDP SOCKETS to actual file name

2020-05-25 Thread Daniel Borkmann
On 5/25/20 4:42 PM, Björn Töpel wrote: On 2020-05-25 16:15, Lukas Bulwahn wrote: Commit 2b43470add8c ("xsk: Introduce AF_XDP buffer allocation API") added a new header file include/net/xsk_buff_pool.h, but commit 28bee21dc04b ("MAINTAINERS, xsk: Update AF_XDP section after moves/adds") added a

Re: [PATCH v2 0/7] Copy hashmap to tools/perf/util, use in perf expr

2020-05-15 Thread Daniel Borkmann
On 5/15/20 11:18 PM, arnaldo.m...@gmail.com wrote: [...] Andrii/Alexei/Daniel, what do you think about me merging these fixes in my perf-tools-next branch? I'm ok with the idea, but it's up to maintainers to coordinate this :) Good to know, do I'll take all patches except the ones touching

Re: [PATCH 11/18] maccess: remove strncpy_from_unsafe

2020-05-14 Thread Daniel Borkmann
On 5/14/20 11:44 AM, Masami Hiramatsu wrote: On Wed, 13 May 2020 19:43:24 -0700 Linus Torvalds wrote: On Wed, May 13, 2020 at 6:00 PM Masami Hiramatsu wrote: But we should likely at least disallow it entirely on platforms where we really can't - or pick one hardcoded choice. On sparc, you

Re: [PATCH 11/18] maccess: remove strncpy_from_unsafe

2020-05-14 Thread Daniel Borkmann
On 5/14/20 12:01 PM, David Laight wrote: [...] If it's not a stupid question why is a BPF program allowed to get into a situation where it might have an invalid kernel address. It all stinks of a hole that allows all of kernel memory to be read and copied to userspace. Now you might want to

Re: [PATCH 11/18] maccess: remove strncpy_from_unsafe

2020-05-13 Thread Daniel Borkmann
On 5/14/20 1:28 AM, Al Viro wrote: On Thu, May 14, 2020 at 12:36:28AM +0200, Daniel Borkmann wrote: So on say s390 TASK_SIZE_USUALLy is (-PAGE_SIZE), which means we'd alway try the user copy first, which seems odd. I'd really like to here from the bpf folks what the expected use case is here

Re: [PATCH 11/18] maccess: remove strncpy_from_unsafe

2020-05-13 Thread Daniel Borkmann
On 5/14/20 1:03 AM, Linus Torvalds wrote: On Wed, May 13, 2020 at 3:36 PM Daniel Borkmann wrote: It's used for both. Daniel, BPF real;ly needs to make up its mind about that. You *cannot* use ti for both. Yes, it happens to work on x86 and some other architectures. But on other

Re: clean up and streamline probe_kernel_* and friends v2

2020-05-13 Thread Daniel Borkmann
On 5/13/20 6:00 PM, Christoph Hellwig wrote: Hi all, this series start cleaning up the safe kernel and user memory probing helpers in mm/maccess.c, and then allows architectures to implement the kernel probing without overriding the address space limit and temporarily allowing access to user

Re: [PATCH 11/18] maccess: remove strncpy_from_unsafe

2020-05-13 Thread Daniel Borkmann
On 5/13/20 9:28 PM, Christoph Hellwig wrote: On Wed, May 13, 2020 at 12:11:27PM -0700, Linus Torvalds wrote: On Wed, May 13, 2020 at 9:01 AM Christoph Hellwig wrote: +static void bpf_strncpy(char *buf, long unsafe_addr) +{ + buf[0] = 0; + if (strncpy_from_kernel_nofault(buf,

Re: [PATCH] libbpf: Replace zero-length array with flexible-array

2020-05-11 Thread Daniel Borkmann
On 5/9/20 9:16 PM, Yonghong Song wrote: On 5/7/20 11:50 AM, Gustavo A. R. Silva wrote: The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array

Re: [PATCH v3] net: bpf: permit redirect from ingress L3 to egress L2 devices at near max mtu

2020-05-07 Thread Daniel Borkmann
On 5/7/20 6:46 PM, Maciej Żenczykowski wrote: (a) not clear why the max is SKB_MAX_ALLOC in the first place (this is PAGE_SIZE << 2, ie. 16K on x86), while lo mtu is 64k Agreed, tbh, it's not clear to me either atm. :) The SKB_MAX_ALLOC constant itself should be replaced with something more

Re: [RFC PATCH bpf-next 3/3] bpf, arm64: Optimize ADD,SUB,JMP BPF_K using arm64 add/sub immediates

2020-05-07 Thread Daniel Borkmann
simpler to check if the immediate fits ahead of time. Co-developed-by: Xi Wang Signed-off-by: Xi Wang Signed-off-by: Luke Nelson Same here: Acked-by: Daniel Borkmann Thanks!

Re: [RFC PATCH bpf-next 2/3] bpf, arm64: Optimize AND,OR,XOR,JSET BPF_K using arm64 logical immediates

2020-05-07 Thread Daniel Borkmann
, thanks! Given Will wanted to queue them: Acked-by: Daniel Borkmann

Re: [PATCH v2] bpf, i386: remove unneeded conversion to bool

2020-05-07 Thread Daniel Borkmann
On 5/7/20 12:04 AM, Martin KaFai Lau wrote: On Wed, May 06, 2020 at 10:03:52PM +0800, Jason Yan wrote: The '==' expression itself is bool, no need to convert it to bool again. This fixes the following coccicheck warning: Make sense. It may belong to bpf-next instead. Acked-by: Martin KaFai

Re: [PATCH v3] net: bpf: permit redirect from ingress L3 to egress L2 devices at near max mtu

2020-05-07 Thread Daniel Borkmann
f068b72687a422465686cd Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Thu, 7 May 2020 16:46:30 +0200 Subject: [PATCH] bpf: xxx Signed-off-by: Daniel Borkmann --- include/linux/netdevice.h | 25 +++-- include/uapi/linux/bpf.h | 1 + net/core/dev.c| 24 +++-

Re: [PATCH bpf-next 0/4] RV64 BPF JIT Optimizations

2020-05-06 Thread Daniel Borkmann
On 5/6/20 9:08 AM, Björn Töpel wrote: On Wed, 6 May 2020 at 02:03, Luke Nelson wrote: This patch series introduces a set of optimizations to the BPF JIT on RV64. The optimizations are related to the verifier zero-extension optimization and BPF_JMP BPF_K. We tested the optimizations on a QEMU

Re: [PATCH 1/1] selftests/bpf: add cls_redirect classifier

2020-05-05 Thread Daniel Borkmann
On 5/5/20 1:48 AM, Alexei Starovoitov wrote: On Sat, May 02, 2020 at 01:48:51AM +0200, Daniel Borkmann wrote: On 4/27/20 11:45 AM, Lorenz Bauer wrote: On Sun, 26 Apr 2020 at 18:33, Alexei Starovoitov wrote: [...] +/* Linux packet pointers are either aligned to NET_IP_ALIGN (aka 2 bytes

Re: [PATCH 05/15] bpf: avoid gcc-10 stringop-overflow warning

2020-05-04 Thread Daniel Borkmann
On 4/30/20 11:30 PM, Arnd Bergmann wrote: gcc-10 warns about accesses to zero-length arrays: kernel/bpf/core.c: In function 'bpf_patch_insn_single': cc1: warning: writing 8 bytes into a region of size 0 [-Wstringop-overflow=] In file included from kernel/bpf/core.c:21:

Re: [PATCH bpf 0/2] bpf, arm: Small JIT optimizations

2020-05-04 Thread Daniel Borkmann
On 5/1/20 4:02 AM, Luke Nelson wrote: As Daniel suggested to us, we ran our formal verification tool, Serval, over the arm JIT. The bugs we found have been patched and applied to the bpf tree [1, 2]. This patch series introduces two small optimizations that simplify the JIT and use fewer

Re: [PATCH 1/1] selftests/bpf: add cls_redirect classifier

2020-05-01 Thread Daniel Borkmann
On 4/27/20 11:45 AM, Lorenz Bauer wrote: On Sun, 26 Apr 2020 at 18:33, Alexei Starovoitov wrote: [...] +/* Linux packet pointers are either aligned to NET_IP_ALIGN (aka 2 bytes), + * or not aligned if the arch supports efficient unaligned access. + * + * Since the verifier ensures that eBPF

Re: KASAN: use-after-free Write in bpf_link_put

2020-04-30 Thread Daniel Borkmann
On 4/30/20 11:39 AM, syzbot wrote: Hello, syzbot found the following crash on: HEAD commit:449e14bf bpf: Fix unused variable warning git tree: bpf-next console output: https://syzkaller.appspot.com/x/log.txt?x=109eb5f810 kernel config:

Re: [PATCH bpf-next] bpf, riscv: Fix stack layout of JITed code on RV32

2020-04-30 Thread Daniel Borkmann
On 4/30/20 4:14 AM, Xi Wang wrote: On Wed, Apr 29, 2020 at 5:51 PM Luke Nelson wrote: This patch fixes issues with stackframe unwinding and alignment in the current stack layout for BPF programs on RV32. In the current layout, RV32 fp points to the JIT scratch registers, rather than to the

Re: [PATCH] bpf: fix unused variable warning

2020-04-29 Thread Daniel Borkmann
On 4/29/20 3:21 PM, Arnd Bergmann wrote: Hiding the only using of bpf_link_type_strs[] in an #ifdef causes an unused-variable warning: kernel/bpf/syscall.c:2280:20: error: 'bpf_link_type_strs' defined but not used [-Werror=unused-variable] 2280 | static const char *bpf_link_type_strs[] = {

Re: [PATCH -next] libbpf: Remove unneeded semicolon

2020-04-28 Thread Daniel Borkmann
On 4/28/20 11:07 AM, Zou Wei wrote: Fixes coccicheck warning: tools/lib/bpf/btf_dump.c:661:4-5: Unneeded semicolon Reported-by: Hulk Robot Signed-off-by: Zou Wei Applied, thanks!

Re: [PATCH] xdp: fix type of string pointer in __XDP_ACT_SYM_TAB

2019-10-22 Thread Daniel Borkmann
On Tue, Oct 22, 2019 at 01:59:25PM +0100, Ben Dooks (Codethink) wrote: > The table entry in __XDP_ACT_SYM_TAB for the last item is set > to { -1, 0 } where it should be { -1, NULL } as the second item > is a pointer to a string. > > Fixes the following sparse warnings: > >

Re: KASAN: use-after-free Read in is_bpf_text_address

2019-10-22 Thread Daniel Borkmann
On 10/22/19 3:53 PM, syzbot wrote: Hello, syzbot found the following crash on: HEAD commit:    4fe34d61 Merge branch 'x86-urgent-for-linus' of git://git... git tree:   upstream console output: https://syzkaller.appspot.com/x/log.txt?x=15b01a60e0 kernel config: 

Re: [bpf-next] tools lib bpf: Renaming pr_warning to pr_warn

2019-10-21 Thread Daniel Borkmann
; > Cc: Alexei Starovoitov > Cc: Daniel Borkmann > Cc: Martin KaFai Lau > Cc: Song Liu > Cc: Yonghong Song > Cc: b...@vger.kernel.org > Acked-by: Andrii Nakryiko > Reviewed-by: Sergey Senozhatsky > Signed-off-by: Kefeng Wang Applied, thanks!

Re: [PATCH bpf-next] bpf: Fix build error without CONFIG_NET

2019-10-18 Thread Daniel Borkmann
On Fri, Oct 18, 2019 at 05:03:44PM +0800, YueHaibing wrote: > If CONFIG_NET is n, building fails: > > kernel/trace/bpf_trace.o: In function `raw_tp_prog_func_proto': > bpf_trace.c:(.text+0x1a34): undefined reference to `bpf_skb_output_proto' > > Wrap it into a #ifdef to fix this. > >

Re: [PATCH v2 31/33] tools lib bpf: Renaming pr_warning to pr_warn

2019-10-18 Thread Daniel Borkmann
d by pr_warn, using pr_warn in tools lib bpf for symmetry > > > to kernel logging macro, then we could drop pr_warning in the > > > whole linux code. > > > > > > Cc: Alexei Starovoitov > > > Cc: Daniel Borkmann > > > Cc: Martin KaFai Lau > &

Re: [PATCH bpf-next] bpf: Fix build error without CONFIG_NET

2019-10-18 Thread Daniel Borkmann
On Fri, Oct 18, 2019 at 02:20:25PM -0400, Steven Rostedt wrote: > On Fri, 18 Oct 2019 18:11:07 + > Yonghong Song wrote: > > On 10/18/19 2:03 AM, YueHaibing wrote: > > > If CONFIG_NET is n, building fails: > > > > > > kernel/trace/bpf_trace.o: In function `raw_tp_prog_func_proto': > > >

Re: BUG: unable to handle kernel paging request in is_bpf_text_address

2019-10-18 Thread Daniel Borkmann
On Thu, Oct 17, 2019 at 10:45:09PM -0700, syzbot wrote: > Hello, > > syzbot found the following crash on: > > HEAD commit:283ea345 coccinelle: api/devm_platform_ioremap_resource: r.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=122f199b60 >

Re: [PATCH] net: bpf: add static in net/core/filter.c

2019-10-16 Thread Daniel Borkmann
On Wed, Oct 16, 2019 at 02:02:31PM +0100, Ben Dooks wrote: > On 16/10/2019 13:26, Daniel Borkmann wrote: > > On Wed, Oct 16, 2019 at 12:04:46PM +0100, Ben Dooks (Codethink) wrote: > > > There are a number of structs in net/core/filter.c > > > that are not e

Re: [PATCH] net: bpf: add static in net/core/filter.c

2019-10-16 Thread Daniel Borkmann
uld it be static? > > Signed-off-by: Ben Dooks > --- > Cc: Alexei Starovoitov > Cc: Daniel Borkmann > Cc: Martin KaFai Lau > Cc: Song Liu > Cc: Yonghong Song > Cc: "David S. Miller" > Cc: Jakub Kicinski > Cc: Jesper Dangaard Brouer > Cc: John

Re: [PATCH v4 bpf-next 00/15] samples: bpf: improve/fix cross-compilation

2019-10-10 Thread Daniel Borkmann
On Wed, Oct 09, 2019 at 11:41:19PM +0300, Ivan Khoronzhuk wrote: > This series contains mainly fixes/improvements for cross-compilation > but not only, tested for arm, arm64, and intended for any arch. > Also verified on native build (not cross compilation) for x86_64 > and arm, arm64. [...]

Re: [PATCH v2] samples/bpf: Add a workaround for asm_inline

2019-10-03 Thread Daniel Borkmann
On Wed, Oct 02, 2019 at 09:16:52PM +0200, KP Singh wrote: > From: KP Singh > > This was added in: > > commit eb111869301e ("compiler-types.h: add asm_inline definition") > > and breaks samples/bpf as clang does not support asm __inline. > > Co-developed-by: Florent Revest > Signed-off-by:

Re: [PATCH bpf-next 0/2] selftest/bpf: remove warns for enable_all_controllers

2019-10-03 Thread Daniel Borkmann
On Wed, Oct 02, 2019 at 03:04:02PM +0300, Ivan Khoronzhuk wrote: > This micro series fixes annoying warn described in patches > while samples/bpf build. Second patch fixes new warn that > comes after fixing warn of first patch, that was masked. > > Ivan Khoronzhuk (2): > selftests/bpf: add

Re: [PATCH bpf 2/2] selftests/bpf: test_progs: don't leak server_fd in test_sockopt_inherit

2019-10-02 Thread Daniel Borkmann
On Wed, Oct 02, 2019 at 01:30:14PM -0700, Andrii Nakryiko wrote: > On Wed, Oct 2, 2019 at 1:56 AM Daniel Borkmann wrote: > > On Tue, Oct 01, 2019 at 08:42:30PM -0700, Brian Vazquez wrote: > > > Thanks for reviewing the patches Andrii! > > > > > > Althoug

Re: [PATCH bpf 2/2] selftests/bpf: test_progs: don't leak server_fd in test_sockopt_inherit

2019-10-02 Thread Daniel Borkmann
On Tue, Oct 01, 2019 at 08:42:30PM -0700, Brian Vazquez wrote: > Thanks for reviewing the patches Andrii! > > Although Daniel fixed them and applied them correctly. After last kernel/maintainer summit at LPC, I reworked all my patchwork scripts [0] which I use for bpf trees in order to further

Re: [PATCH bpf 0/2] selftests/bpf: test_progs: don't leak fd in bpf

2019-10-01 Thread Daniel Borkmann
On Tue, Oct 01, 2019 at 10:37:26AM -0700, Brian Vazquez wrote: > This patch series fixes some fd leaks in tcp_rtt and > test_sockopt_inherit bpf prof_tests. > > Brian Vazquez (2): > selftests/bpf: test_progs: don't leak server_fd in tcp_rtt > selftests/bpf: test_progs: don't leak server_fd in

Re: [PATCH] tools: bpf: Use !building_out_of_srctree to determine srctree

2019-09-30 Thread Daniel Borkmann
On Mon, Sep 30, 2019 at 08:16:55AM -0600, Shuah Khan wrote: > On 9/30/19 2:58 AM, Daniel Borkmann wrote: > > On Thu, Sep 26, 2019 at 07:13:44PM -0600, Shuah Khan wrote: > > > make TARGETS=bpf kselftest fails with: > > > > > > Makefile:127: tools/build/Makefil

Re: [PATCH] tools: bpf: Use !building_out_of_srctree to determine srctree

2019-09-30 Thread Daniel Borkmann
On Thu, Sep 26, 2019 at 07:13:44PM -0600, Shuah Khan wrote: > make TARGETS=bpf kselftest fails with: > > Makefile:127: tools/build/Makefile.include: No such file or directory > > When the bpf tool make is invoked from tools Makefile, srctree is > cleared and the current logic check for srctree

Re: [PATCH 1/1] bpf: Fix bpf_event_output re-entry issue

2019-09-27 Thread Daniel Borkmann
On Wed, Sep 25, 2019 at 04:43:12PM -0700, Allan Zhang wrote: > BPF_PROG_TYPE_SOCK_OPS program can reenter bpf_event_output because it can > be called from atomic and non-atomic contexts since we don't have > bpf_prog_active to prevent it happen. > > This patch enables 3 level of nesting to

Re: [PATCH] bpf: clean up indentation issue

2019-09-26 Thread Daniel Borkmann
On Wed, Sep 25, 2019 at 10:38:35AM +0100, Colin King wrote: > From: Colin Ian King > > There is a statement that is indented one level too deeply, > remove the extraneous tab. > > Signed-off-by: Colin Ian King Applied.

Re: [PATCH] kcm: use BPF_PROG_RUN

2019-09-24 Thread Daniel Borkmann
On Mon, Sep 23, 2019 at 02:31:04PM -0700, Eric Dumazet wrote: > On 9/6/19 10:06 AM, Alexei Starovoitov wrote: > > On Fri, Sep 6, 2019 at 3:03 AM Yonghong Song wrote: > >> On 9/5/19 2:15 PM, Sami Tolvanen wrote: > >>> Instead of invoking struct bpf_prog::bpf_func directly, use the > >>>

Re: general protection fault in xsk_map_update_elem

2019-09-23 Thread Daniel Borkmann
On Mon, Sep 23, 2019 at 08:49:11AM -0700, syzbot wrote: > Hello, > > syzbot found the following crash on: > > HEAD commit:b41dae06 Merge tag 'xfs-5.4-merge-7' of git://git.kernel.o.. > git tree: net-next > console output: https://syzkaller.appspot.com/x/log.txt?x=130b25ad60 >

Re: [PATCH 30/32] tools lib bpf: Renaming pr_warning to pr_warn

2019-09-23 Thread Daniel Borkmann
On Mon, Sep 23, 2019 at 01:03:06PM +0200, Petr Mladek wrote: > On Mon 2019-09-23 10:20:39, Daniel Borkmann wrote: > > On Sun, Sep 22, 2019 at 02:07:21PM -0700, Andrii Nakryiko wrote: > > > On Fri, Sep 20, 2019 at 10:06 AM Kefeng Wang > > > wrote: > > >

Re: [PATCH 30/32] tools lib bpf: Renaming pr_warning to pr_warn

2019-09-23 Thread Daniel Borkmann
; > to kernel logging macro, then we could drop pr_warning in the > > whole linux code. > > > > Cc: Alexei Starovoitov > > Cc: Daniel Borkmann > > Cc: Martin KaFai Lau > > Cc: Song Liu > > Cc: Yonghong Song > > Cc: b...@vger.kernel.org >

Re: [PATCH bpf-next] arm64: bpf: optimize modulo operation

2019-09-03 Thread Daniel Borkmann
On 9/2/19 8:14 AM, jer...@marvell.com wrote: From: Jerin Jacob Optimize modulo operation instruction generation by using single MSUB instruction vs MUL followed by SUB instruction scheme. Signed-off-by: Jerin Jacob Applied, thanks!

Re: [PATCH] selftests/bpf: Fix a typo in test_offload.py

2019-08-30 Thread Daniel Borkmann
On 8/29/19 2:01 AM, Masanari Iida wrote: This patch fix a spelling typo in test_offload.py Signed-off-by: Masanari Iida Applied, thanks!

Re: [PATCH] bpf: handle 32-bit zext during constant blinding

2019-08-26 Thread Daniel Borkmann
On 8/21/19 9:23 PM, Naveen N. Rao wrote: Since BPF constant blinding is performed after the verifier pass, the ALU32 instructions inserted for doubleword immediate loads don't have a corresponding zext instruction. This is causing a kernel oops on powerpc and can be reproduced by running

Re: [PATCH] selftests: bpf: install files test_xdp_vlan.sh

2019-08-21 Thread Daniel Borkmann
On 8/20/19 3:41 PM, Anders Roxell wrote: When ./test_xdp_vlan_mode_generic.sh runs it complains that it can't find file test_xdp_vlan.sh. # selftests: bpf: test_xdp_vlan_mode_generic.sh # ./test_xdp_vlan_mode_generic.sh: line 9: ./test_xdp_vlan.sh: No such file or directory Rework so

Re: [PATCH] selftests: bpf: add config fragment BPF_JIT

2019-08-21 Thread Daniel Borkmann
On 8/20/19 3:41 PM, Anders Roxell wrote: When running test_kmod.sh the following shows up # sysctl cannot stat /proc/sys/net/core/bpf_jit_enable No such file or directory cannot: stat_/proc/sys/net/core/bpf_jit_enable # # sysctl cannot stat /proc/sys/net/core/bpf_jit_harden No such file

Re: [PATCH bpf-next v2 0/3] xdpsock: allow mmap2 usage for 32bits

2019-08-21 Thread Daniel Borkmann
On 8/15/19 2:13 PM, Ivan Khoronzhuk wrote: This patchset contains several improvements for af_xdp socket umem mappings for 32bit systems. Also, there is one more patch outside of this series that on linux-next tree and related to mmap2 af_xdp umem offsets: "mm: mmap: increase sockets maximum

Re: [PATCH bpf-next] xsk: proper socket state check in xsk_poll

2019-08-20 Thread Daniel Borkmann
On 8/20/19 5:29 PM, Björn Töpel wrote: On Tue, 20 Aug 2019 at 16:30, Daniel Borkmann wrote: On 8/20/19 12:04 PM, Björn Töpel wrote: From: Björn Töpel The poll() implementation for AF_XDP sockets did not perform the proper state checks, prior accessing the socket umem. This patch fixes

Re: [PATCH bpf 1/1] xdp: unpin xdp umem pages in error path

2019-08-20 Thread Daniel Borkmann
On 8/15/19 10:56 PM, Ivan Khoronzhuk wrote: Fix mem leak caused by missed unpin routine for umem pages. Fixes: 8aef7340ae9695 ("commit xsk: introduce xdp_umem_page") Signed-off-by: Ivan Khoronzhuk Applied & fixed up 'Fixes:' tag, thanks.

Re: [PATCH] test_bpf: Fix a new clang warning about xor-ing two numbers

2019-08-20 Thread Daniel Borkmann
On 8/19/19 6:34 AM, Nathan Chancellor wrote: r369217 in clang added a new warning about potential misuse of the xor operator as an exponentiation operator: ../lib/test_bpf.c:870:13: warning: result of '10 ^ 300' is 294; did you mean '1e300'? [-Wxor-used-as-pow] { { 4, 10 ^ 300

Re: [PATCH] bpfilter/verifier: add include guard to tnum.h

2019-08-20 Thread Daniel Borkmann
On 8/19/19 6:10 PM, Masahiro Yamada wrote: Add a header include guard just in case. Signed-off-by: Masahiro Yamada Applied, thanks!

Re: [PATCH bpf-next] xsk: proper socket state check in xsk_poll

2019-08-20 Thread Daniel Borkmann
On 8/20/19 12:04 PM, Björn Töpel wrote: From: Björn Töpel The poll() implementation for AF_XDP sockets did not perform the proper state checks, prior accessing the socket umem. This patch fixes that by performing a xsk_is_bound() check. Suggested-by: Hillf Danton Reported-by:

Re: WARNING in is_bpf_text_address

2019-08-15 Thread Daniel Borkmann
On 8/11/19 10:36 AM, Hillf Danton wrote: On Sun, 11 Aug 2019 08:24:09 +0800 syzbot has found a reproducer for the following crash on: HEAD commit:451577f3 Merge tag 'kbuild-fixes-v5.3-3' of git://git.kern.. git tree: upstream console output:

Re: [PATCH v2 bpf-next] mm: mmap: increase sockets maximum memory size pgoff for 32bits

2019-08-12 Thread Daniel Borkmann
On 8/12/19 2:43 PM, Ivan Khoronzhuk wrote: The AF_XDP sockets umem mapping interface uses XDP_UMEM_PGOFF_FILL_RING and XDP_UMEM_PGOFF_COMPLETION_RING offsets. The offsets seems like are established already and are part of configuration interface. But for 32-bit systems, while AF_XDP socket

Re: [PATCH v2 bpf-next] xdp: xdp_umem: fix umem pages mapping for 32bits systems

2019-08-09 Thread Daniel Borkmann
On 8/8/19 11:38 AM, Ivan Khoronzhuk wrote: Use kmap instead of page_address as it's not always in low memory. Acked-by: Björn Töpel Signed-off-by: Ivan Khoronzhuk Applied, thanks!

Re: [PATCH V35 23/29] bpf: Restrict bpf when kernel lockdown is in confidentiality mode

2019-07-15 Thread Daniel Borkmann
Suggested-by: Alexei Starovoitov > Signed-off-by: Matthew Garrett > cc: net...@vger.kernel.org > cc: Chun-Yi Lee > cc: Alexei Starovoitov > Cc: Daniel Borkmann > --- > include/linux/security.h | 1 + > kernel/trace/bpf_trace.c | 10 ++ > security/l

Re: [PATCH 0/2] Fold checksum at the end of bpf_csum_diff and fix

2019-07-12 Thread Daniel Borkmann
On 07/12/2019 01:50 AM, Andrii Nakryiko wrote: > On Thu, Jul 11, 2019 at 2:32 AM Paolo Pisati wrote: >> From: Paolo Pisati >> >> After applying patch 0001, all checksum implementations i could test >> (x86-64, arm64 and >> arm), now agree on the return value. >> >> Patch 0002 fix the expected

Re: [PATCH][bpf-next] bpf: verifier: avoid fall-through warnings

2019-07-12 Thread Daniel Borkmann
On 07/11/2019 06:22 PM, Gustavo A. R. Silva wrote: > In preparation to enabling -Wimplicit-fallthrough, this patch silences > the following warning: > > kernel/bpf/verifier.c: In function ‘check_return_code’: > kernel/bpf/verifier.c:6106:6: warning: this statement may fall through >

Re: [PATCH bpf] xdp: fix potential deadlock on socket mutex

2019-07-12 Thread Daniel Borkmann
On 07/08/2019 01:03 PM, Ilya Maximets wrote: > There are 2 call chains: > > a) xsk_bind --> xdp_umem_assign_dev > b) unregister_netdevice_queue --> xsk_notifier > > with the following locking order: > > a) xs->mutex --> rtnl_lock > b) rtnl_lock --> xdp.lock --> xs->mutex > > Different

Re: [PATCH bpf] xdp: fix possible cq entry leak

2019-07-12 Thread Daniel Borkmann
On 07/04/2019 04:25 PM, Ilya Maximets wrote: > Completion queue address reservation could not be undone. > In case of bad 'queue_id' or skb allocation failure, reserved entry > will be leaked reducing the total capacity of completion queue. > > Fix that by moving reservation to the point where

Re: [PATCH V2 1/1 (was 0/1 by accident)] tools/dtrace: initial implementation of DTrace

2019-07-10 Thread Daniel Borkmann
On 07/10/2019 10:30 PM, Jonathan Corbet wrote: > On Wed, 10 Jul 2019 21:32:25 +0200 > Daniel Borkmann wrote: > >> Looks like you missed Brendan Gregg's prior feedback from v1 [0]. I haven't >> seen a strong compelling argument for why this needs to reside in the kernel >&

Re: [PATCH V2 1/1 (was 0/1 by accident)] tools/dtrace: initial implementation of DTrace

2019-07-10 Thread Daniel Borkmann
Hello Kris, On 07/10/2019 08:12 PM, Kris Van Hees wrote: > This patch's subject should of course be [PATCH V2 1/1] rather than 0/1. > Sorry about that. > > On Wed, Jul 10, 2019 at 08:42:24AM -0700, Kris Van Hees wrote: >> This initial implementation of a tiny subset of DTrace functionality >>

Re: [tip:x86/urgent] bpf: Fix ORC unwinding in non-JIT BPF code

2019-07-09 Thread Daniel Borkmann
On 07/09/2019 09:17 PM, Josh Poimboeuf wrote: > On Tue, Jul 09, 2019 at 11:02:40AM -0700, Alexei Starovoitov wrote: >> On Tue, Jul 9, 2019 at 10:48 AM Josh Poimboeuf wrote: >>> >>> On Mon, Jul 08, 2019 at 04:16:25PM -0700, Alexei Starovoitov wrote: total time is hard to compare. Could

Re: [PATCH bpf v2] xdp: fix race on generic receive path

2019-07-08 Thread Daniel Borkmann
On 07/03/2019 02:09 PM, Ilya Maximets wrote: > Unlike driver mode, generic xdp receive could be triggered > by different threads on different CPU cores at the same time > leading to the fill and rx queue breakage. For example, this > could happen while sending packets from two processes to the >

Re: [PATCH v2 bpf-next] bpf: cgroup: Fix build error without CONFIG_NET

2019-07-08 Thread Daniel Borkmann
On 07/03/2019 10:26 AM, YueHaibing wrote: > If CONFIG_NET is not set and CONFIG_CGROUP_BPF=y, > gcc building fails: > > kernel/bpf/cgroup.o: In function `cg_sockopt_func_proto': > cgroup.c:(.text+0x237e): undefined reference to `bpf_sk_storage_get_proto' > cgroup.c:(.text+0x2394): undefined

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' >>

Re: [PATCH bpf-next] Enable zext optimization for more RV64G ALU ops

2019-07-05 Thread Daniel Borkmann
On 07/05/2019 02:18 AM, Luke Nelson wrote: > commit 66d0d5a854a6 ("riscv: bpf: eliminate zero extension code-gen") > added the new zero-extension optimization for some BPF ALU operations. > > Since then, bugs in the JIT that have been fixed in the bpf tree require > this optimization to be added

Re: [PATCH bpf-next 1/2] bpf, libbpf: add a new API bpf_object__reuse_maps()

2019-07-05 Thread Daniel Borkmann
On 07/05/2019 10:44 PM, Anton Protopopov wrote: > Add a new API bpf_object__reuse_maps() which can be used to replace all maps > in > an object by maps pinned to a directory provided in the path argument. > Namely, > each map M in the object will be replaced by a map pinned to path/M.name. > >

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: [PATCH] bpf, libbpf: Smatch: Fix potential NULL pointer dereference

2019-07-03 Thread Daniel Borkmann
On 07/02/2019 12:25 PM, Leo Yan wrote: > Based on the following report from Smatch, fix the potential > NULL pointer dereference check. > > tools/lib/bpf/libbpf.c:3493 > bpf_prog_load_xattr() warn: variable dereferenced before check 'attr' > (see line 3483) > > 3479 int

Re: [PATCH] bpf: Replace a seq_printf() call by seq_puts() in btf_enum_seq_show()

2019-07-03 Thread Daniel Borkmann
On 07/02/2019 07:13 PM, Markus Elfring wrote: > From: Markus Elfring > Date: Tue, 2 Jul 2019 19:04:08 +0200 > > A string which did not contain a data format specification should be put > into a sequence. Thus use the corresponding function “seq_puts”. > > This issue was detected by using the

Re: [PATCH bpf 1/3] bpf, x32: Fix bug with ALU64 {LSH,RSH,ARSH} BPF_X shift by 0

2019-07-03 Thread Daniel Borkmann
On 06/29/2019 07:57 AM, Luke Nelson wrote: > The current x32 BPF JIT for shift operations is not correct when the > shift amount in a register is 0. The expected behavior is a no-op, whereas > the current implementation changes bits in the destination register. > > The following example

Re: linux-next: Fixes tag needs some work in the bpf tree

2019-06-27 Thread Daniel Borkmann
On 06/27/2019 03:45 AM, Stephen Rothwell wrote: > Hi all, > > On Wed, 26 Jun 2019 16:36:50 -0700 Alexei Starovoitov > wrote: >> >> On Wed, Jun 26, 2019 at 3:14 PM Roman Gushchin wrote: >>> >>> On Thu, Jun 27, 2019 at 08:05:21AM +1000, Stephen Rothwell wrote: In commit

Re: [PATCH net-next] xdp: Make __mem_id_disconnect static

2019-06-26 Thread Daniel Borkmann
On 06/25/2019 04:31 AM, YueHaibing wrote: > Fix sparse warning: > > net/core/xdp.c:88:6: warning: > symbol '__mem_id_disconnect' was not declared. Should it be static? > > Reported-by: Hulk Robot > Signed-off-by: YueHaibing Applied, thanks!

Re: [PATCH v2 bpf-next] libbpf: fix max() type mismatch for 32bit

2019-06-26 Thread Daniel Borkmann
On 06/26/2019 12:38 PM, Ivan Khoronzhuk wrote: > It fixes build error for 32bit caused by type mismatch > size_t/unsigned long. > > Fixes: bf82927125dd ("libbpf: refactor map initialization") > Acked-by: Song Liu > Acked-by: Andrii Nakryiko > Signed-off-by: Ivan Khoronzhuk Applied, thanks!

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