[lvc-project] [PATCH RFC net] net: sockmap: avoid race between sock_map_destroy() and sk_psock_put()

Dmitry Antipov dmantipov at yandex.ru
Mon Sep 9 10:04:21 MSK 2024


On 9/8/24 9:36 PM, Cong Wang wrote:

> Are you sure it is due to sockmap code?

No, and that's why my patch has RFC tag in subject :-).

> I see rds_tcp_accept_one() in the stack trace. This is why I highly
> suspect that it is due to RDS code instead of sockmap code.
> 
> I have the following patch ready for testing, in case you are
> interested.

Does it work for you? Running current upstream with this patch applied,
I'm still seeing the same warning at net/core/sock_map.c:1663.

Again, I'm suspecting the race just because 'sk_psock_drop()' issues
'sk_psock_restore_proto()' with 'sk->sk_callback_lock' write locked,
but 'sock_map_destroy()' just uses 'READ_ONCE()' to obtain a callback
which may be changed underneath.

BTW looking here and there again, I suppose that my patch is not correct
too because it moves and/or shrinks the race window but doesn't eliminate
it completely.

Dmitry




More information about the lvc-project mailing list