netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2 0/3] vsock/bpf: Handle races between sockmap update and connect() disconnecting
@ 2025-03-14 15:19 Michal Luczaj
  2025-03-14 15:19 ` [PATCH net v2 1/3] vsock/bpf: Fix EINTR connect() racing sockmap update Michal Luczaj
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michal Luczaj @ 2025-03-14 15:19 UTC (permalink / raw)
  To: Stefano Garzarella, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman, Michael S. Tsirkin, Bobby Eshleman,
	Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
	Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
	Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
	Hao Luo, Jiri Olsa, Shuah Khan
  Cc: netdev, bpf, virtualization, linux-kernel, linux-kselftest,
	Michal Luczaj

Signal delivery during connect() may disconnect an already established
socket. Problem is that such socket might have been placed in a sockmap
before the connection was closed.

PATCH 1 ensures this race won't lead to an unconnected vsock staying in the
sockmap. PATCH 2 selftests it.

PATCH 3 fixes a related race. Note that here the race window is rather
difficult to hit and I can't think of an easy way of testing it.

Signed-off-by: Michal Luczaj <mhal@rbox.co>
---
Changes in v2:
- Handle one more path of tripping the warning
- Add a selftest
- Collect R-b [Stefano]
- Link to v1: https://lore.kernel.org/r/20250307-vsock-trans-signal-race-v1-1-3aca3f771fbd@rbox.co

---
Michal Luczaj (3):
      vsock/bpf: Fix EINTR connect() racing sockmap update
      selftest/bpf: Add test for AF_VSOCK connect() racing sockmap update
      vsock/bpf: Fix bpf recvmsg() racing transport reassignment

 net/vmw_vsock/af_vsock.c                           |  10 +-
 net/vmw_vsock/vsock_bpf.c                          |  24 +++--
 .../selftests/bpf/prog_tests/sockmap_basic.c       | 111 +++++++++++++++++++++
 3 files changed, 136 insertions(+), 9 deletions(-)
---
base-commit: da9e8efe7ee10e8425dc356a9fc593502c8e3933
change-id: 20250305-vsock-trans-signal-race-d62f7718d099

Best regards,
-- 
Michal Luczaj <mhal@rbox.co>


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

end of thread, other threads:[~2025-03-14 15:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-14 15:19 [PATCH net v2 0/3] vsock/bpf: Handle races between sockmap update and connect() disconnecting Michal Luczaj
2025-03-14 15:19 ` [PATCH net v2 1/3] vsock/bpf: Fix EINTR connect() racing sockmap update Michal Luczaj
2025-03-14 15:19 ` [PATCH net v2 2/3] selftest/bpf: Add test for AF_VSOCK " Michal Luczaj
2025-03-14 15:19 ` [PATCH net v2 3/3] vsock/bpf: Fix bpf recvmsg() racing transport reassignment Michal Luczaj

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).