Re: [PATCH bpf-next] rethook: Remove warning messages printed for finding return address of a frame.

2024-04-03 Thread Daniel Borkmann
On 4/2/24 6:58 PM, Andrii Nakryiko wrote: On Mon, Apr 1, 2024 at 12:16 PM Kui-Feng Lee wrote: rethook_find_ret_addr() prints a warning message and returns 0 when the target task is running and not the "current" task to prevent returning an incorrect return address. However, this check is

Re: [PATCH net-next 16/24] net: netkit, veth, tun, virt*: Use nested-BH locking for XDP redirect.

2023-12-18 Thread Daniel Borkmann
Hi Sebastian, On 12/15/23 6:07 PM, Sebastian Andrzej Siewior wrote: The per-CPU variables used during bpf_prog_run_xdp() invocation and later during xdp_do_redirect() rely on disabled BH for their protection. Without locking in local_bh_disable() on PREEMPT_RT these data structure require

Re: [PATCH net] bpf: test_run: fix WARNING in format_decode

2023-11-27 Thread Daniel Borkmann
On 11/22/23 6:28 AM, Yonghong Song wrote: On 11/21/23 7:50 PM, Edward Adam Davis wrote: Confirm that skb->len is not 0 to ensure that skb length is valid. Fixes: 114039b34201 ("bpf: Move skb->len == 0 checks into __bpf_redirect") Reported-by:

Re: [PATCH bpf-next v2 3/4] libbpf: add low level TC-BPF API

2021-04-19 Thread Daniel Borkmann
On 4/19/21 11:43 PM, Toke Høiland-Jørgensen wrote: Daniel Borkmann writes: On 4/19/21 2:18 PM, Kumar Kartikeya Dwivedi wrote: This adds functions that wrap the netlink API used for adding, manipulating, and removing traffic control filters. These functions operate directly on the loaded

Re: [PATCH bpf-next v2 3/4] libbpf: add low level TC-BPF API

2021-04-19 Thread Daniel Borkmann
On 4/19/21 2:18 PM, Kumar Kartikeya Dwivedi wrote: This adds functions that wrap the netlink API used for adding, manipulating, and removing traffic control filters. These functions operate directly on the loaded prog's fd, and return a handle to the filter using an out parameter named id. The

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-15 Thread Daniel Borkmann
On 4/16/21 12:22 AM, Andrii Nakryiko wrote: On Thu, Apr 15, 2021 at 3:10 PM Daniel Borkmann wrote: On 4/15/21 1:58 AM, Andrii Nakryiko wrote: On Wed, Apr 14, 2021 at 4:32 PM Daniel Borkmann wrote: On 4/15/21 1:19 AM, Andrii Nakryiko wrote: On Wed, Apr 14, 2021 at 3:51 PM Toke Høiland

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-15 Thread Daniel Borkmann
On 4/15/21 1:58 AM, Andrii Nakryiko wrote: On Wed, Apr 14, 2021 at 4:32 PM Daniel Borkmann wrote: On 4/15/21 1:19 AM, Andrii Nakryiko wrote: On Wed, Apr 14, 2021 at 3:51 PM Toke Høiland-Jørgensen wrote: Andrii Nakryiko writes: On Wed, Apr 14, 2021 at 3:58 AM Toke Høiland-Jørgensen wrote

Re: [PATCH bpf-next 1/2] bpf: Remove bpf_jit_enable=2 debugging mode

2021-04-15 Thread Daniel Borkmann
On 4/15/21 11:32 AM, Jianlin Lv wrote: For debugging JITs, dumping the JITed image to kernel log is discouraged, "bpftool prog dump jited" is much better way to examine JITed dumps. This patch get rid of the code related to bpf_jit_enable=2 mode and update the proc handler of bpf_jit_enable,

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-14 Thread Daniel Borkmann
On 4/15/21 1:19 AM, Andrii Nakryiko wrote: On Wed, Apr 14, 2021 at 3:51 PM Toke Høiland-Jørgensen wrote: Andrii Nakryiko writes: On Wed, Apr 14, 2021 at 3:58 AM Toke Høiland-Jørgensen wrote: Andrii Nakryiko writes: On Tue, Apr 6, 2021 at 3:06 AM Toke Høiland-Jørgensen wrote: Andrii

Re: [PATCH 5.10 39/41] bpf, x86: Validate computation of branch displacements for x86-32

2021-04-09 Thread Daniel Borkmann
On 4/9/21 9:51 PM, Sudip Mukherjee wrote: On Fri, Apr 09, 2021 at 11:54:01AM +0200, Greg Kroah-Hartman wrote: From: Piotr Krysiuk commit 26f55a59dc65ff77cd1c4b37991e26497fc68049 upstream. I am not finding this in Linus's tree and even not seeing this change in master branch also. Am I

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-01 Thread Daniel Borkmann
On 3/31/21 11:44 AM, Kumar Kartikeya Dwivedi wrote: On Wed, Mar 31, 2021 at 02:55:47AM IST, Daniel Borkmann wrote: Do we even need the _block variant? I would rather prefer to take the chance and make it as simple as possible, and only iff really needed extend with other APIs, for example

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-03-30 Thread Daniel Borkmann
On 3/30/21 10:39 PM, Andrii Nakryiko wrote: On Sun, Mar 28, 2021 at 1:11 AM Kumar Kartikeya Dwivedi wrote: On Sun, Mar 28, 2021 at 10:12:40AM IST, Andrii Nakryiko wrote: Is there some succinct but complete enough documentation/tutorial/etc that I can reasonably read to understand kernel APIs

Re: [PATCH v3] bpf: Fix memory leak in copy_process()

2021-03-19 Thread Daniel Borkmann
On 3/17/21 4:09 AM, qiang.zh...@windriver.com wrote: From: Zqiang The syzbot report a memleak follow: BUG: memory leak unreferenced object 0x888101b41d00 (size 120): comm "kworker/u4:0", pid 8, jiffies 4294944270 (age 12.780s) backtrace: [] alloc_pid+0x66/0x560 []

Re: linux-next: manual merge of the net-next tree with the net tree

2021-03-19 Thread Daniel Borkmann
On 3/19/21 4:33 PM, Alexei Starovoitov wrote: On Fri, Mar 19, 2021 at 8:17 AM Yonghong Song wrote: On 3/19/21 12:21 AM, Daniel Borkmann wrote: On 3/19/21 3:11 AM, Piotr Krysiuk wrote: Hi Daniel, On Fri, Mar 19, 2021 at 12:16 AM Stephen Rothwell wrote: diff --cc kernel/bpf/verifier.c

Re: linux-next: manual merge of the net-next tree with the net tree

2021-03-19 Thread Daniel Borkmann
On 3/19/21 3:11 AM, Piotr Krysiuk wrote: Hi Daniel, On Fri, Mar 19, 2021 at 12:16 AM Stephen Rothwell wrote: diff --cc kernel/bpf/verifier.c index 44e4ec1640f1,f9096b049cd6.. --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@@ -5876,10 -6056,22 +6060,23 @@@ static int

Re: [PATCH] selftests/bpf: fix warning comparing pointer to 0

2021-03-18 Thread Daniel Borkmann
On 3/18/21 2:55 AM, Jiapeng Chong wrote: Fix the following coccicheck warning: ./tools/testing/selftests/bpf/progs/fentry_test.c:76:15-16: WARNING comparing pointer to 0. Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong --- tools/testing/selftests/bpf/progs/fentry_test.c | 4 ++-- 1

Re: [PATCH bpf-next v2] bpf: Simplify expression for identify bpf mem type

2021-03-18 Thread Daniel Borkmann
On 3/18/21 7:36 AM, Jianlin Lv wrote: Added BPF_LD_ST_SIZE_MASK macro as mask of size modifier that help to reduce the evaluation of expressions in if statements, and remove BPF_SIZE_MASK in netronome driver. Signed-off-by: Jianlin Lv --- v2: Move the bpf_LD_ST_SIZE_MASK macro definition to

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

2021-03-17 Thread Daniel Borkmann
On 3/17/21 8:15 AM, Tiezhu Yang wrote: After commit 0ebeea8ca8a4 ("bpf: Restrict bpf_probe_read{, str}() only to archs where they work"), bpf_probe_read{, str}() functions were not longer available on MIPS, so there exists some errors when running bpf program: root@linux:/home/loongson/bcc#

Re: [PATCH] libbpf: avoid inline hint definition from 'linux/stddef.h'

2021-03-16 Thread Daniel Borkmann
On 3/16/21 10:34 PM, Andrii Nakryiko wrote: On Tue, Mar 16, 2021 at 2:01 PM Daniel Borkmann wrote: On 3/14/21 6:38 PM, Pedro Tammela wrote: Linux headers might pull 'linux/stddef.h' which defines '__always_inline' as the following: #ifndef __always_inline #define __always_inline

Re: [PATCH] libbpf: avoid inline hint definition from 'linux/stddef.h'

2021-03-16 Thread Daniel Borkmann
On 3/14/21 6:38 PM, Pedro Tammela wrote: Linux headers might pull 'linux/stddef.h' which defines '__always_inline' as the following: #ifndef __always_inline #define __always_inline __inline__ #endif This becomes an issue if the program picks up the 'linux/stddef.h' definition as

Re: [PATCH v2] bpf: Fix memory leak in copy_process()

2021-03-16 Thread Daniel Borkmann
On 3/15/21 9:58 AM, qiang.zh...@windriver.com wrote: From: Zqiang nit: I presume it should be s/Zqiang/Qiang Zhang/ as real name for 'From' instead of abbreviation? The syzbot report a memleak follow: BUG: memory leak unreferenced object 0x888101b41d00 (size 120): comm

Re: [PATCH v2] bpf: Fix memory leak in copy_process()

2021-03-15 Thread Daniel Borkmann
On 3/15/21 9:18 AM, qiang.zh...@windriver.com wrote: From: Zqiang Hello Zqiang, please resend this patch with b...@vger.kernel.org in Cc, so it actually reaches the rest of BPF community for review, thanks! The syzbot report a memleak follow: BUG: memory leak unreferenced object

Re: [PATCH] tools include: Add __sum16 and __wsum definitions.

2021-03-08 Thread Daniel Borkmann
On 3/7/21 11:30 PM, Ian Rogers wrote: This adds definitions available in the uapi version. Explanation: In the kernel include of types.h the uapi version is included. In tools the uapi/linux/types.h and linux/types.h are distinct. For BPF programs a definition of __wsum is needed by the

Re: [PATCH bpf-next] selftests_bpf: extend test_tc_tunnel test with vxlan

2021-03-05 Thread Daniel Borkmann
On 3/5/21 5:15 PM, Willem de Bruijn wrote: On Fri, Mar 5, 2021 at 11:10 AM Daniel Borkmann wrote: On 3/5/21 4:08 PM, Willem de Bruijn wrote: On Fri, Mar 5, 2021 at 7:34 AM Xuesen Huang wrote: From: Xuesen Huang Add BPF_F_ADJ_ROOM_ENCAP_L2_ETH flag to the existing tests which

Re: [PATCH bpf-next] selftests_bpf: extend test_tc_tunnel test with vxlan

2021-03-05 Thread Daniel Borkmann
On 3/5/21 4:08 PM, Willem de Bruijn wrote: On Fri, Mar 5, 2021 at 7:34 AM Xuesen Huang wrote: From: Xuesen Huang Add BPF_F_ADJ_ROOM_ENCAP_L2_ETH flag to the existing tests which encapsulates the ethernet as the inner l2 header. Update a vxlan encapsulation test case. Signed-off-by: Xuesen

Re: [PATCH v8 bpf-next 0/5] xsk: build skb by page (aka generic zerocopy xmit)

2021-02-24 Thread Daniel Borkmann
On 2/18/21 9:49 PM, Alexander Lobakin wrote: This series introduces XSK generic zerocopy xmit by adding XSK umem pages as skb frags instead of copying data to linear space. The only requirement for this for drivers is to be able to xmit skbs with skb_headlen(skb) == 0, i.e. all data including

Re: [PATCH] bpf: fix a warning message in mark_ptr_not_null_reg()

2021-02-16 Thread Daniel Borkmann
On 2/16/21 10:10 PM, KP Singh wrote: On Tue, Feb 16, 2021 at 8:37 PM Dan Carpenter wrote: The WARN_ON() argument is a condition, and it generates a stack trace but it doesn't print the warning. Fixes: 4ddb74165ae5 ("bpf: Extract nullable reg type conversion into a helper function")

Re: [PATCH bpf] devmap: Use GFP_KERNEL for xdp bulk queue allocation

2021-02-12 Thread Daniel Borkmann
On 2/9/21 9:24 AM, NOMURA JUNICHI(野村 淳一) wrote: The devmap bulk queue is allocated with GFP_ATOMIC and the allocation may fail if there is no available space in existing percpu pool. Since commit 75ccae62cb8d42 ("xdp: Move devmap bulk queue into struct net_device") moved the bulk queue

Re: [PATCH/v2] bpf: add bpf_skb_adjust_room flag BPF_F_ADJ_ROOM_ENCAP_L2_ETH

2021-02-11 Thread Daniel Borkmann
On 2/10/21 3:50 PM, Willem de Bruijn wrote: On Wed, Feb 10, 2021 at 1:59 AM huangxuesen wrote: From: huangxuesen bpf_skb_adjust_room sets the inner_protocol as skb->protocol for packets encapsulation. But that is not appropriate when pushing Ethernet header. Add an option to further

Re: [PATCH bpf-next v6 2/5] bpf: Expose bpf_get_socket_cookie to tracing programs

2021-02-01 Thread Daniel Borkmann
On 1/30/21 12:45 PM, Florent Revest wrote: On Fri, Jan 29, 2021 at 1:49 PM Daniel Borkmann wrote: On 1/29/21 11:57 AM, Daniel Borkmann wrote: On 1/27/21 10:01 PM, Andrii Nakryiko wrote: On Tue, Jan 26, 2021 at 10:36 AM Florent Revest wrote: This needs a new helper that: - can work

Re: [PATCH] bpf: Fix integer overflow in argument calculation for bpf_map_area_alloc

2021-01-27 Thread Daniel Borkmann
On 1/27/21 5:23 AM, Bui Quang Minh wrote: On Tue, Jan 26, 2021 at 09:36:57AM +, Lorenz Bauer wrote: On Tue, 26 Jan 2021 at 08:26, Bui Quang Minh wrote: In 32-bit architecture, the result of sizeof() is a 32-bit integer so the expression becomes the multiplication between 2 32-bit integer

Re: [PATCH bpf-next] samples/bpf: Add include dir for MIPS Loongson64 to fix build errors

2021-01-26 Thread Daniel Borkmann
On 1/26/21 3:05 PM, Tiezhu Yang wrote: There exists many build errors when make M=samples/bpf on the Loongson platform, this issue is MIPS related, x86 compiles just fine. Here are some errors: [...] So we can do the similar things in samples/bpf/Makefile, just add platform specific and

Re: [PATCH bpf 1/2] bpf: support PTR_TO_MEM{,_OR_NULL} register spilling

2021-01-12 Thread Daniel Borkmann
On 1/12/21 8:46 PM, Andrii Nakryiko wrote: On Tue, Jan 12, 2021 at 1:14 AM Gilad Reti wrote: Add support for pointer to mem register spilling, to allow the verifier to track pointer to valid memory addresses. Such pointers are returned for example by a successful call of the

Re: [PATCH 2/2] selftests/bpf: add verifier test for PTR_TO_MEM spill

2021-01-12 Thread Daniel Borkmann
On 1/12/21 4:35 PM, Gilad Reti wrote: On Tue, Jan 12, 2021 at 4:56 PM KP Singh wrote: On Tue, Jan 12, 2021 at 10:16 AM Gilad Reti wrote: Add test to check that the verifier is able to recognize spilling of PTR_TO_MEM registers. It would be nice to have some explanation of what the test

Re: [PATCH] Signed-off-by: giladreti

2021-01-11 Thread Daniel Borkmann
Hello Gilad, On 1/11/21 4:31 PM, giladreti wrote: Added support for pointer to mem register spilling, to allow the verifier to track pointer to valid memory addresses. Such pointers are returned for example by a successful call of the bpf_ringbuf_reserve helper. This patch was suggested as a

Re: [PATCH net v2] net: fix use-after-free when UDP GRO with shared fraglist

2021-01-08 Thread Daniel Borkmann
On 1/7/21 3:44 PM, Willem de Bruijn wrote: On Thu, Jan 7, 2021 at 8:33 AM Daniel Borkmann wrote: On 1/7/21 2:05 PM, Willem de Bruijn wrote: On Thu, Jan 7, 2021 at 7:52 AM Daniel Borkmann wrote: On 1/7/21 12:40 PM, Dongseok Yi wrote: On 2021-01-07 20:05, Daniel Borkmann wrote: On 1/7/21 1

Re: [PATCH net v3] net: fix use-after-free when UDP GRO with shared fraglist

2021-01-08 Thread Daniel Borkmann
8/0x38 [ 4443.426869] el0_svc_common+0xf0/0x1d0 [ 4443.426873] el0_svc_handler+0x74/0x98 [ 4443.426880] el0_svc+0x8/0xc Fixes: 3a1296a38d0c (net: Support GRO/GSO fraglist chaining.) Signed-off-by: Dongseok Yi Acked-by: Willem de Bruijn Acked-by: Daniel Borkmann

Re: [PATCH net v2] net: fix use-after-free when UDP GRO with shared fraglist

2021-01-07 Thread Daniel Borkmann
On 1/7/21 2:05 PM, Willem de Bruijn wrote: On Thu, Jan 7, 2021 at 7:52 AM Daniel Borkmann wrote: On 1/7/21 12:40 PM, Dongseok Yi wrote: On 2021-01-07 20:05, Daniel Borkmann wrote: On 1/7/21 1:39 AM, Dongseok Yi wrote: skbs in fraglist could be shared by a BPF filter loaded at TC

Re: [PATCH net v2] net: fix use-after-free when UDP GRO with shared fraglist

2021-01-07 Thread Daniel Borkmann
On 1/7/21 12:40 PM, Dongseok Yi wrote: On 2021-01-07 20:05, Daniel Borkmann wrote: On 1/7/21 1:39 AM, Dongseok Yi wrote: skbs in fraglist could be shared by a BPF filter loaded at TC. It triggers skb_ensure_writable -> pskb_expand_head -> skb_clone_fraglist -> skb_get on

Re: [PATCH net v2] net: fix use-after-free when UDP GRO with shared fraglist

2021-01-07 Thread Daniel Borkmann
On 1/7/21 1:39 AM, Dongseok Yi wrote: skbs in fraglist could be shared by a BPF filter loaded at TC. It triggers skb_ensure_writable -> pskb_expand_head -> skb_clone_fraglist -> skb_get on each skb in the fraglist. While tcpdump, sk_receive_queue of PF_PACKET has the original fraglist. But the

Re: [PATCH 03/15] perf: Add build id data in mmap2 event

2020-12-15 Thread Daniel Borkmann
Hey Arnaldo, On 12/15/20 4:52 PM, Arnaldo Carvalho de Melo wrote: Em Mon, Dec 14, 2020 at 11:54:45AM +0100, Jiri Olsa escreveu: Adding support to carry build id data in mmap2 event. The build id data replaces maj/min/ino/ino_generation fields, which are also used to identify map's binary, so

Re: [PATCH bpf-next v2] libbpf: Expose libbpf ringbufer epoll_fd

2020-12-14 Thread Daniel Borkmann
On 12/14/20 12:38 PM, Brendan Jackman wrote: This provides a convenient perf ringbuf -> libbpf ringbuf migration path for users of external polling systems. It is analogous to perf_buffer__epoll_fd. Signed-off-by: Brendan Jackman --- Difference from v1: Added entry to libbpf.map.

Re: [PATCH bpf-next v4 2/4] bpf: Expose bpf_get_socket_cookie to tracing programs

2020-12-09 Thread Daniel Borkmann
On 12/9/20 2:26 PM, Florent Revest wrote: This needs two new helpers, one that works in a sleepable context (using sock_gen_cookie which disables/enables preemption) and one that does not (for performance reasons). Both take a struct sock pointer and need to check it for NULLness. This helper

Re: [PATCH bpf-next v2 1/3] bpf: Expose bpf_get_socket_cookie to tracing programs

2020-12-09 Thread Daniel Borkmann
On 12/8/20 8:30 PM, Florent Revest wrote: On Fri, 2020-12-04 at 20:03 +0100, Daniel Borkmann wrote: On 12/4/20 7:56 PM, Daniel Borkmann wrote: On 12/3/20 10:33 PM, Florent Revest wrote: This creates a new helper proto because the existing bpf_get_socket_cookie_sock_proto has a ARG_PTR_TO_CTX

Re: [PATCH bpf-next v9 00/34] bpf: switch to memcg-based memory accounting

2020-12-04 Thread Daniel Borkmann
On 12/3/20 4:26 AM, Roman Gushchin wrote: On Wed, Dec 02, 2020 at 06:54:46PM -0800, Alexei Starovoitov wrote: On Tue, Dec 1, 2020 at 1:59 PM Roman Gushchin wrote: 5) Cryptic -EPERM is returned on exceeding the limit. Libbpf even had a function to "explain" this case for users. ... v9:

Re: [PATCH bpf-next v2 1/3] bpf: Expose bpf_get_socket_cookie to tracing programs

2020-12-04 Thread Daniel Borkmann
On 12/4/20 7:56 PM, Daniel Borkmann wrote: On 12/3/20 10:33 PM, Florent Revest wrote: This creates a new helper proto because the existing bpf_get_socket_cookie_sock_proto has a ARG_PTR_TO_CTX argument and only works for BPF programs where the context is a sock. This helper could also

Re: [PATCH bpf-next v2 1/3] bpf: Expose bpf_get_socket_cookie to tracing programs

2020-12-04 Thread Daniel Borkmann
On 12/3/20 10:33 PM, Florent Revest wrote: This creates a new helper proto because the existing bpf_get_socket_cookie_sock_proto has a ARG_PTR_TO_CTX argument and only works for BPF programs where the context is a sock. This helper could also be useful to other BPF program types such as LSM.

Re: linux-next: build failure after merge of the bpf-next tree

2020-12-01 Thread Daniel Borkmann
On 12/1/20 9:07 AM, Stephen Rothwell wrote: Hi all, After merging the bpf-next tree, today's linux-next build (x86_64 allnoconfig) failed like this: In file included from fs/select.c:32: include/net/busy_poll.h: In function 'sk_mark_napi_id_once': include/net/busy_poll.h:150:36: error: 'const

Re: [PATCH] bpf: remove trailing semicolon in macro definition

2020-11-27 Thread Daniel Borkmann
On 11/27/20 8:27 PM, t...@redhat.com wrote: From: Tom Rix The macro use will already have a semicolon. Signed-off-by: Tom Rix --- include/trace/events/xdp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/trace/events/xdp.h b/include/trace/events/xdp.h

Re: [PATCH bpf v2 2/2] xsk: change the tx writeable condition

2020-11-27 Thread Daniel Borkmann
On 11/25/20 7:48 AM, Xuan Zhuo wrote: Modify the tx writeable condition from the queue is not full to the number of present tx queues is less than the half of the total number of queues. Because the tx queue not full is a very short time, this will cause a large number of EPOLLOUT events, and

Re: [PATCH bpf-next v8 06/34] bpf: prepare for memcg-based memory accounting for bpf maps

2020-11-25 Thread Daniel Borkmann
On 11/25/20 4:00 AM, Roman Gushchin wrote: In the absolute majority of cases if a process is making a kernel allocation, it's memory cgroup is getting charged. Bpf maps can be updated from an interrupt context and in such case there is no process which can be charged. It makes the memory

Re: [PATCH bpf-next v3 1/3] ima: Implement ima_inode_hash

2020-11-25 Thread Daniel Borkmann
On 11/25/20 1:04 PM, KP Singh wrote: On Tue, Nov 24, 2020 at 6:35 PM Yonghong Song wrote: On 11/24/20 7:12 AM, KP Singh wrote: From: KP Singh This is in preparation to add a helper for BPF LSM programs to use IMA hashes when attached to LSM hooks. There are LSM hooks like inode_unlink which

Re: [PATCH bpf-next v7 00/34] bpf: switch to memcg-based memory accounting

2020-11-23 Thread Daniel Borkmann
On 11/19/20 6:37 PM, Roman Gushchin wrote: Currently bpf is using the memlock rlimit for the memory accounting. This approach has its downsides and over time has created a significant amount of problems: 1) The limit is per-user, but because most bpf operations are performed as root, the

Re: [PATCH] bpf: Check the return value of dev_get_by_index_rcu()

2020-11-20 Thread Daniel Borkmann
On 11/20/20 4:19 PM, David Ahern wrote: On 11/20/20 8:13 AM, Daniel Borkmann wrote: [ +David ] On 11/19/20 8:04 AM, xiakaixu1...@gmail.com wrote: From: Kaixu Xia The return value of dev_get_by_index_rcu() can be NULL, so here it is need to check the return value and return error code

Re: [PATCH] bpf: Check the return value of dev_get_by_index_rcu()

2020-11-20 Thread Daniel Borkmann
ady earlier in bpf_ipv{4,6}_fib_lookup() and now need to redo it again ... so yeah there could be a tiny race in here. We wanted do bring this logic closer to what XDP does anyway, something like below, for example. David, thoughts? Thx Subject: [PATCH] diff mtu check Signed-off-by: Daniel Borkm

Re: [PATCH bpf-next v6 06/34] bpf: prepare for memcg-based memory accounting for bpf maps

2020-11-18 Thread Daniel Borkmann
On 11/18/20 2:28 AM, Roman Gushchin wrote: On Tue, Nov 17, 2020 at 05:11:00PM -0800, Alexei Starovoitov wrote: On Tue, Nov 17, 2020 at 5:07 PM Roman Gushchin wrote: On Tue, Nov 17, 2020 at 04:46:34PM -0800, Roman Gushchin wrote: On Wed, Nov 18, 2020 at 01:06:17AM +0100, Daniel Borkmann wrote

Re: [PATCH bpf-next v6 06/34] bpf: prepare for memcg-based memory accounting for bpf maps

2020-11-17 Thread Daniel Borkmann
On 11/17/20 4:40 AM, Roman Gushchin wrote: In the absolute majority of cases if a process is making a kernel allocation, it's memory cgroup is getting charged. Bpf maps can be updated from an interrupt context and in such case there is no process which can be charged. It makes the memory

Re: [PATCH bpf-next v3 2/2] bpf: Add tests for bpf_lsm_set_bprm_opts

2020-11-17 Thread Daniel Borkmann
On 11/17/20 3:13 AM, KP Singh wrote: [...] + +static int run_set_secureexec(int map_fd, int secureexec) +{ + ^ same here + int child_pid, child_status, ret, null_fd; + + child_pid = fork(); + if (child_pid == 0) { + null_fd = open("/dev/null", O_WRONLY); +

Re: [PATCH bpf-next v3 1/2] bpf: Add bpf_lsm_set_bprm_opts helper

2020-11-17 Thread Daniel Borkmann
On 11/17/20 3:13 AM, KP Singh wrote: From: KP Singh The helper allows modification of certain bits on the linux_binprm struct starting with the secureexec bit which can be updated using the BPF_LSM_F_BPRM_SECUREEXEC flag. secureexec can be set by the LSM for privilege gaining executions to

Re: [PATCH bpf-next 1/2] bpf: Add bpf_lsm_set_bprm_opts helper

2020-11-16 Thread Daniel Borkmann
On 11/16/20 3:01 PM, KP Singh wrote: From: KP Singh The helper allows modification of certain bits on the linux_binprm struct starting with the secureexec bit which can be updated using the BPF_LSM_F_BPRM_SECUREEXEC flag. secureexec can be set by the LSM for privilege gaining executions to

Re: [PATCH bpf-next 2/2] bpf: Expose bpf_d_path helper to sleepable LSM hooks

2020-11-13 Thread Daniel Borkmann
On 11/13/20 4:18 AM, Yonghong Song wrote: On 11/12/20 9:19 AM, KP Singh wrote: From: KP Singh Sleepable hooks are never called from an NMI/interrupt context, so it is safe to use the bpf_d_path helper in LSM programs attaching to these hooks. The helper is not restricted to sleepable

Re: [PATCH v4 bpf] tools: bpftool: Add missing close before bpftool net attach exit

2020-11-13 Thread Daniel Borkmann
On 11/13/20 12:51 PM, Wang Hai wrote: progfd is created by prog_parse_fd(), before 'bpftool net attach' exit, it should be closed. Fixes: 04949ccc273e ("tools: bpftool: add net attach command to attach XDP on interface") Signed-off-by: Wang Hai Applied & improved commit msg a bit, thanks!

Re: [PATCH bpf-next v2 1/2] bpf: Augment the set of sleepable LSM hooks

2020-11-12 Thread Daniel Borkmann
On 11/12/20 9:03 PM, KP Singh wrote: From: KP Singh Update the set of sleepable hooks with the ones that do not trigger a warning with might_fault() when exercised with the correct kernel config options enabled, i.e. DEBUG_ATOMIC_SLEEP=y LOCKDEP=y PROVE_LOCKING=y This

Re: [PATCH v3 bpf] tools: bpftool: Add missing close before bpftool net attach exit

2020-11-11 Thread Daniel Borkmann
On 11/11/20 2:54 PM, Wang Hai wrote: progfd is created by prog_parse_fd(), before 'bpftool net attach' exit, it should be closed. Fixes: 04949ccc273e ("tools: bpftool: add net attach command to attach XDP on interface") Signed-off-by: Wang Hai --- v2->v3: add 'err = 0' before successful

Re: [PATCH v3] bpf: Fix unsigned 'datasec_id' compared with zero in check_pseudo_btf_id

2020-11-11 Thread Daniel Borkmann
On 11/11/20 6:03 AM, xiakaixu1...@gmail.com wrote: From: Kaixu Xia The unsigned variable datasec_id is assigned a return value from the call to check_pseudo_btf_id(), which may return negative error code. Fixes coccicheck warning: ./kernel/bpf/verifier.c:9616:5-15: WARNING: Unsigned

Re: [selftest/bpf] b83590ee1a: BUG:KASAN:slab-out-of-bounds_in_l

2020-11-09 Thread Daniel Borkmann
Hi Daniel, On 11/9/20 3:54 PM, kernel test robot wrote: Greeting, FYI, we noticed the following commit (built with gcc-9): commit: b83590ee1add052518603bae607b0524632b7793 ("[PATCH bpf v3 2/2] selftest/bpf: Test bpf_probe_read_user_str() strips trailing bytes after NUL") url:

Re: [PATCH bpf-next] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-04 Thread Daniel Borkmann
On 11/4/20 9:18 PM, Daniel Xu wrote: On Wed Nov 4, 2020 at 8:24 AM PST, Daniel Borkmann wrote: On 11/4/20 3:29 AM, Daniel Xu wrote: do_strncpy_from_user() may copy some extra bytes after the NUL terminator into the destination buffer. This usually does not matter for normal string operations

Re: [PATCH bpf-next] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-04 Thread Daniel Borkmann
On 11/4/20 3:29 AM, Daniel Xu wrote: do_strncpy_from_user() may copy some extra bytes after the NUL terminator into the destination buffer. This usually does not matter for normal string operations. However, when BPF programs key BPF maps with strings, this matters a lot. A BPF program may read

Re: [PATCH] bpf: don't rely on GCC __attribute__((optimize)) to disable GCSE

2020-10-27 Thread Daniel Borkmann
esaulniers Cc: Arvind Sankar Cc: Randy Dunlap Cc: Josh Poimboeuf Cc: Thomas Gleixner Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: Peter Zijlstra (Intel) Cc: Geert Uytterhoeven Cc: Kees Cook Fixes: 3193c0836f203 ("bpf: Disable GCC -fgcse optimization for ___bpf_prog_run()")

Re: linux-next: build failure after merge of the net-next tree

2020-10-06 Thread Daniel Borkmann
On 10/6/20 7:41 AM, Stephen Rothwell wrote: On Tue, 6 Oct 2020 07:13:01 +0200 Christoph Hellwig wrote: On Tue, Oct 06, 2020 at 02:58:47PM +1100, Stephen Rothwell wrote: Hi all, After merging the net-next tree, today's linux-next build (x86_64 allmodconfig) failed like this: It actually

Re: mb2q experience and couple issues

2020-10-01 Thread Daniel Borkmann
On 10/1/20 11:13 AM, Thomas Gleixner wrote: On Wed, Sep 30 2020 at 11:12, Alexei Starovoitov wrote: For the last couple years we've been using mb2q tool to normalize patches and it worked wonderfully. Fun. I thought I'm the only user of it :) We're using it pretty much daily since you've

Re: [PATCH] powerpc: net: bpf_jit_comp: Fix misuse of fallthrough

2020-09-29 Thread Daniel Borkmann
On 9/28/20 11:00 AM, zhe...@windriver.com wrote: From: He Zhe The user defined label following "fallthrough" is not considered by GCC and causes build failure. kernel-source/include/linux/compiler_attributes.h:208:41: error: attribute 'fallthrough' not preceding a case label or default label

Re: [PATCH v7 bpf-next 4/8] selftests/bpf: add bpf_snprintf_btf helper tests

2020-09-29 Thread Daniel Borkmann
On 9/28/20 1:31 PM, Alan Maguire wrote: Tests verifying snprintf()ing of various data structures, flags combinations using a tp_btf program. Tests are skipped if __builtin_btf_type_id is not available to retrieve BTF type ids. Signed-off-by: Alan Maguire [...] +void test_snprintf_btf(void)

Re: [PATCH] tools build feature: cleanup feature files on make clean

2020-09-03 Thread Daniel Borkmann
Hi Arnaldo, On 9/3/20 9:03 PM, Arnaldo Carvalho de Melo wrote: Em Thu, Aug 27, 2020 at 10:53:36AM +0200, Jesper Dangaard Brouer escreveu: The system for "Auto-detecting system features" located under tools/build/ are (currently) used by perf, libbpf and bpftool. It can contain stalled feature

Re: [PATCH] xsk: Free variable on error path

2020-09-02 Thread Daniel Borkmann
On 9/2/20 6:33 PM, Alex Dewar wrote: In xp_create_dma_map(), memory is allocated to dma_map->dma_pages, but then dma_map is erroneously compared to NULL, rather than the member. Fix this. Addresses-Coverity: ("Dead code") Fixes: 921b68692abb ("xsk: Enable sharing of dma mappings")

Re: [PATCH][next] xsk: fix incorrect memory allocation failure check on dma_map->dma_pages

2020-09-02 Thread Daniel Borkmann
On 9/2/20 6:13 PM, Colin King wrote: From: Colin Ian King The failed memory allocation check for dma_map->dma_pages is incorrect, it is null checking dma_map and not dma_map->dma_pages. Fix this. Addresses-Coverity: ("Logicall dead code") Fixes: 921b68692abb ("xsk: Enable sharing of dma

Re: [PATCH][next] xsk: Fix null check on error return path

2020-09-02 Thread Daniel Borkmann
On 9/2/20 5:07 PM, Gustavo A. R. Silva wrote: Currently, dma_map is being checked, when the right object identifier to be null-checked is dma_map->dma_pages, instead. Fix this by null-checking dma_map->dma_pages. Addresses-Coverity-ID: 1496811 ("Logically dead code") Fixes: 921b68692abb ("xsk:

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

2020-09-02 Thread Daniel Borkmann
On 9/2/20 8:57 AM, syzbot wrote: Hello, syzbot found the following issue on: Magnus/Bjorn, ptal, thanks! HEAD commit:dc1a9bf2 octeontx2-pf: Add UDP segmentation offload support git tree: net-next console output: https://syzkaller.appspot.com/x/log.txt?x=16ff67de90 kernel

Re: [PATCH] tools build feature: cleanup feature files on make clean

2020-08-28 Thread Daniel Borkmann
On 8/27/20 10:53 AM, Jesper Dangaard Brouer wrote: The system for "Auto-detecting system features" located under tools/build/ are (currently) used by perf, libbpf and bpftool. It can contain stalled feature detection files, which are not cleaned up by libbpf and bpftool on make clean (side-note:

Re: [PATCH bpf-next] libbpf: simplify the return expression of build_map_pin_path()

2020-08-20 Thread Daniel Borkmann
On 8/19/20 4:53 AM, Xu Wang wrote: Simplify the return expression. Signed-off-by: Xu Wang Applied, thanks!

Re: [PATCH bpf-next v2] bpf: fix segmentation fault of test_progs

2020-08-11 Thread Daniel Borkmann
On 8/10/20 5:39 PM, Jianlin Lv wrote: test_progs reports the segmentation fault as below $ sudo ./test_progs -t mmap --verbose test_mmap:PASS:skel_open_and_load 0 nsec .. test_mmap:PASS:adv_mmap1 0 nsec test_mmap:PASS:adv_mmap2 0 nsec test_mmap:PASS:adv_mmap3 0 nsec test_mmap:PASS:adv_mmap4

Re: [PATCH] kernel: bpf: delete repeated words in comments

2020-08-07 Thread Daniel Borkmann
On 8/7/20 5:31 AM, Randy Dunlap wrote: Drop repeated words in kernel/bpf/. {has, the} Signed-off-by: Randy Dunlap Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: net...@vger.kernel.org Cc: b...@vger.kernel.org Applied, thanks!

Re: [PATCH bpf] bpf: doc: remove references to warning message when using bpf_trace_printk()

2020-08-07 Thread Daniel Borkmann
On 8/7/20 1:50 PM, Alan Maguire wrote: The BPF helper bpf_trace_printk() no longer uses trace_printk(); it is now triggers a dedicated trace event. Hence the described warning is no longer present, so remove the discussion of it as it may confuse people. Fixes: ac5a72ea5c89 ("bpf: Use

Re: [PATCH bpf-next v3 00/29] bpf: switch to memcg-based memory accounting

2020-08-03 Thread Daniel Borkmann
On 8/3/20 7:05 PM, Roman Gushchin wrote: On Mon, Aug 03, 2020 at 06:39:01PM +0200, Daniel Borkmann wrote: On 8/3/20 5:34 PM, Roman Gushchin wrote: On Mon, Aug 03, 2020 at 02:05:29PM +0200, Daniel Borkmann wrote: On 7/30/20 11:22 PM, Roman Gushchin wrote: Currently bpf is using the memlock

Re: [PATCH bpf-next v3 00/29] bpf: switch to memcg-based memory accounting

2020-08-03 Thread Daniel Borkmann
On 8/3/20 5:34 PM, Roman Gushchin wrote: On Mon, Aug 03, 2020 at 02:05:29PM +0200, Daniel Borkmann wrote: On 7/30/20 11:22 PM, Roman Gushchin wrote: Currently bpf is using the memlock rlimit for the memory accounting. This approach has its downsides and over time has created a significant

Re: [PATCH] tools/bpf/bpftool: Fix wrong return value in do_dump()

2020-08-03 Thread Daniel Borkmann
On 8/2/20 1:15 PM, Tianjia Zhang wrote: In case of btf_id does not exist, a negative error code -ENOENT should be returned. Fixes: c93cc69004df3 ("bpftool: add ability to dump BTF types") Cc: Andrii Nakryiko Signed-off-by: Tianjia Zhang Applied, thanks!

Re: [PATCH bpf-next v3 00/29] bpf: switch to memcg-based memory accounting

2020-08-03 Thread Daniel Borkmann
On 7/30/20 11:22 PM, Roman Gushchin wrote: Currently bpf is using the memlock rlimit for the memory accounting. This approach has its downsides and over time has created a significant amount of problems: 1) The limit is per-user, but because most bpf operations are performed as root, the

Re: [PATCH bpf-next v3] Documentation/bpf: Use valid and new links in index.rst

2020-07-31 Thread Daniel Borkmann
On 7/31/20 10:29 AM, Tiezhu Yang wrote: There exists an error "404 Not Found" when I click the html link of "Documentation/networking/filter.rst" in the BPF documentation [1], fix it. Additionally, use the new links about "BPF and XDP Reference Guide" and "bpf(2)" to avoid redirects. [1]

Re: [PATCH bpf-next] bpf: fix compilation warning of selftests

2020-07-31 Thread Daniel Borkmann
On 7/31/20 8:16 AM, Jianlin Lv wrote: Clang compiler version: 12.0.0 The following warning appears during the selftests/bpf compilation: prog_tests/send_signal.c:51:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result] 51 |

Re: [PATCH bpf-next 1/1] arm64: bpf: Add BPF exception tables

2020-07-30 Thread Daniel Borkmann
On 7/30/20 11:14 PM, Jean-Philippe Brucker wrote: On Thu, Jul 30, 2020 at 09:47:39PM +0200, Daniel Borkmann wrote: On 7/30/20 4:22 PM, Jean-Philippe Brucker wrote: On Thu, Jul 30, 2020 at 08:28:56AM -0400, Qian Cai wrote: On Tue, Jul 28, 2020 at 05:21:26PM +0200, Jean-Philippe Brucker wrote

Re: [PATCH bpf-next 1/1] arm64: bpf: Add BPF exception tables

2020-07-30 Thread Daniel Borkmann
On 7/30/20 4:22 PM, Jean-Philippe Brucker wrote: On Thu, Jul 30, 2020 at 08:28:56AM -0400, Qian Cai wrote: On Tue, Jul 28, 2020 at 05:21:26PM +0200, Jean-Philippe Brucker wrote: When a tracing BPF program attempts to read memory without using the bpf_probe_read() helper, the verifier marks the

Re: [Linux-kernel-mentees] [PATCH net v2] xdp: Prevent kernel-infoleak in xsk_getsockopt()

2020-07-28 Thread Daniel Borkmann
On 7/28/20 7:36 AM, Peilin Ye wrote: xsk_getsockopt() is copying uninitialized stack memory to userspace when `extra_stats` is `false`. Fix it. Fixes: 8aa5a33578e9 ("xsk: Add new statistics") Suggested-by: Dan Carpenter Signed-off-by: Peilin Ye --- Doing `= {};` is sufficient since currently

Re: [PATCH][next] bpf: fix swapped arguments in calls to check_buffer_access

2020-07-28 Thread Daniel Borkmann
On 7/27/20 11:39 PM, Yonghong Song wrote: On 7/27/20 10:54 AM, Colin King wrote: From: Colin Ian King There are a couple of arguments of the boolean flag zero_size_allowed and the char pointer buf_info when calling to function check_buffer_access that are swapped by mistake. Fix these by

Re: [PATCH bpf-next] bpf: Generate cookie for new non-initial net NS

2020-07-21 Thread Daniel Borkmann
On 7/20/20 4:09 PM, Jianlin Lv wrote: For non-initial network NS, the net cookie is generated when bpf_get_netns_cookie_sock is called for the first time, but it is more reasonable to complete the cookie generation work when creating a new network NS, just like init_net. net_gen_cookie() be

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

2020-07-16 Thread Daniel Borkmann
On 7/16/20 4:39 PM, Seth Forshee wrote: This reverts commit 3203c9010060806ff88c9989aeab4dc8d9a474dc. The s390 bpf JIT previously had a restriction on the maximum program size, which required some tests in test_bpf to be flagged as expected failures. The program size limitation has been

Re: [Linux-kernel-mentees] [PATCH v3] bpf: Fix NULL pointer dereference in __btf_resolve_helper_id()

2020-07-15 Thread Daniel Borkmann
On 7/14/20 8:09 PM, Peilin Ye wrote: Prevent __btf_resolve_helper_id() from dereferencing `btf_vmlinux` as NULL. This patch fixes the following syzbot bug: https://syzkaller.appspot.com/bug?id=f823224ada908fa5c207902a5a62065e53ca0fcc Reported-by:

Re: [PATCH] tools/bpftool: Fix error return code in do_skeleton()

2020-07-15 Thread Daniel Borkmann
On 7/15/20 5:13 AM, YueHaibing wrote: The error return code should be PTR_ERR(obj) other than PTR_ERR(NULL). Fixes: 5dc7a8b21144 ("bpftool, selftests/bpf: Embed object file inside skeleton") Signed-off-by: YueHaibing --- tools/bpf/bpftool/gen.c | 3 ++- 1 file changed, 2 insertions(+), 1

Re: [PATCH v2 bpf-next 1/2] bpf: use dedicated bpf_trace_printk event instead of trace_printk()

2020-07-10 Thread Daniel Borkmann
On 7/10/20 4:22 PM, Alan Maguire wrote: The bpf helper bpf_trace_printk() uses trace_printk() under the hood. This leads to an alarming warning message originating from trace buffer allocation which occurs the first time a program using bpf_trace_printk() is loaded. We can instead create a

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

2020-07-10 Thread Daniel Borkmann
On 7/10/20 8:17 AM, Alexander A. Klimov wrote: Am 09.07.20 um 22:37 schrieb 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:

Re: [PATCH bpf] selftests: bpf: fix detach from sockmap tests

2020-07-09 Thread Daniel Borkmann
On 7/9/20 1:51 PM, Lorenz Bauer wrote: Fix sockmap tests which rely on old bpf_prog_dispatch behaviour. In the first case, the tests check that detaching without giving a program succeeds. Since these are not the desired semantics, invert the condition. In the second case, the clean up code

  1   2   3   4   5   6   7   8   9   10   >