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] [day] [month] [year] [list]
Message-ID: <20250111034347.28116-1-kuniyu@amazon.com>
Date: Sat, 11 Jan 2025 12:43:47 +0900
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <jdamato@...tly.com>
CC: <davem@...emloft.net>, <donald.hunter@...hat.com>, <edumazet@...gle.com>,
	<horms@...nel.org>, <kuba@...nel.org>, <kuni1840@...il.com>,
	<kuniyu@...zon.com>, <netdev@...r.kernel.org>, <pabeni@...hat.com>
Subject: Re: [PATCH v1 net-next 06/12] af_unix: Reuse out_pipe label in unix_stream_sendmsg().

From: Joe Damato <jdamato@...tly.com>
Date: Fri, 10 Jan 2025 13:58:39 -0800
> On Sat, Jan 11, 2025 at 12:22:31AM +0900, Kuniyuki Iwashima wrote:
> > From: Simon Horman <horms@...nel.org>
> > Date: Fri, 10 Jan 2025 11:43:44 +0000
> > > On Fri, Jan 10, 2025 at 06:26:35PM +0900, Kuniyuki Iwashima wrote:
> > > > This is a follow-up of commit d460b04bc452 ("af_unix: Clean up
> > > > error paths in unix_stream_sendmsg().").
> > > > 
> > > > If we initialise skb with NULL in unix_stream_sendmsg(), we can
> > > > reuse the existing out_pipe label for the SEND_SHUTDOWN check.
> > > > 
> > > > Let's rename do it and adjust the existing label as out_pipe_lock.
> > > > 
> > > > While at it, size and data_len are moved to the while loop scope.
> > > > 
> > > > Suggested-by: Paolo Abeni <pabeni@...hat.com>
> > > > Signed-off-by: Kuniyuki Iwashima <kuniyu@...zon.com>
> > > > ---
> > > >  net/unix/af_unix.c | 23 +++++++++--------------
> > > >  1 file changed, 9 insertions(+), 14 deletions(-)
> > > > 
> > > > diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> > > > index b190ea8b8e9d..6505eeab9957 100644
> > > > --- a/net/unix/af_unix.c
> > > > +++ b/net/unix/af_unix.c
> > > 
> > > ...
> > > 
> > > > @@ -2285,16 +2283,12 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg,
> > > >  		}
> > > >  	}
> > > >  
> > > > -	if (READ_ONCE(sk->sk_shutdown) & SEND_SHUTDOWN) {
> > > > -		if (!(msg->msg_flags & MSG_NOSIGNAL))
> > > > -			send_sig(SIGPIPE, current, 0);
> > > > -
> > > > -		err = -EPIPE;
> > > > -		goto out_err;
> > > > -	}
> > > > +	if (READ_ONCE(sk->sk_shutdown) & SEND_SHUTDOWN)
> > > 
> > > Hi Iwashima-san,
> > > 
> > > I think you need to set reason here.
> > > 
> > > Flagged by W=1 builds with clang-19.
> > 
> > Hi Simon,
> > 
> > I didn't set it here because skb == NULL and kfree_skb()
> > doesn't touch reason, and KMSAN won't complain about uninit.
> > 
> > Should I use SKB_NOT_DROPPED_YET or drop patch 6 or leave
> > it as is ?
> > 
> > What do you think ?
> 
> My vote is that SKB_NOT_DROPPED_YET is not appropriate here.

Thanks, I felt the same.

> 
> Maybe SKB_DROP_REASON_SOCKET_CLOSE since it is in SEND_SHUTDOWN
> state?

This will look confusing too, so I'll drop this patch.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ