public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 bpf 0/2] bpf: Reject access to unix_sk(sk)->{peer,listener}.
@ 2026-02-07 23:07 Kuniyuki Iwashima
  2026-02-07 23:07 ` [PATCH v1 bpf 1/2] bpf: Reject access to unix_sk(sk)->peer Kuniyuki Iwashima
  2026-02-07 23:07 ` [PATCH v1 bpf 2/2] bpf: Reject access to unix_sk(sk)->listener Kuniyuki Iwashima
  0 siblings, 2 replies; 11+ messages in thread
From: Kuniyuki Iwashima @ 2026-02-07 23:07 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau
  Cc: John Fastabend, Eduard Zingerman, Song Liu, Yonghong Song,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, Michal Luczaj,
	Kuniyuki Iwashima, Kuniyuki Iwashima, bpf, netdev

Accessing unix_sk(sk)->{peer,listener} is only safe under
unix_state_lock().

There are many functions where bpf prog can access the fields
locklessly via fentry/fexit or bpf iter.

unix_sk(sk)->{peer,listener} could go away during such lockless
access by bpf.

This seires marks the fields with PTR_UNTRUSTED to prevent
such use-after-free.


Kuniyuki Iwashima (2):
  bpf: Reject access to unix_sk(sk)->peer.
  bpf: Reject access to unix_sk(sk)->listener.

 kernel/bpf/verifier.c                         | 19 +++++++
 .../selftests/bpf/progs/verifier_sock.c       | 49 +++++++++++++++++++
 2 files changed, 68 insertions(+)

-- 
2.53.0.rc2.204.g2597b5adb4-goog


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

end of thread, other threads:[~2026-02-11 23:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-07 23:07 [PATCH v1 bpf 0/2] bpf: Reject access to unix_sk(sk)->{peer,listener} Kuniyuki Iwashima
2026-02-07 23:07 ` [PATCH v1 bpf 1/2] bpf: Reject access to unix_sk(sk)->peer Kuniyuki Iwashima
2026-02-09 23:00   ` Alexei Starovoitov
2026-02-10  1:19     ` Kuniyuki Iwashima
2026-02-11  2:47       ` Alexei Starovoitov
2026-02-11  4:23         ` Kuniyuki Iwashima
2026-02-11 21:25           ` Alexei Starovoitov
2026-02-11 22:22             ` Kuniyuki Iwashima
2026-02-11 22:39               ` Alexei Starovoitov
2026-02-11 23:01                 ` Kuniyuki Iwashima
2026-02-07 23:07 ` [PATCH v1 bpf 2/2] bpf: Reject access to unix_sk(sk)->listener Kuniyuki Iwashima

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