bpf, sockmap: fix forward allocation accounting in strparser self-pass path - #8576
bpf, sockmap: fix forward allocation accounting in strparser self-pass path#8576kernel-patches-daemon-bpf-rc[bot] wants to merge 2 commits into
Conversation
|
Upstream branch: 80f3c3e |
ec7c37b to
0391cfe
Compare
|
Upstream branch: a766247 |
4b39dfc to
78cf3aa
Compare
0391cfe to
0be2140
Compare
|
Upstream branch: fdeba03 |
78cf3aa to
437db0d
Compare
0be2140 to
c953291
Compare
|
Upstream branch: e5fd3f5 |
437db0d to
889adb2
Compare
c953291 to
47219af
Compare
|
Upstream branch: 7cd8645 |
889adb2 to
bbe0794
Compare
|
Upstream branch: 31a420a |
bbe0794 to
8f8bdf7
Compare
6d62329 to
ab5db42
Compare
|
Upstream branch: 31a420a |
8f8bdf7 to
b51cff4
Compare
ab5db42 to
bef3f93
Compare
|
Upstream branch: 7a3c028 |
b51cff4 to
ed96fb4
Compare
bef3f93 to
0e8ddea
Compare
The strparser SK_PASS path can queue cloned skbs back to the same socket. A single TCP receive skb may be split into multiple strparser messages, and each cloned message still carries the receive owner from the TCP receive path. sk_psock_skb_ingress_self() reassigns receive ownership with skb_set_owner_r(). That first orphans the skb, which runs the existing receive destructor, and then charges the skb to the socket again. When this is repeated for strparser clones, sk_forward_alloc can already be in deficit before the next owner transition. Releasing the queued skbs can then uncharge more memcg pages than were reserved and trigger a page_counter underflow. Call sk_rmem_schedule() with a size of zero before skb_set_owner_r() for strparser self-pass skbs. Use the zero-sized reservation to top up any existing sk_forward_alloc deficit without reserving the skb's full truesize again, then let skb_set_owner_r() perform the receive-owner transition. Apply the same handling when retrying the skb from the psock backlog. Fixes: 144748e ("bpf, sockmap: Fix incorrect fwd_alloc accounting") Reported-by: Sechang Lim <rhkrqnwk98@gmail.com> Suggested-by: Emil Tsalapatis <emil@etsalapatis.com> Signed-off-by: Junseo Lim <zirajs7@gmail.com>
Add a sockmap_strp regression test for strparser SK_PASS delivery to the same socket. A one-byte stream parser splits a single write into many messages, repeatedly exercising receive ownership transitions while the skbs remain queued. Verify through INET_DIAG_MEMINFO that sk_forward_alloc does not become negative after the self-pass path is exercised. Signed-off-by: Junseo Lim <zirajs7@gmail.com>
|
Upstream branch: a13307e |
ed96fb4 to
90b65b2
Compare
Pull request for series with
subject: bpf, sockmap: fix forward allocation accounting in strparser self-pass path
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1138595