mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@google.com>
To: Wenbo Sun <sunwenbo@cmss.chinamobile.com>
Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	 pabeni@redhat.com, horms@kernel.org, willemb@google.com,
	 netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	1342116488@qq.com
Subject: Re: [PATCH net] af_unix: Inherit SO_INQ in unix_stream_connect()
Date: Thu, 12 Nov 2026 06:19:37 +0000	[thread overview]
Message-ID: <avVaUr1ZOMeEEXsf@google.com> (raw)
In-Reply-To: <20261111023222.77227-1-sunwenbo@cmss.chinamobile.com>

On Wed, 11 Nov 2026 10:32:22 +0800, Wenbo Sun wrote:
> When SO_INQ is enabled on a listening AF_UNIX SOCK_STREAM socket,
> accepted sockets created by unix_stream_connect() do not inherit
> u->recvmsg_inq from the listener, unlike TCP_INQ, AF_VSOCK SO_INQ,
> and AF_UNIX SO_RIGHTS_NOTRUNC. As a result, recvmsg() on the
> accepted socket never puts an SCM_INQ control message unless SO_INQ
> is set again after accept().
> 
> Copy otheru->recvmsg_inq to newu->recvmsg_inq in
> unix_stream_connect() using READ_ONCE() to pair with the lockless
> WRITE_ONCE() in unix_setsockopt().
> 
> Found during LLM-assisted code review of unix_stream_connect() while
> comparing option inheritance between SO_INQ and SO_RIGHTS_NOTRUNC.
> 
> Confirmed on UML (x86_64) by enabling SO_INQ on a listening AF_UNIX
> SOCK_STREAM socket before listen() and accept(), sending data from a
> connected client, and observing that recvmsg() on the accepted socket
> returned no SCM_INQ control message.
> 
> Tested on UML (x86_64) against the reproducer, verifying that
> recvmsg() on the accepted socket now returns the expected SCM_INQ
> control message, and ran the tools/testing/selftests/net/af_unix/scm_inq
> selftest (all 6 test cases passed).
> 
> Fixes: df30285b3670 ("af_unix: Introduce SO_INQ.")
> Signed-off-by: Wenbo Sun <sunwenbo@cmss.chinamobile.com>

Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>

Thanks

      reply	other threads:[~2026-11-12  6:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11  2:32 Wenbo Sun
2026-11-12  6:19 ` Kuniyuki Iwashima [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=avVaUr1ZOMeEEXsf@google.com \
    --to=kuniyu@google.com \
    --cc=1342116488@qq.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sunwenbo@cmss.chinamobile.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®