Skip to contentSkip to conversation

Please backport d8616ee2affc ("bpf, sockmap: Fix sk->sk_forward_alloc warn_on in sk_stream_kill_queues") to linux-5.10.y

DISCUSSION Wen Gu 2 participants 5 messages Jun 30, 2024 – Jul 2, 2024 Stable branch

lore
Share & tools
lore

Wen Gu

author
#0 lore raw

Hi stable team,

Could you please backport [1] to linux-5.10.y?

I noticed a regression caused by [2], which was merged to linux-5.10.y since v5.10.80.

After sock_map_unhash() helper was removed in [2], sock elems added to the bpf sock map via sock_hash_update_common() cannot be removed if they are in the icsk_accept_queue of the listener sock. Since they have not been accept()ed, they cannot be removed via sock_map_close()->sock_map_remove_links() either.

It can be reproduced in network test with short-lived connections. If the server is stopped during the test, there is a probability that some sock elems will remain in the bpf sock map.

And with [1], the sock_map_destroy() helper is introduced to invoke sock_map_remove_links() when inet_csk_listen_stop()->inet_child_forget()->inet_csk_destroy_sock(), to remove the sock elems from the bpf sock map in such situation.

[1] d8616ee2affc ("bpf, sockmap: Fix sk->sk_forward_alloc warn_on in sk_stream_kill_queues") (link: https://lore.kernel.org/all/[email protected]/)
[2] 8b5c98a67c1b ("bpf, sockmap: Remove unhash handler for BPF sockmap usage") (link: https://lore.kernel.org/all/[email protected]/)

Thanks!
Wen Gu

author
#1 lore raw
Quoted 19 lines · Wen Gu

Hi stable team,

Could you please backport [1] to linux-5.10.y?

I noticed a regression caused by [2], which was merged to linux-5.10.y since v5.10.80.

After sock_map_unhash() helper was removed in [2], sock elems added to the bpf sock map via sock_hash_update_common() cannot be removed if they are in the icsk_accept_queue of the listener sock. Since they have not been accept()ed, they cannot be removed via sock_map_close()->sock_map_remove_links() either.

It can be reproduced in network test with short-lived connections. If the server is stopped during the test, there is a probability that some sock elems will remain in the bpf sock map.

And with [1], the sock_map_destroy() helper is introduced to invoke sock_map_remove_links() when inet_csk_listen_stop()->inet_child_forget()->inet_csk_destroy_sock(), to remove the sock elems from the bpf sock map in such situation.

Quoted 7 lines

[1] d8616ee2affc ("bpf, sockmap: Fix sk->sk_forward_alloc warn_on in sk_stream_kill_queues") (link: https://lore.kernel.org/all/[email protected]/)
[2] 8b5c98a67c1b ("bpf, sockmap: Remove unhash handler for BPF sockmap usage") (link: https://lore.kernel.org/all/[email protected]/)

Thanks!
Wen Gu

Hi stable team,

Just want to confirm that the backport of this patch is consistent with the stable tree rules as I thought. And is there any other information I need to provide? :)

Thanks for your efforts and time.

Regards.

maintainer
#2 lore raw
Quoted 27 lines · Wen Gu
Quoted 24 lines · Wen Gu

Hi stable team,

Could you please backport [1] to linux-5.10.y?

I noticed a regression caused by [2], which was merged to linux-5.10.y since v5.10.80.

After sock_map_unhash() helper was removed in [2], sock elems added to the bpf sock map via sock_hash_update_common() cannot be removed if they are in the icsk_accept_queue of the listener sock. Since they have not been accept()ed, they cannot be removed via sock_map_close()->sock_map_remove_links() either.

It can be reproduced in network test with short-lived connections. If the server is stopped during the test, there is a probability that some sock elems will remain in the bpf sock map.

And with [1], the sock_map_destroy() helper is introduced to invoke sock_map_remove_links() when inet_csk_listen_stop()->inet_child_forget()->inet_csk_destroy_sock(), to remove the sock elems from the bpf sock map in such situation.

[1] d8616ee2affc ("bpf, sockmap: Fix sk->sk_forward_alloc warn_on in sk_stream_kill_queues") (link: https://lore.kernel.org/all/[email protected]/)
[2] 8b5c98a67c1b ("bpf, sockmap: Remove unhash handler for BPF sockmap usage") (link: https://lore.kernel.org/all/[email protected]/)

Quoted 7 lines
Quoted 2 lines

Thanks!
Wen Gu

Hi stable team,

Just want to confirm that the backport of this patch is consistent with the stable tree rules as I thought. And is there any other information I need to provide? :)

Please relax, you sent this on Sunday and asked about it on Tuesday, barely 1 day later?

greg k-h

author
#3 lore raw
Quoted 31 lines · Greg KH
Quoted 30 lines · Wen Gu
Quoted 26 lines · Wen Gu

Hi stable team,

Could you please backport [1] to linux-5.10.y?

I noticed a regression caused by [2], which was merged to linux-5.10.y since v5.10.80.

After sock_map_unhash() helper was removed in [2], sock elems added to the bpf sock map via sock_hash_update_common() cannot be removed if they are in the icsk_accept_queue of the listener sock. Since they have not been accept()ed, they cannot be removed via sock_map_close()->sock_map_remove_links() either.

It can be reproduced in network test with short-lived connections. If the server is stopped during the test, there is a probability that some sock elems will remain in the bpf sock map.

And with [1], the sock_map_destroy() helper is introduced to invoke sock_map_remove_links() when inet_csk_listen_stop()->inet_child_forget()->inet_csk_destroy_sock(), to remove the sock elems from the bpf sock map in such situation.

[1] d8616ee2affc ("bpf, sockmap: Fix sk->sk_forward_alloc warn_on in sk_stream_kill_queues") (link: https://lore.kernel.org/all/[email protected]/)
[2] 8b5c98a67c1b ("bpf, sockmap: Remove unhash handler for BPF sockmap usage") (link: https://lore.kernel.org/all/[email protected]/)

Thanks!
Wen Gu

Quoted 8 lines
Quoted 4 lines

Hi stable team,

Just want to confirm that the backport of this patch is consistent with the stable tree rules as I thought. And is there any other information I need to provide? :)

Please relax, you sent this on Sunday and asked about it on Tuesday, barely 1 day later?

Sure, there's no intention to rush, just confirming this backport requirement is reasonable. Sorry for the noise.

Thanks.

maintainer
#4 lore raw
In reply to Wen Gu
Quoted 15 lines · Wen Gu

Hi stable team,

Could you please backport [1] to linux-5.10.y?

I noticed a regression caused by [2], which was merged to linux-5.10.y since v5.10.80.

After sock_map_unhash() helper was removed in [2], sock elems added to the bpf sock map via sock_hash_update_common() cannot be removed if they are in the icsk_accept_queue of the listener sock. Since they have not been accept()ed, they cannot be removed via sock_map_close()->sock_map_remove_links() either.

It can be reproduced in network test with short-lived connections. If the server is stopped during the test, there is a probability that some sock elems will remain in the bpf sock map.

Quoted 8 lines

And with [1], the sock_map_destroy() helper is introduced to invoke sock_map_remove_links() when inet_csk_listen_stop()->inet_child_forget()->inet_csk_destroy_sock(), to remove the sock elems from the bpf sock map in such situation.

[1] d8616ee2affc ("bpf, sockmap: Fix sk->sk_forward_alloc warn_on in sk_stream_kill_queues") (link: https://lore.kernel.org/all/[email protected]/)
[2] 8b5c98a67c1b ("bpf, sockmap: Remove unhash handler for BPF sockmap usage") (link: https://lore.kernel.org/all/[email protected]/)

As there is fuzz with this patch, please send a backported, and tested, version of this patch so we can include it and properly show who it was requested from.

thanks,

greg k-h