From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE75D17FAC2; Thu, 24 Apr 2025 15:19:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745507975; cv=none; b=TrcdkYQJgaAIcy7gCxoAm25Pto/pm45L10jdk2ImCnrXjAtH2oQcl3+DQW+i+wSYagQDGTen+Eiab1glAsuLpC4raptwf5bhX3OL/uo6OVZExMLdAal72JTLa60qiCrmq/8VBUlnSyRKMFQgLq/MlNdVmLN0dJKw6Izi6G2LvxA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745507975; c=relaxed/simple; bh=fTRmjYed2VIYs6hY1s+vikS1UZUUZfpCUTS1lkr5CbU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dJ8KZZ142xs3vBMBH+V1tUOcz/gw7tmjkuws59h2I/w87bf1qqcYR4MSIkPUm3Z2mT07zOgj1aXTBP9ZQW2L++AzvINk01lCzRH2c4RF4XmeyJnYYKymM+w90YEM7Y+e6pFDncQ4Z6kPBjNJmKBnWsWfiGj1EmzfjnJSV0nMsAo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m8q1ZZz1; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m8q1ZZz1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5902DC4CEE3; Thu, 24 Apr 2025 15:19:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1745507975; bh=fTRmjYed2VIYs6hY1s+vikS1UZUUZfpCUTS1lkr5CbU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=m8q1ZZz1RpxrYmw2qzQZMKJfdpd9Olan3KNX/XD1bYAHAv1gPQw/K2JbynEZTE58u Zz6dzDsY8G9RWGecpLGAWEbORehbRzrV4aT/0tS5FO0/GxCVCAeCf3Hz1NpVLowXwA kXPnypu6UcdE5yDjB827LL26t52MXqdkfotnQNuvkjFi/aEOvDm0j1VXdz3u7i2ilv dMH3WI8yTDQHyTt+1c2DDDL5m2dI5sCG3S/DqgeqcloBG62MYQIPHm3zwt7dLr1Xv7 Dky4OIMOwV7N1fslgftxWLdYo/bhAOmMLaWA/9Vb+AlD+ENqzG3IiNnByzVUt6P3CP YWw2jxsvH+37w== Date: Thu, 24 Apr 2025 17:19:28 +0200 From: Christian Brauner To: David Rheinsberg Cc: Oleg Nesterov , Kuniyuki Iwashima , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org, Jan Kara , Alexander Mikhalitsyn , Luca Boccassi , Lennart Poettering , Daan De Meyer , Mike Yuan Subject: Re: [PATCH RFC 2/4] net, pidfs: prepare for handing out pidfds for reaped sk->sk_peer_pid Message-ID: <20250424-chipsatz-verpennen-afa9e213e332@brauner> References: <20250424-work-pidfs-net-v1-0-0dc97227d854@kernel.org> <20250424-work-pidfs-net-v1-2-0dc97227d854@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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 > > 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 > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -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.