Re: [PATCH bpf-next] bpf: Allow bpf_jit_enable = 2 with BPF_JIT_ALWAYS_ON config

2018-04-25 Thread Daniel Borkmann
On 04/25/2018 04:14 PM, Alexei Starovoitov wrote: > On Wed, Apr 25, 2018 at 05:25:47PM +0800, Leo Yan wrote: >> >> If we have concern for security issue, should we remove support for >> 'bpf_jit_enable = 2' and modify the doc to reflect this change? > > I suggest to fix the doc. Agree, lets do th

Re: [PATCH 3/3] tools bpftool: Display license GPL compatible in prog show/list

2018-04-25 Thread Daniel Borkmann
On 04/25/2018 11:03 PM, Jakub Kicinski wrote: > On Wed, 25 Apr 2018 19:41:08 +0200, Jiri Olsa wrote: >> @@ -295,6 +297,7 @@ static void print_prog_plain(struct bpf_prog_info *info, >> int fd) >> printf("tag "); >> fprint_hex(stdout, info->tag, BPF_TAG_SIZE, ""); >> print_dev_plain(i

Re: [PATCH 3/3] tools bpftool: Display license GPL compatible in prog show/list

2018-04-26 Thread Daniel Borkmann
On 04/26/2018 09:39 AM, Jiri Olsa wrote: > On Wed, Apr 25, 2018 at 11:14:30PM +0200, Daniel Borkmann wrote: >> On 04/25/2018 11:03 PM, Jakub Kicinski wrote: >>> On Wed, 25 Apr 2018 19:41:08 +0200, Jiri Olsa wrote: >>>> @@ -295,6 +297,7 @@ static void print_p

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

2018-04-26 Thread Daniel Borkmann
On 04/26/2018 02:49 AM, Stephen Rothwell wrote: > Hi all, > > Today's linux-next merge of the bpf-next tree got a conflict in: > > tools/testing/selftests/bpf/.gitignore > > between commit: > > 0abf854d7cbb ("selftests: bpf: update .gitignore with missing generated > files") > > from the

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

2018-04-26 Thread Daniel Borkmann
On 04/26/2018 02:53 AM, Stephen Rothwell wrote: > Hi all, > > Today's linux-next merge of the bpf-next tree got a conflict in: > > samples/sockmap/Makefile > > between commit: > > 4dfe1bb95235 ("bpf: sockmap sample use clang flag, -target bpf") > > from the bpf tree and commit: > > 2e04

Re: [tip:x86/build] x86, retpolines: Raise limit for generating indirect calls from switch-case

2019-02-28 Thread Daniel Borkmann
On 02/28/2019 01:53 PM, H.J. Lu wrote: > On Thu, Feb 28, 2019 at 3:27 AM David Woodhouse wrote: >> On Thu, 2019-02-28 at 03:12 -0800, tip-bot for Daniel Borkmann wrote: >>> Commit-ID: ce02ef06fcf7a399a6276adb83f37373d10cbbe1 >>> Gitweb: >

Re: [tip:x86/build] x86, retpolines: Raise limit for generating indirect calls from switch-case

2019-02-28 Thread Daniel Borkmann
On 02/28/2019 05:25 PM, H.J. Lu wrote: > On Thu, Feb 28, 2019 at 8:18 AM Daniel Borkmann wrote: >> On 02/28/2019 01:53 PM, H.J. Lu wrote: >>> On Thu, Feb 28, 2019 at 3:27 AM David Woodhouse wrote: >>>> On Thu, 2019-02-28 at 03:12 -0800, tip-bot for Daniel B

Re: [tip:x86/build] x86, retpolines: Raise limit for generating indirect calls from switch-case

2019-02-28 Thread Daniel Borkmann
On 02/28/2019 07:09 PM, H.J. Lu wrote: > On Thu, Feb 28, 2019 at 9:58 AM Daniel Borkmann wrote: >> On 02/28/2019 05:25 PM, H.J. Lu wrote: >>> On Thu, Feb 28, 2019 at 8:18 AM Daniel Borkmann >>> wrote: >>>> On 02/28/2019 01:53 PM, H.J. Lu wrote: >

Re: [PATCH] MIPS: eBPF: Fix icache flush end address

2019-03-01 Thread Daniel Borkmann
remove the bogus > multiplication, and use braces to remove the need for a set of brackets > whilst also making it obvious that the target field is a pointer. > > Signed-off-by: Paul Burton > Fixes: b6bd53f9c4e8 ("MIPS: Add missing file for eBPF JIT.") > Cc: Alexei Star

Re: BPF RNG

2019-04-16 Thread Daniel Borkmann
On 04/16/2019 03:55 PM, Kees Cook wrote: > [correcting Alexei's email address and resending...] > > On Tue, Apr 16, 2019 at 8:54 AM Kees Cook wrote: >> >> Hi, >> >> In looking at prandom_u32() users, I noticed that BPF uses its own >> state variable with bpf_user_rnd_u32(). It appears that this s

Re: [LKP] [x86, retpolines] ce02ef06fc: will-it-scale.per_thread_ops 3.1% improvement

2019-03-14 Thread Daniel Borkmann
On 03/13/2019 06:27 AM, kernel test robot wrote: > Greeting, > > FYI, we noticed a 3.1% improvement of will-it-scale.per_thread_ops due to > commit: > > > commit: ce02ef06fcf7a399a6276adb83f37373d10cbbe1 ("x86, retpolines: Raise > limit for generating indirect calls from switch-case") > https:

Re: [PATCH v2] bpf: test_bpf: turn of preemption in function __run_once

2019-02-25 Thread Daniel Borkmann
On 02/22/2019 09:46 AM, Anders Roxell wrote: > When running BPF test suite the following splat occurs: > > [ 415.930950] test_bpf: #0 TAX jited:0 > [ 415.931067] BUG: assuming atomic context at lib/test_bpf.c:6674 > [ 415.946169] in_atomic(): 0, irqs_disabled(): 0, pid: 11556, name: modprobe >

Re: [PATCH] bpf: decrease usercnt if bpf_map_new_fd() fails in bpf_map_get_fd_by_id()

2019-02-26 Thread Daniel Borkmann
On 02/26/2019 03:15 PM, zerons wrote: > [ Upstream commit c91951f15978f1a0c6b65f063d30f7ea7bc6fb42 ] Thanks for the fix! What do you mean by "upstream commit" above in this context? > In bpf/syscall.c, bpf_map_get_fd_by_id() use bpf_map_inc_not_zero() to > increase > the refcount, both map->refc

Re: [PATCH] bpf: decrease usercnt if bpf_map_new_fd() fails in bpf_map_get_fd_by_id()

2019-02-26 Thread Daniel Borkmann
On 02/26/2019 03:58 PM, zerons wrote: > On 2/26/19 22:44, Daniel Borkmann wrote: >> On 02/26/2019 03:15 PM, zerons wrote: >>> [ Upstream commit c91951f15978f1a0c6b65f063d30f7ea7bc6fb42 ] >> >> Thanks for the fix! What do you mean by "upstream commit" above

Re: [PATCH] bpf: decrease usercnt if bpf_map_new_fd() fails in bpf_map_get_fd_by_id()

2019-02-26 Thread Daniel Borkmann
On 02/26/2019 06:33 PM, Martin Lau wrote: > On Tue, Feb 26, 2019 at 10:15:37PM +0800, zerons wrote: >> [ Upstream commit c91951f15978f1a0c6b65f063d30f7ea7bc6fb42 ] >> >> In bpf/syscall.c, bpf_map_get_fd_by_id() use bpf_map_inc_not_zero() to >> increase >> the refcount, both map->refcnt and map->us

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 specify

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 allocati

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 har

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 in a

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: [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 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 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 | write(pipe_c2

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] https:

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 lim

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 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 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] 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 dedicated

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] 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 so

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 doe

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 bpf_ringbuf_reserv

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 each s

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. It

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-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] 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 f

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 retr

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: [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 [] copy_proce

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

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 "kworker/u4:0",

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 the

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 #de

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, also

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

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

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] 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# pyth

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 inc

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 missin

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 set

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

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

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

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. Si

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 be

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

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 s

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 0x888101

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 generate

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 gener

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

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 i

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. tools/lib/b

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 cau

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 index

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 if it

Re: [PATCH 2/3] x86/hash: swap parameters of crc32_u32()

2014-02-22 Thread Daniel Borkmann
On 02/21/2014 11:33 AM, Jan Beulich wrote: ... to match its two callers (i.e. the alternative would have been to swap the arguments at the call sites). Signed-off-by: Jan Beulich Cc: Francesco Fusco Cc: Daniel Borkmann Cc: Thomas Graf Cc: David S. Miller --- arch/x86/lib/hash.c |2

Re: [PATCH 2/3] x86/hash: swap parameters of crc32_u32()

2014-02-24 Thread Daniel Borkmann
On 02/24/2014 09:03 AM, Jan Beulich wrote: On 22.02.14 at 13:09, Daniel Borkmann wrote: On 02/21/2014 11:33 AM, Jan Beulich wrote: ... to match its two callers (i.e. the alternative would have been to swap the arguments at the call sites). Signed-off-by: Jan Beulich Cc: Francesco Fusco Cc

Re: [PATCH 2/3] x86/hash: swap parameters of crc32_u32()

2014-02-24 Thread Daniel Borkmann
On 02/24/2014 11:53 AM, Jan Beulich wrote: On 24.02.14 at 11:22, Daniel Borkmann wrote: On 02/24/2014 09:03 AM, Jan Beulich wrote: On 22.02.14 at 13:09, Daniel Borkmann wrote: On 02/21/2014 11:33 AM, Jan Beulich wrote: ... to match its two callers (i.e. the alternative would have been to

Re: [PATCH 2/3] x86/hash: swap parameters of crc32_u32()

2014-02-24 Thread Daniel Borkmann
On 02/24/2014 02:01 PM, H. Peter Anvin wrote: On 02/24/2014 04:51 AM, H. Peter Anvin wrote: On 02/24/2014 04:41 AM, Jan Beulich wrote: So I'm guessing this hash is deliberately using the CRC32 instruction "backwards", which would actually make sense: an actual CRC is actually a pretty poor has

Re: [PATCH 2/3] x86/hash: swap parameters of crc32_u32()

2014-02-25 Thread Daniel Borkmann
On 02/25/2014 09:26 PM, H. Peter Anvin wrote: On 02/21/2014 02:33 AM, Jan Beulich wrote: ... to match its two callers (i.e. the alternative would have been to swap the arguments at the call sites). Signed-off-by: Jan Beulich Cc: Francesco Fusco Cc: Daniel Borkmann Cc: Thomas Graf Cc: David

Re: [PATCH net] net: flow_dissector: fail on evil iph->ihl

2013-11-03 Thread Daniel Borkmann
ec0a767ae (rps: support IPIP encapsulation). Cc: Eric Dumazet Cc: Petr Matousek Cc: Michael S. Tsirkin Cc: Daniel Borkmann Signed-off-by: Jason Wang Sorry, a bit late as I was offline last 4 days, but fwiw: Acked-by: Daniel Borkmann -- To unsubscribe from this list: send the line "unsub

Re: [crc32] INFO: rcu_sched self-detected stall on CPU { 0} (t=2101 jiffies g=4294967081 c=4294967080 q=41)

2013-11-04 Thread Daniel Borkmann
dress this. Thanks! commit efba721f636ee016859d86d15748650119402b10 Author: Daniel Borkmann Date: Wed Oct 30 11:50:50 2013 +0100 lib: crc32: add test cases for crc32{, c}_combine routines We already have 100 test cases for crcs itself, so split the test buffer with a-prio known chec

Re: [PATCH] net: don't forget to free sk_filter

2013-11-06 Thread Daniel Borkmann
t_memory_rw from softirq")' instead of copying the whole log. Anyways, for v2 with feedback included then: Acked-by: Daniel Borkmann -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo

Re: [PATCH] net: don't forget to free sk_filter

2013-11-06 Thread Daniel Borkmann
On 11/06/2013 08:28 PM, Eric Dumazet wrote: On Wed, 2013-11-06 at 20:19 +0100, Daniel Borkmann wrote: When you send v2 with Alexei's feedback, please also be more specific in your subject like "net: x86: bpf: don't forget to free sk_filter" or the like. Also it's e

Re: [PATCH v10 net-next 1/3] filter: add Extended BPF interpreter and converter

2014-03-15 Thread Daniel Borkmann
On 03/14/2014 09:08 PM, David Miller wrote: From: Alexei Starovoitov Date: Fri, 14 Mar 2014 12:51:17 -0700 can you please explain why the status of these patches is 'deferred' in patchwork ? Is it because of bpf vs nft thread? I think that's orthogonal. I do not find it orthogonal, Pablo bri

Re: [PATCH v4 net-next 1/3] Extended BPF interpreter and converter

2014-03-04 Thread Daniel Borkmann
On 03/04/2014 06:18 AM, Alexei Starovoitov wrote: Extended BPF extends old BPF in the following ways: - from 2 to 10 registers Original BPF has two registers (A and X) and hidden frame pointer. Extended BPF has ten registers and read-only frame pointer. - from 32-bit registers to 64-bit reg

Re: [PATCH v4 net-next 1/3] Extended BPF interpreter and converter

2014-03-04 Thread Daniel Borkmann
On 03/04/2014 06:09 PM, Alexei Starovoitov wrote: On Tue, Mar 4, 2014 at 1:59 AM, Daniel Borkmann wrote: ... Hmm, so the case statement is about BPF_RET | BPF_A and BPF_RET | BPF_K but BPF_RET | BPF_X is not mentioned. However, in BPF_SRC(fp->code) selection you fall back to BPF_X if

Re: [PATCH v4 net-next 1/3] Extended BPF interpreter and converter

2014-03-04 Thread Daniel Borkmann
On 03/04/2014 06:53 PM, Alexei Starovoitov wrote: On Tue, Mar 4, 2014 at 6:28 AM, Hagen Paul Pfeifer wrote: If all issues raised by Daniel are addresed: Acked-by: Hagen Paul Pfeifer Thanks! But ... Future work: 0. seccomp 1. add extended BPF JIT for x86_64 2. add inband old/new demux

Re: [PATCH v5 net-next 3/3] doc: filter: add Extended BPF documentation

2014-03-05 Thread Daniel Borkmann
On 03/04/2014 11:17 PM, Alexei Starovoitov wrote: Signed-off-by: Alexei Starovoitov Reviewed-by: Daniel Borkmann -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.

Re: [PATCH v5 net-next 1/3] filter: add Extended BPF interpreter and converter

2014-03-05 Thread Daniel Borkmann
unattached_filter_create() interfaces 3. tracing filters systemtap-like with extended BPF 4. OVS with extended BPF 5. nftables with extended BPF Signed-off-by: Alexei Starovoitov Acked-by: Hagen Paul Pfeifer From what I can tell, looks good to me: Reviewed-by: Daniel Borkmann So nex

Re: [PATCH] tools/net/Makefile: Define PACKAGE to fix bfd build problems

2014-03-06 Thread Daniel Borkmann
config.h must be included before this header This is similar to commit 3ce711a6abc27abce1554e1d671a8762b7187690 "perf tools: bfd.h/libbfd detection fails with recent binutils" See: https://sourceware.org/bugzilla/show_bug.cgi?id=14243 CC: David S. Miller CC: Daniel Borkmann Signed-off-

Re: [PATCH v2 1/3] x86/hash: fix build failure with older binutils

2014-02-27 Thread Daniel Borkmann
Cc: Daniel Borkmann Cc: Thomas Graf Cc: David S. Miller Acked-by: Daniel Borkmann -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Pleas

Re: [PATCH v2 3/3] x86/hash: cleanup

2014-02-27 Thread Daniel Borkmann
On 02/27/2014 09:47 AM, Jan Beulich wrote: - simplify switch statement - add __init annotation to setup_arch_fast_hash() Signed-off-by: Jan Beulich Cc: Francesco Fusco Cc: Daniel Borkmann Cc: Thomas Graf Cc: David S. Miller Acked-by: Daniel Borkmann -- To unsubscribe from this list

Re: [PATCH v3 net-next 1/1] bpf32->bpf64 mapper and bpf64 interpreter

2014-02-28 Thread Daniel Borkmann
Hi Alexei, [also cc'ing Hagen and Jesse] Just some minor comments below ... let me know what you think. On 02/27/2014 03:38 AM, Alexei Starovoitov wrote: Extended BPF (or 64-bit BPF) is an instruction set to create safe dynamically loadable filters that can call fixed set of kernel functions a

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