lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6de6f1bf-c8ee-4dfb-9b8c-f89185946630@linux.dev>
Date: Mon, 2 Feb 2026 19:53:20 -0800
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: Michal Luczaj <mhal@...x.co>, Kuniyuki Iwashima <kuniyu@...gle.com>
Cc: John Fastabend <john.fastabend@...il.com>,
 Jakub Sitnicki <jakub@...udflare.com>, "David S. Miller"
 <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
 Simon Horman <horms@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
 netdev@...r.kernel.org, bpf@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH bpf] bpf, sockmap: Fix af_unix null-ptr-deref in proto
 update

On 2/2/26 7:10 AM, Michal Luczaj wrote:
>>> Other than update_elem, do other lock_sock() usages in sock_map have a
>>> similar issue for af_unix?
> As for the sockmap, I think that would be it.

Thanks for checking.

> 
> In related news, looks like bpf_iter_unix_seq_show() is missing
> unix_state_lock(): lock_sock_fast() won't stop unix_release_sock(). E.g.
> bpf iterator can grab unix_sock::peer as it is being released.

If the concern is the bpf iterator prog may use a released unix_peer(sk) 
pointer, it should be fine. The unix_peer(sk) pointer is not a trusted 
pointer to the bpf prog, so nothing bad will happen other than 
potentially reading incorrect values.

However, yeah, the bpf_iter_(tcp|udp)_seq_show is better in the sense 
that the correct lock is used.

For tcp_sock that has many stats, I think it will be particularly useful 
to read them in a consistent state. I don't have a strong opinion on 
af_unix.

Unlike the sock_map where the lock_sock is not useful for af_unix. The 
bpf iterator can do bpf_setsockopt, so a lock_sock_fast() is still 
needed in bpf_iter_unix_seq_show and I think it is the reason 
lock_sock_fast() is used here.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ