public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: David Rheinsberg <david@readahead.eu>
Cc: Oleg Nesterov <oleg@redhat.com>,
	Kuniyuki Iwashima <kuniyu@amazon.com>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	 linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	netdev@vger.kernel.org,  Jan Kara <jack@suse.cz>,
	Alexander Mikhalitsyn <alexander@mihalicyn.com>,
	 Luca Boccassi <bluca@debian.org>,
	Lennart Poettering <lennart@poettering.net>,
	 Daan De Meyer <daan.j.demeyer@gmail.com>,
	Mike Yuan <me@yhndnzj.com>
Subject: Re: [PATCH RFC 2/4] net, pidfs: prepare for handing out pidfds for reaped sk->sk_peer_pid
Date: Thu, 24 Apr 2025 17:19:28 +0200	[thread overview]
Message-ID: <20250424-chipsatz-verpennen-afa9e213e332@brauner> (raw)
In-Reply-To: <c4a2468b-f6b1-4549-8189-ec2f72bef45e@app.fastmail.com>

On Thu, Apr 24, 2025 at 02:44:13PM +0200, David Rheinsberg wrote:
> Hi
> 
> On Thu, Apr 24, 2025, at 2:24 PM, Christian Brauner wrote:
> [...]
> > Link: 
> > https://lore.kernel.org/lkml/20230807085203.819772-1-david@readahead.eu 
> > [1]
> > Signed-off-by: Christian Brauner <brauner@kernel.org>
> 
> Very nice! Highly appreciated!
> 
> > ---
> >  net/unix/af_unix.c | 90 
> > +++++++++++++++++++++++++++++++++++++++++++++++-------
> >  1 file changed, 79 insertions(+), 11 deletions(-)
> >
> > diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> > index f78a2492826f..83b5aebf499e 100644
> > --- a/net/unix/af_unix.c
> > +++ b/net/unix/af_unix.c
> > @@ -100,6 +100,7 @@
> >  #include <linux/splice.h>
> >  #include <linux/string.h>
> >  #include <linux/uaccess.h>
> > +#include <linux/pidfs.h>
> >  #include <net/af_unix.h>
> >  #include <net/net_namespace.h>
> >  #include <net/scm.h>
> > @@ -643,6 +644,14 @@ static void unix_sock_destructor(struct sock *sk)
> >  		return;
> >  	}
> > 
> > +	if (sock_flag(sk, SOCK_RCU_FREE)) {
> > +		pr_info("Attempting to release RCU protected socket with sleeping 
> > locks: %p\n", sk);
> > +		return;
> > +	}
> 
> unix-sockets do not use `SOCK_RCU_FREE`, but even if they did, doesn't
> this flag imply that the destructor is delayed via `call_rcu`, and
> thus *IS* allowed to sleep? And then, sleeping in the destructor is
> always safe, isn't it? `SOCK_RCU_FREE` just guarantees that it is
> delayed for at least an RCU grace period, right? Not sure, what you
> are getting at here, but I might be missing something obvious as well.

Callbacks run from call_rcu() can be called from softirq context and in
general are not allowed to block. That's what queue_rcu_work() is for
which uses system_unbound_wq.

> 
> Regardless, wouldn't you want WARN_ON_ONCE() rather than pr_info?

Sure.

  reply	other threads:[~2025-04-24 15:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-24 12:24 [PATCH RFC 0/4] net, pidfs: enable handing out pidfds for reaped sk->sk_peer_pid Christian Brauner
2025-04-24 12:24 ` [PATCH RFC 1/4] pidfs: register pid in pidfs Christian Brauner
2025-04-24 13:24   ` Oleg Nesterov
2025-04-24 15:19     ` Christian Brauner
2025-04-24 12:24 ` [PATCH RFC 2/4] net, pidfs: prepare for handing out pidfds for reaped sk->sk_peer_pid Christian Brauner
2025-04-24 12:44   ` David Rheinsberg
2025-04-24 15:19     ` Christian Brauner [this message]
2025-04-25  1:08       ` Kuniyuki Iwashima
2025-04-25  8:02         ` Christian Brauner
2025-04-25  1:57   ` Kuniyuki Iwashima
2025-04-25  7:58     ` Christian Brauner
2025-04-24 12:24 ` [PATCH RFC 3/4] pidfs: get rid of __pidfd_prepare() Christian Brauner
2025-04-24 12:24 ` [PATCH RFC 4/4] net, pidfs: enable handing out pidfds for reaped sk->sk_peer_pid Christian Brauner

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=20250424-chipsatz-verpennen-afa9e213e332@brauner \
    --to=brauner@kernel.org \
    --cc=alexander@mihalicyn.com \
    --cc=bluca@debian.org \
    --cc=daan.j.demeyer@gmail.com \
    --cc=davem@davemloft.net \
    --cc=david@readahead.eu \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jack@suse.cz \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=lennart@poettering.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=me@yhndnzj.com \
    --cc=netdev@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=pabeni@redhat.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