Skip to contentSkip to conversation

af_unix: Remove gc_in_progress check in unix_peek_fpl().

PATCH Applied Kuniyuki Iwashima 2 participants 2 messages Nov 4 – Nov 10

Subsystems (3)
lore
Share & tools
lore

Kuniyuki Iwashima

author maintainer
#0 lore raw

PATCH 1/1 af_unix: Remove gc_in_progress check in unix_peek_fpl().

unix_vertex_dead() and unix_peek_fpl() are synchronised with unix_peek_seq to prevent GC from purging a live socket's recvq.

unix_peek_fpl() skips the synchronisation if gc_in_progress is false.

However, on weakly ordered arch, GC might have already started working while the write to gc_in_progress is buffered.

This does not occur on x86.

This is an unlikely path that happens only when AF_UNIX fd is peeked so not worth complicating.

Instead of adding memory barriers in unix_gc() and unix_peek_fpl(), let's simply remove the broken short-circuit.

Fixes e5b31d988a41 ("af_unix: Give up GC if MSG_PEEK intervened.")

---
The reporter reproduced it on arm64 QEMU.

---
 net/unix/garbage.c | 3 ---
 1 file changed, 3 deletions(-)
net/unix/garbage.c +0 -3
index a0b515354e8b..fbeabfb0db34 100644
@@ -329,9 +329,6 @@ void unix_peek_fpl(struct scm_fp_list *fpl)
 	if (!fpl || !fpl->count_unix)
 		return;
 
-	if (!READ_ONCE(gc_in_progress))
-		return;
-
 	/* Invalidate the final refcnt check in unix_vertex_dead(). */
 	spin_lock(&unix_peek_lock);
 	raw_write_seqcount_barrier(&unix_peek_seq);
Signature · 1 line
2.56.0.385.gac671c819a-goog
#1 lore raw
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Wed, 4 Nov 2026 16:27:56 +0000 you wrote:

unix_vertex_dead() and unix_peek_fpl() are synchronised with unix_peek_seq to prevent GC from purging a live socket's recvq.

unix_peek_fpl() skips the synchronisation if gc_in_progress is false.

[...]

Here is the summary with links:
- [v1,net] af_unix: Remove gc_in_progress check in unix_peek_fpl().

    https://git.kernel.org/netdev/net/c/0edbc945eb9e

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html