public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 bpf 0/2] bpf: tcp: Fix type confusion in bpf_tcp_sock().
@ 2026-04-30 18:43 Kuniyuki Iwashima
  2026-04-30 18:43 ` [PATCH v1 bpf 1/2] " Kuniyuki Iwashima
  2026-04-30 18:43 ` [PATCH v1 bpf 2/2] selftest: bpf: Add test for bpf_tcp_sock() and RAW socket Kuniyuki Iwashima
  0 siblings, 2 replies; 6+ messages in thread
From: Kuniyuki Iwashima @ 2026-04-30 18:43 UTC (permalink / raw)
  To: Martin KaFai Lau, Daniel Borkmann, Alexei Starovoitov,
	Andrii Nakryiko, Eduard Zingerman, Kumar Kartikeya Dwivedi
  Cc: John Fastabend, Stanislav Fomichev, Song Liu, Yonghong Song,
	Jiri Olsa, Eric Dumazet, Kuniyuki Iwashima, Kuniyuki Iwashima,
	bpf, netdev

bpf_tcp_sock() only check if sk->sk_protocol is IPPROTO_TCP,
but RAW socket can bypass it:

  socket(AF_INET, SOCK_RAW, IPPROTO_TCP)

Patch 1 fixes it and Patch 2 adds a test.


Kuniyuki Iwashima (2):
  bpf: tcp: Fix type confusion in bpf_tcp_sock().
  selftest: bpf: Add test for bpf_tcp_sock() and RAW socket.

 net/core/filter.c                               |  2 +-
 .../selftests/bpf/prog_tests/sockopt_sk.c       | 17 ++++++++++++++++-
 tools/testing/selftests/bpf/progs/sockopt_sk.c  | 16 ++++++++++++++++
 3 files changed, 33 insertions(+), 2 deletions(-)

-- 
2.54.0.545.g6539524ca2-goog


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

end of thread, other threads:[~2026-04-30 21:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-30 18:43 [PATCH v1 bpf 0/2] bpf: tcp: Fix type confusion in bpf_tcp_sock() Kuniyuki Iwashima
2026-04-30 18:43 ` [PATCH v1 bpf 1/2] " Kuniyuki Iwashima
2026-04-30 21:00   ` Daniel Borkmann
2026-04-30 18:43 ` [PATCH v1 bpf 2/2] selftest: bpf: Add test for bpf_tcp_sock() and RAW socket Kuniyuki Iwashima
2026-04-30 20:32   ` Kuniyuki Iwashima
2026-04-30 21:14     ` Kuniyuki Iwashima

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox