[PATCH bpf v3 1/2] bpf: fix recursive lock when verdict program return SK_PASS

2024-11-10 Thread Jiayuan Chen
efore, but it has not been fixed. Previous discussion: https://lore.kernel.org/all/6684a5864ec86_403d20898@john.notmuch Fixes: 6648e613226e ("bpf, skmsg: Fix NULL pointer dereference in sk_psock_skb_ingress_enqueue") Reported-by: Vincent Whitchurch Signed-off-by: Jiayuan Chen Signed

[PATCH bpf v3 2/2] selftests/bpf: Add some tests with sockmap SK_PASS

2024-11-10 Thread Jiayuan Chen
to this eBPF program have been tested (currently only in sockmap_basic.c). All tests are passed. Signed-off-by: Jiayuan Chen --- test result 310/1 sockmap_basic/sockmap create_update_free:OK 310/2 sockmap_basic/sockhash create_update_free:OK 310/3 sockmap_basic/sockmap sk_msg load hel

[PATCH bpf v3 0/2] bpf: fix recursive lock and add test

2024-11-10 Thread Jiayuan Chen
v/T/#u --- Jiayuan Chen (2): bpf: fix recursive lock when verdict program return SK_PASS selftests/bpf: Add some tests with sockmap SK_PASS net/core/skmsg.c | 4 +- .../selftests/bpf/prog_tests/sockmap_basic.c | 54 +++ .../bpf/progs/test_sockmap_pass_

[PATCH kselftest] fix single bpf test

2024-11-18 Thread Jiayuan Chen
If a user has specified a single TARGETS, it indicates an expectation to run the specified target, and thus the object should not be skipped. Another way is to change TARGETS to DEFAULT_TARGETS in the Makefile and then check if the user specified TARGETS and decide whether filter or not, though thi

[PATCH bpf v4 2/2] selftests/bpf: Add some tests with sockmap SK_PASS

2024-11-17 Thread Jiayuan Chen
Add a new tests in sockmap_basic.c to test SK_PASS for sockmap Signed-off-by: Jiayuan Chen --- .../selftests/bpf/prog_tests/sockmap_basic.c | 54 +++ 1 file changed, 54 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c b/tools/testing/selftests

[PATCH bpf v4 1/2] bpf: fix recursive lock when verdict program return SK_PASS

2024-11-17 Thread Jiayuan Chen
efore, but it has not been fixed. Previous discussion: https://lore.kernel.org/all/6684a5864ec86_403d20898@john.notmuch Fixes: 6648e613226e ("bpf, skmsg: Fix NULL pointer dereference in sk_psock_skb_ingress_enqueue") Reported-by: Vincent Whitchurch Signed-off-by: Jiayuan Chen Signed

[PATCH bpf v4 0/2] bpf: fix recursive lock and add test

2024-11-17 Thread Jiayuan Chen
v1: https://lore.kernel.org/bpf/55fc6114-7e64-4b65-86d2-92cfd1e9e...@linux.dev/T/#u --- Jiayuan Chen (2): bpf: fix recursive lock when verdict program return SK_PASS selftests/bpf: Add some tests with sockmap SK_PASS net/core/skmsg.c | 4 +- .../selftest

[PATCH bpf-next v1] selftests/bpf: avoid generating untracked files when running bpf selftests

2024-12-18 Thread Jiayuan Chen
h it was set with a command argument, you can use an override directive, which is a line that looks like this: override variable := value Link: https://www.gnu.org/software/make/manual/make.html#Override-Directive Fixes: dc3a8804d790 ("selftests/bpf: Adapt OUTPUT appending logic to lower

[PATCH bpf-next v3 1/3] bpf, sockmap: avoid using sk_socket after free when sending

2025-03-17 Thread Jiayuan Chen
xa0 ? exc_general_protection+0x14c/0x230 ? asm_exc_general_protection+0x26/0x30 ? sock_sendmsg+0x21d/0x440 ? sock_sendmsg+0x3e0/0x440 ? __pfx_sock_sendmsg+0x10/0x10 __skb_send_sock+0x543/0xb70 sk_psock_backlog+0x247/0xb80 ... ''' Reported-by: Michal Luczaj Fixes: 799aa7f98d53

[PATCH bpf-next v3 3/3] selftests/bpf: Add edge case tests for sockmap

2025-03-17 Thread Jiayuan Chen
Add edge case tests for sockmap. Signed-off-by: Jiayuan Chen --- .../selftests/bpf/prog_tests/socket_helpers.h | 13 +++- .../selftests/bpf/prog_tests/sockmap_basic.c | 60 +++ 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/prog_tests

[PATCH bpf-next v3 0/3] bpf: Fix use-after-free of sockmap

2025-03-17 Thread Jiayuan Chen
https://lore.kernel.org/bpf/20250228055106.58071-1-jiayuan.c...@linux.dev/ v1 -> v2: 1. Add Fixes tag. 2. Extend selftest of edge case for TCP/UDP sockets. 3. Add Reviewed-by and Acked-by tag. https://lore.kernel.org/bpf/20250226132242.52663-1-jiayuan.c...@linux.dev/T/#t Jiayuan Chen (3): bpf

[PATCH bpf-next v3 2/3] bpf, sockmap: avoid using sk_socket after free when reading

2025-03-17 Thread Jiayuan Chen
dresses the immediate issue. Fixes: c63829182c37 ("af_unix: Implement ->psock_update_sk_prot()") Reported-by: syzbot+dd90a702f518e0eac...@syzkaller.appspotmail.com Closes: https://lore.kernel.org/bpf/6734c033.050a0220.2a2fcc.0015@google.com/ Signed-off-by: Jiayuan Chen --- net/core/skmsg.c | 1

Re: [PATCH bpf-next v3 1/3] bpf, sockmap: avoid using sk_socket after free when sending

2025-03-20 Thread Jiayuan Chen
March 20, 2025 at 20:32, "Michal Luczaj" wrote: > > On 3/17/25 10:22, Jiayuan Chen wrote: > > > > > The sk->sk_socket is not locked or referenced, and during the call to > > > > skb_send_sock(), there is a race condition with the release of sk_

Re: [PATCH bpf-next v3 1/3] bpf, sockmap: avoid using sk_socket after free when sending

2025-04-04 Thread Jiayuan Chen
2025/3/20 07:02, "Cong Wang" wrote: > > On Mon, Mar 17, 2025 at 05:22:54PM +0800, Jiayuan Chen wrote: > > > > > The sk->sk_socket is not locked or referenced, and during the call to > > > > Hm? We should have a reference in socket map, whether d

Re: [PATCH bpf-next v3 1/3] bpf, sockmap: avoid using sk_socket after free when sending

2025-04-05 Thread Jiayuan Chen
March 20, 2025 at 08:06, "Cong Wang" wrote: > > On Wed, Mar 19, 2025 at 11:36:13PM +0000, Jiayuan Chen wrote: > > > > > 2025/3/20 07:02, "Cong Wang" wrote: > > > > > > > > > > > > On Mon, Mar 17, 2025 at 05:

[PATCH bpf v2 2/2] selftests/bpf: add perf test for adjust_{head,meta}

2025-04-05 Thread Jiayuan Chen
run adjust head with size 20 cost 58 ns run adjust head with size 40 cost 58 ns run adjust head with size 200 cost 66 ns Signed-off-by: Jiayuan Chen --- .../selftests/bpf/prog_tests/xdp_perf.c | 52 --- tools/testing/selftests/bpf/progs/xdp_dummy.c | 14 + 2 files changed

Re: [PATCH bpf-next v3 2/3] bpf, sockmap: avoid using sk_socket after free when reading

2025-03-26 Thread Jiayuan Chen
March 20, 2025 at 08:34, "Cong Wang" wrote: > > On Mon, Mar 17, 2025 at 05:22:55PM +0800, Jiayuan Chen wrote: > > > > > There are potential concurrency issues, as shown below. > > > > ''' > > > > CPU0 CPU1 > &g

[PATCH bpf-next v4 3/3] selftests/bpf: Add edge case tests for sockmap

2025-04-08 Thread Jiayuan Chen
Add edge case tests for sockmap. Signed-off-by: Jiayuan Chen --- .../selftests/bpf/prog_tests/socket_helpers.h | 13 +++- .../selftests/bpf/prog_tests/sockmap_basic.c | 60 +++ 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/prog_tests

[PATCH bpf-next v4 1/3] bpf, sockmap: avoid using sk_socket after free when sending

2025-04-08 Thread Jiayuan Chen
a0 ? exc_general_protection+0x14c/0x230 ? asm_exc_general_protection+0x26/0x30 ? sock_sendmsg+0x21d/0x440 ? sock_sendmsg+0x3e0/0x440 ? __pfx_sock_sendmsg+0x10/0x10 __skb_send_sock+0x543/0xb70 sk_psock_backlog+0x247/0xb80 ... ''' Reported-by: Michal Luczaj Fixes: 799aa7f98d53 (&qu

[PATCH bpf-next v4 0/3] bpf: Fix use-after-free of sockmap

2025-04-08 Thread Jiayuan Chen
selftest of edge case for TCP/UDP sockets. 3. Add Reviewed-by and Acked-by tag. https://lore.kernel.org/bpf/20250226132242.52663-1-jiayuan.c...@linux.dev/T/#t Jiayuan Chen (3): bpf, sockmap: avoid using sk_socket after free when sending bpf, sockmap: avoid using sk_socket after free when reading

[PATCH bpf-next v4 2/3] bpf, sockmap: avoid using sk_socket after free when reading

2025-04-10 Thread Jiayuan Chen
dresses the immediate issue. Fixes: c63829182c37 ("af_unix: Implement ->psock_update_sk_prot()") Reported-by: syzbot+dd90a702f518e0eac...@syzkaller.appspotmail.com Closes: https://lore.kernel.org/bpf/6734c033.050a0220.2a2fcc.0015@google.com/ Signed-off-by: Jiayuan Chen --- net/core/skmsg.c | 1

[PATCH bpf-next v1 4/4] selftest/bpf/benchs: Add benchmark for sockmap usage

2025-04-07 Thread Jiayuan Chen
k can be run with: ''' ./bench sockmap -c 2 -p 1 -a --rx-verdict-ingress ''' In the future, we plan to move socket_helpers.h out of the prog_tests directory to make it accessible for the benchmark. This will enable better support for various socket types. Signed-off-b

[PATCH bpf-next v1 3/4] bpf, sockmap: Fix panic when calling skb_linearize

2025-04-07 Thread Jiayuan Chen
| sk_psock_skb_ingress_enqueue sk_psock_verdict_apply_↑ skb_linearize ''' Note that for verdict_apply path, the skb_get operation is unnecessary so we add 'take_ref' param to control it's behavior. Fixes: a454d84ee20b (&qu

[PATCH bpf-next v1 1/4] bpf, sockmap: Fix data lost during EAGAIN retries

2025-04-07 Thread Jiayuan Chen
sockmap'... create socket fd c1:13 p1:14 c2:15 p2:16 Benchmark 'sockmap' started. Send Speed 1347.236 MB/s, BPF Speed 1347.367 MB/s, Rcv Speed 65.402 MB/s Send Speed 1353.320 MB/s, BPF Speed 1353.320 MB/s, Rcv Speed 65.536 MB/s Send Speed 1353.186 MB/s, BPF Speed 1353.121 MB/s,

[PATCH bpf-next v1 2/4] bpf, sockmap: fix duplicated data transmission

2025-04-07 Thread Jiayuan Chen
path to resend the entire skb data instead of continuing from the previous offset, resulting in data overlap at the receiver side. Fixes: 405df89dd52c ("bpf, sockmap: Improved check for empty queue") Signed-off-by: Jiayuan Chen --- net/core/skmsg.c | 14 +- 1 file change

[PATCH bpf-next v1 2/2] selftests/bpf: Add link update test for cgroup_storage

2025-04-18 Thread Jiayuan Chen
ing 0 nsec test_cgroup_storage_update:PASS:third ping 0 nsec 61 cgroup_storage_update:OK Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Jiayuan Chen --- .../selftests/bpf/prog_tests/cgroup_storage.c | 45 +++ .../selftests/bpf/progs/cgroup_storage.c | 6 +++ 2 fil

Re: [PATCH bpf-next v1 1/2] bpf: Create cgroup storage if needed when updating link

2025-04-22 Thread Jiayuan Chen
April 23, 2025 at 08:13, "Martin KaFai Lau" wrote: > > On 4/16/25 9:40 PM, Jiayuan Chen wrote: > > > > > when we attach a prog without cgroup_storage map being used, > > > > cgroup_storage in struct bpf_prog_array_item is empty. Then, if we use &g

[RFC net-next v1 2/2] selftests/net: Add udp UDP_STOP_RCV selftest

2025-04-30 Thread Jiayuan Chen
Add a new selftest, which uses UDP_STOP_RCV to make UDP simulate TCP's listen and accept. Signed-off-by: Jiayuan Chen --- tools/testing/selftests/net/.gitignore| 1 + tools/testing/selftests/net/Makefile | 1 + .../testing/selftests/net/test_udp_stop_rcv.c

[RFC net-next v1 1/2] udp: Introduce UDP_STOP_RCV option for UDP

2025-04-30 Thread Jiayuan Chen
explicit boundaries, and we receive a complete packet before creating a connected socket.) Before this patch, the connected socket had to filter requests at recvmsg time, acting as a dispatcher to some extent. With this patch, we can consider the bind and connect operations to be atomic. Signed-off-by:

Re: [RFC net-next v1 1/2] udp: Introduce UDP_STOP_RCV option for UDP

2025-04-30 Thread Jiayuan Chen
2025/5/1 12:42, "Kuniyuki Iwashima" wrote: > > From: Jiayuan Chen > > Date: Thu, 1 May 2025 11:51:08 +0800 > > > > > For some services we are using "established-over-unconnected" model. > > > > > > > > ''

[PATCH bpf-next v1 0/2] bpf: Fix panic in bpf_get_local_storage

2025-04-16 Thread Jiayuan Chen
truct bpf_prog_array_item is empty. Then, if we use BPF_LINK_UPDATE to replace the old program with a new one that uses the cgroup_storage map, we miss the cgroup_storage being initialized. This causes a panic when accessing storage in bpf_get_local_storage. Jiayuan Chen (2): bpf: Create cgroup st

[PATCH bpf-next v1 1/2] bpf: Create cgroup storage if needed when updating link

2025-04-16 Thread Jiayuan Chen
stroage in bpf_get_local_storage. Reported-by: syzbot+e6e8f6618a2d4b35e...@syzkaller.appspotmail.com Closes: https://lore.kernel.org/all/67fc867e.050a0220.2970f9.03b8@google.com/T/ Fixes: 0c991ebc8c69 ("bpf: Implement bpf_prog replacement for an active bpf_cgroup_link") Signed-off-by: Ji

[PATCH bpf-next v1 0/2] ktls, sockmap: Fix missing uncharge operation and add selfttest

2025-04-24 Thread Jiayuan Chen
ogical changes, but only fills in the missing uncharge places. This issue has existed all along, until it was exposed after we added the apply test in test_sockmap: commit 3448ad23b34e ("selftests/bpf: Add apply_bytes test to test_txmsg_redir_wait_sndmem in test_sockmap") Jiayua

[PATCH bpf-next v1 2/2] selftests/bpf: Add test to cover sockmap with ktls

2025-04-24 Thread Jiayuan Chen
? __list_add_valid_or_report+0x83/0xea ? srso_return_thunk+0x5/0x5f ? __list_add+0x45/0x52 process_scheduled_works+0x73/0x82 worker_thread+0x1ce/0x2ae Signed-off-by: Jiayuan Chen --- .../selftests/bpf/prog_tests/sockmap_ktls.c | 76 +++ .../selftests/bpf/progs

[PATCH bpf-next v1 1/2] ktls, sockmap: Fix missing uncharge operation

2025-04-24 Thread Jiayuan Chen
aAmIi0vlycHtbXeb@pop-os.localdomain/T/#t Fixes: d3b18ad31f93 ("tls: add bpf support to sk_msg handling") Signed-off-by: Jiayuan Chen --- net/tls/tls_sw.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index f3d7d19482da..fc88e34b7f33 10

[PATCH bpf-next v1 0/4] bpf, sockmap: Fix data loss and panic issues

2025-04-10 Thread Jiayuan Chen
equires maintainers to spare some time from their busy schedules for review. https://lore.kernel.org/bpf/20250317092257.68760-1-jiayuan.c...@linux.dev/T/#t Jiayuan Chen (4): bpf, sockmap: Fix data lost during EAGAIN retries bpf, sockmap: fix duplicated data transmission bpf, sockmap: Fix panic

Re: [PATCH bpf-next v1 1/2] ktls, sockmap: Fix missing uncharge operation

2025-04-28 Thread Jiayuan Chen
2025/4/29 08:14, "Cong Wang" wrote: > > On Fri, Apr 25, 2025 at 01:59:57PM +0800, Jiayuan Chen wrote: > > > > > net/tls/tls_sw.c | 7 +++ > > > > 1 file changed, 7 insertions(+) > > > > > > > > diff --git

[PATCH bpf-next v2 0/3] bpf: Fix use-after-free of sockmap

2025-02-27 Thread Jiayuan Chen
#x27;'' However, this will cause too many branches, and it's not suitable to distinguish network protocols in skmsg.c. [1] https://syzkaller.appspot.com/bug?extid=dd90a702f518e0eac072 [2] https://syzkaller.appspot.com/text?tag=KernelConfig&x=1362a5aee630ff34 --- v1 -> v2: 1. Ad

[PATCH bpf-next v2 2/3] selftests/bpf: Add socketpair to create_pair to support unix socket

2025-02-27 Thread Jiayuan Chen
-by: Jiayuan Chen --- .../selftests/bpf/prog_tests/socket_helpers.h | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/prog_tests/socket_helpers.h b/tools/testing/selftests/bpf/prog_tests/socket_helpers.h index 1bdfb79ef009

[PATCH bpf-next v2 3/3] selftests/bpf: Add edge case tests for sockmap

2025-02-27 Thread Jiayuan Chen
Add edge case tests for sockmap. Acked-by: Cong Wang Signed-off-by: Jiayuan Chen --- .../selftests/bpf/prog_tests/sockmap_basic.c | 59 +++ 1 file changed, 59 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c b/tools/testing/selftests/bpf

[PATCH bpf-next v2 1/3] bpf, sockmap: avoid using sk_socket after free

2025-02-27 Thread Jiayuan Chen
ernel.org/bpf/6734c033.050a0220.2a2fcc.0015@google.com/ Reviewed-by: Cong Wang Reviewed-by: John Fastabend Signed-off-by: Jiayuan Chen --- net/core/skmsg.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/net/core/skmsg.c b/net/core/skmsg.c index 0ddc4

Re: [PATCH bpf-next v1 2/3] selftests/bpf: Add socketpair to create_pair to support unix socket

2025-02-28 Thread Jiayuan Chen
On Thu, Feb 27, 2025 at 02:21:41PM -0800, John Fastabend wrote: > On 2025-02-27 11:52:04, Cong Wang wrote: > > On Wed, Feb 26, 2025 at 09:22:41PM +0800, Jiayuan Chen wrote: > > > Current wrapper function create_pair() is used to create a pair of > > > connected links

Re: [PATCH bpf-next v1 1/3] bpf, sockmap: avoid using sk_socket after free

2025-02-27 Thread Jiayuan Chen
On Thu, Feb 27, 2025 at 03:04:26PM -0800, Martin KaFai Lau wrote: > On 2/26/25 5:22 AM, Jiayuan Chen wrote: > > Use RCU lock to protect sk_socket, preventing concurrent close and release > > by another thread. > > > > Because TCP/UDP are already within a relati

Re: [PATCH bpf-next v1 2/3] selftests/bpf: Add socketpair to create_pair to support unix socket

2025-02-27 Thread Jiayuan Chen
On Thu, Feb 27, 2025 at 11:52:04AM -0800, Cong Wang wrote: > On Wed, Feb 26, 2025 at 09:22:41PM +0800, Jiayuan Chen wrote: > > Current wrapper function create_pair() is used to create a pair of > > connected links and returns two fds, but it does not support unix sockets. &

Re: [PATCH bpf-next v2 1/3] bpf, sockmap: avoid using sk_socket after free

2025-03-10 Thread Jiayuan Chen
March 7, 2025 at 5:45 PM, "Michal Luczaj" wrote: > > On 2/28/25 06:51, Jiayuan Chen wrote: > > > > > ... > > > > static void sk_psock_verdict_data_ready(struct sock *sk) > > > > { > > > > - struct socket *sock = sk-

Re: [PATCH bpf-next v2 1/3] bpf, sockmap: avoid using sk_socket after free

2025-03-11 Thread Jiayuan Chen
March 10, 2025 at 9:08 PM, "Michal Luczaj" wrote: > > On 3/10/25 12:36, Jiayuan Chen wrote: > > > > > March 7, 2025 at 5:45 PM, "Michal Luczaj" wrote: > > > > ... > > > > > > > > BTW, lockdep (CONFIG_LOCKDEP

[PATCH bpf-next v1 1/3] selftests/bpf: Allow auto port binding for cgroup connect

2025-02-27 Thread Jiayuan Chen
Allow auto port binding for cgroup connect test to avoid binding conflict. Result: ./test_progs -a cgroup_v1v2 59 cgroup_v1v2:OK Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Jiayuan Chen --- .../testing/selftests/bpf/prog_tests/cgroup_v1v2.c | 13 + .../testing

[PATCH bpf-next v1 2/3] selftests/bpf: Allow auto port binding for bpf nf

2025-02-27 Thread Jiayuan Chen
/set_status_after_insert:OK 24/8bpf_nf/change_timeout_after_alloc:OK 24/9bpf_nf/change_status_after_alloc:OK 24/10 bpf_nf/write_not_allowlisted_field:OK 24 bpf_nf:OK Summary: 1/10 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Jiayuan Chen --- tools/testing/selftests/bpf/prog_tests

[PATCH bpf-next v1 0/3] Optimize bpf selftest to increase CI success rate

2025-02-27 Thread Jiayuan Chen
/13549227497/job/37868926343 https://github.com/kernel-patches/bpf/actions/runs/13548089029/job/37865812030 https://github.com/kernel-patches/bpf/actions/runs/13553536268/job/37883329296 (Perhaps it's due to the large number of pull requests requiring CI runs?) Jiayuan Chen (3): selftests/bpf: Allow

[PATCH bpf-next v1 3/3] selftests/bpf: Fixes for test_maps test

2025-02-27 Thread Jiayuan Chen
date_delete' Fork 100 tasks to 'test_update_delete' Fork 100 tasks to 'test_update_delete' .. test_task_storage_map_stress_lookup:PASS test_maps: OK, 0 SKIPPED Signed-off-by: Jiayuan Chen --- tools/testing/selftests/bpf/test_maps.c | 9 + 1 file changed, 5 insertions(+), 4

[PATCH bpf-next v1 0/3] bpf: Fix use-after-free of sockmap

2025-02-26 Thread Jiayuan Chen
#x27;'' However, this will cause too many branches, and it's not suitable to distinguish network protocols in skmsg.c. [1] https://syzkaller.appspot.com/bug?extid=dd90a702f518e0eac072 [2] https://syzkaller.appspot.com/text?tag=KernelConfig&x=1362a5aee630ff34 Jiayuan Chen (3):

[PATCH bpf-next v1 3/3] selftests/bpf: Add edge case tests for sockmap

2025-02-26 Thread Jiayuan Chen
Add edge case tests for sockmap. Signed-off-by: Jiayuan Chen --- .../selftests/bpf/prog_tests/sockmap_basic.c | 57 +++ 1 file changed, 57 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c b/tools/testing/selftests/bpf/prog_tests

[PATCH bpf-next v1 2/3] selftests/bpf: Add socketpair to create_pair to support unix socket

2025-02-26 Thread Jiayuan Chen
-by: Jiayuan Chen --- .../selftests/bpf/prog_tests/socket_helpers.h | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/prog_tests/socket_helpers.h b/tools/testing/selftests/bpf/prog_tests/socket_helpers.h index 1bdfb79ef009

[PATCH bpf-next v1 1/3] bpf, sockmap: avoid using sk_socket after free

2025-02-26 Thread Jiayuan Chen
'' Adding rcu_read_{un}lock() at the entrance and exit of sk_data_ready will not increase performance overhead. Reported-by: syzbot+dd90a702f518e0eac...@syzkaller.appspotmail.com Closes: https://lore.kernel.org/bpf/6734c033.050a0220.2a2fcc.0015....@google.com/ Signed-off-by: Jiayuan Ch

[PATCH bpf v2 0/2] bpf, xdp: clean adjust_{head,meta} memory when offset < 0

2025-03-30 Thread Jiayuan Chen
ncreased by 2ns, but I think this is negligible considering the entire net stack. Jiayuan Chen (2): bpf, xdp: clean head/meta when expanding it selftests/bpf: add perf test for adjust_{head,meta} include/uapi/linux/bpf.h | 8 +-- net/core/filter.c

Re: [PATCH bpf v2 1/2] bpf, xdp: clean head/meta when expanding it

2025-04-03 Thread Jiayuan Chen
April 3, 2025 at 22:24, "Alexei Starovoitov" wrote: > > On Sun, Mar 30, 2025 at 8:27 PM Jiayuan Chen wrote: > > > > > The device allocates an skb, it additionally allocates a prepad size > > > > (usually equal to NET_SKB_PAD or XDP_PACKET_HEAD

[PATCH bpf-next v1 0/2] bpf,ktls: Fix data corruption caused by using bpf_msg_pop_data() in ktls

2025-05-23 Thread Jiayuan Chen
sockhash:ktls:txmsg test push/pop data:OK 44/ 1 sockhash:ktls:txmsg test ingress parser:OK 45/ 0 sockhash:ktls:txmsg test ingress parser2:OK Pass: 45 Fail: 0 [1]: https://lore.kernel.org/bpf/CAM_iQpU7=4xjbefzoxndkox9gffmoe7fcwmq5thbsymbrnm...@mail.gmail.com/ Jiayuan Chen (2): bpf,ktl

[PATCH bpf-next v1 1/2] bpf,ktls: Fix data corruption when using bpf_msg_pop_data() in ktls

2025-05-23 Thread Jiayuan Chen
transmission. This causes uninitialized bytes to be appended after a complete "Application Data" packet, leading to errors on the receiving end when parsing TLS record. Fixes: d3b18ad31f93 ("tls: add bpf support to sk_msg handling") Reported-by: Cong Wang Signed-off-by: Jiayua

[PATCH bpf-next v1 2/2] selftests/bpf: Add test to cover ktls with bpf_msg_pop_data

2025-05-23 Thread Jiayuan Chen
The selftest can reproduce an issue where using bpf_msg_pop_data() in ktls causes errors on the receiving end. Signed-off-by: Jiayuan Chen --- .../selftests/bpf/prog_tests/sockmap_ktls.c | 91 +++ .../selftests/bpf/progs/test_sockmap_ktls.c | 4 + 2 files changed, 95

[PATCH bpf-next v1 2/2] bpf/selftests: Add test cases for retrieving classid

2025-05-28 Thread Jiayuan Chen
from cgroup sockopt:OK 53 cgroup_get_classid:OK Summary: 1/4 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Jiayuan Chen --- .../selftests/bpf/prog_tests/cgroup_classid.c | 212 ++ .../selftests/bpf/progs/test_cgroup_classid.c | 51 + 2 files changed, 263 insertions

[PATCH bpf-next v1 1/2] bpf: Restrict usage scope of bpf_get_cgroup_classid

2025-05-28 Thread Jiayuan Chen
c7ed68b95cfa6...@syzkaller.appspotmail.com Signed-off-by: Jiayuan Chen --- include/linux/bpf-cgroup.h | 8 kernel/bpf/cgroup.c| 25 + kernel/bpf/helpers.c | 4 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/include/linux/b

Re: [PATCH bpf-next v1 1/2] bpf,ktls: Fix data corruption when using bpf_msg_pop_data() in ktls

2025-06-02 Thread Jiayuan Chen
2025/5/30 02:16, "Cong Wang" 写到: > > On Fri, May 23, 2025 at 09:18:58PM +0800, Jiayuan Chen wrote: > > > > > When sending plaintext data, we initially calculated the corresponding > > > > ciphertext length. However, if we later reduced the plaint

[PATCH bpf-next v2 0/2] bpf,ktls: Fix data corruption caused by using bpf_msg_pop_data() in ktls

2025-06-08 Thread Jiayuan Chen
eck and added Reviewed-by tag. https://lore.kernel.org/bpf/20250605145529.3q3aqr6iygpa6...@gmail.com/ Jiayuan Chen (2): bpf,ktls: Fix data corruption when using bpf_msg_pop_data() in ktls selftests/bpf: Add test to cover ktls with bpf_msg_pop_data net/tls/tls_sw.c

[PATCH bpf-next v2 2/2] selftests/bpf: Add test to cover ktls with bpf_msg_pop_data

2025-06-08 Thread Jiayuan Chen
The selftest can reproduce an issue where using bpf_msg_pop_data() in ktls causes errors on the receiving end. Signed-off-by: Jiayuan Chen --- .../selftests/bpf/prog_tests/sockmap_ktls.c | 91 +++ .../selftests/bpf/progs/test_sockmap_ktls.c | 4 + 2 files changed, 95

[PATCH bpf-next v2 1/2] bpf,ktls: Fix data corruption when using bpf_msg_pop_data() in ktls

2025-06-08 Thread Jiayuan Chen
transmission. This causes uninitialized bytes to be appended after a complete "Application Data" packet, leading to errors on the receiving end when parsing TLS record. Fixes: d3b18ad31f93 ("tls: add bpf support to sk_msg handling") Reported-by: Cong Wang Signed-off-by: Jiayu