netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf] sock_map: add a cond_resched() in sock_hash_free()
@ 2024-09-06 15:44 Eric Dumazet
  2024-09-06 21:26 ` Martin KaFai Lau
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Dumazet @ 2024-09-06 15:44 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni, Daniel Borkmann,
	Alexei Starovoitov, Martin KaFai Lau
  Cc: Andrii Nakryiko, netdev, bpf, eric.dumazet, Eric Dumazet, syzbot,
	John Fastabend, Jakub Sitnicki

Several syzbot soft lockup reports all have in common sock_hash_free()

If a map with a large number of buckets is destroyed, we need to yield
the cpu when needed.

Fixes: 75e68e5bf2c7 ("bpf, sockhash: Synchronize delete from bucket list on map free")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: Jakub Sitnicki <jakub@cloudflare.com>
---
 net/core/sock_map.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/core/sock_map.c b/net/core/sock_map.c
index d3dbb92153f2fe7f1ddc8e35b495533fbf60a8cb..724b6856fcc3e9fd51673d31927cfd52d5d7d0aa 100644
--- a/net/core/sock_map.c
+++ b/net/core/sock_map.c
@@ -1183,6 +1183,7 @@ static void sock_hash_free(struct bpf_map *map)
 			sock_put(elem->sk);
 			sock_hash_free_elem(htab, elem);
 		}
+		cond_resched();
 	}
 
 	/* wait for psock readers accessing its map link */
-- 
2.46.0.469.g59c65b2a67-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-09-11 20:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-06 15:44 [PATCH bpf] sock_map: add a cond_resched() in sock_hash_free() Eric Dumazet
2024-09-06 21:26 ` Martin KaFai Lau
2024-09-06 21:32 ` John Fastabend
2024-09-11 20:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).