-
Notifications
You must be signed in to change notification settings - Fork 5
ktls, sockmap: Fix missing uncharge operation and add selfttest #5253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: bpf-next_base
Are you sure you want to change the base?
ktls, sockmap: Fix missing uncharge operation and add selfttest #5253
Conversation
Upstream branch: 46eb012 |
267f1d3
to
5df03a7
Compare
Upstream branch: 64821d2 |
fc0050e
to
7028e98
Compare
5df03a7
to
2eb2671
Compare
Upstream branch: 91dbac4 |
7028e98
to
7ea29c3
Compare
2eb2671
to
044273f
Compare
Upstream branch: 224ee86 |
7ea29c3
to
afd5cf3
Compare
044273f
to
fea86b9
Compare
Upstream branch: 8e64c38 |
afd5cf3
to
99de885
Compare
fea86b9
to
f482624
Compare
Upstream branch: 38d976c |
99de885
to
eafe4d9
Compare
f482624
to
afcd5b9
Compare
Upstream branch: 358b1c0 |
eafe4d9
to
7dbe949
Compare
afcd5b9
to
46d16c8
Compare
Upstream branch: 358b1c0 |
7dbe949
to
910530d
Compare
644a67b
to
f410247
Compare
Upstream branch: 7b05f43 |
ebc50cd
to
fbc25f1
Compare
f410247
to
db1c311
Compare
Upstream branch: 86870d0 |
fbc25f1
to
614fac7
Compare
db1c311
to
874975c
Compare
Upstream branch: f263336 |
614fac7
to
78f4dc9
Compare
Upstream branch: f263336 |
78f4dc9
to
0ba59ab
Compare
874975c
to
1fb30b9
Compare
Upstream branch: f263336 |
0ba59ab
to
3ba24ef
Compare
1fb30b9
to
fd54531
Compare
Upstream branch: 41948af |
3ba24ef
to
7f33cf0
Compare
fd54531
to
d7d35f9
Compare
Upstream branch: 62e23f1 |
7f33cf0
to
6ab7d5f
Compare
d7d35f9
to
57835b9
Compare
Upstream branch: 9fd0606 |
6ab7d5f
to
45209f5
Compare
57835b9
to
58abb70
Compare
When we specify apply_bytes, we divide the msg into multiple segments, each with a length of 'send', and every time we send this part of the data using tcp_bpf_sendmsg_redir(), we use sk_msg_return_zero() to uncharge the memory of the specified 'send' size. However, if the first segment of data fails to send, for example, the peer's buffer is full, we need to release all of the msg. When releasing the msg, we haven't uncharged the memory of the subsequent segments. This modification does not make significant logical 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 3448ad2 ("selftests/bpf: Add apply_bytes test to test_txmsg_redir_wait_sndmem in test_sockmap") Reported-by: Cong Wang <[email protected]> Closes: https://lore.kernel.org/bpf/[email protected]/T/#t Fixes: d3b18ad ("tls: add bpf support to sk_msg handling") Signed-off-by: Jiayuan Chen <[email protected]> Reviewed-by: Cong Wang <[email protected]>
The selftest can reproduce an issue where we miss the uncharge operation when freeing msg, which will cause the following warning. We fixed the issue and added this reproducer to selftest to ensure it will not happen again. ------------[ cut here ]------------ WARNING: CPU: 1 PID: 40 at net/ipv4/af_inet.c inet_sock_destruct+0x173/0x1d5 Tainted: [W]=WARN Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.15.0-1 04/01/2014 Workqueue: events sk_psock_destroy RIP: 0010:inet_sock_destruct+0x173/0x1d5 RSP: 0018:ffff8880085cfc18 EFLAGS: 00010202 RAX: 1ffff11003dbfc00 RBX: ffff88801edfe3e8 RCX: ffffffff822f5af4 RDX: 0000000000000007 RSI: dffffc0000000000 RDI: ffff88801edfe16c RBP: ffff88801edfe184 R08: ffffed1003dbfc31 R09: 0000000000000000 R10: ffffffff822f5ab7 R11: ffff88801edfe187 R12: ffff88801edfdec0 R13: ffff888020376ac0 R14: ffff888020376ac0 R15: ffff888020376a60 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000556365155830 CR3: 000000001d6aa000 CR4: 0000000000350ef0 Call Trace: <TASK> __sk_destruct+0x46/0x222 sk_psock_destroy+0x22f/0x242 process_one_work+0x504/0x8a8 ? process_one_work+0x39d/0x8a8 ? __pfx_process_one_work+0x10/0x10 ? worker_thread+0x44/0x2ae ? __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 <[email protected]>
Upstream branch: 43745d1 |
45209f5
to
6786242
Compare
Pull request for series with
subject: ktls, sockmap: Fix missing uncharge operation and add selfttest
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=956848