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
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
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_
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
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
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
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
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
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
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
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
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
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_
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
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:
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
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
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
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
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
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
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
| 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
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,
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
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
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
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
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:
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.
> >
> >
> >
> > ''
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
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
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
? __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
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
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
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
#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
-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
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
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
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
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
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.
&
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-
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
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
/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
/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
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
#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):
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
-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
''
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
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
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
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
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
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
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
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
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
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
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
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
65 matches
Mail list logo