.com>, Russell King , linux-arm-kernel@lists.infradead.org, Linus Torvalds , x86@kernel.org, Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , linuxppc-dev@lists.ozlabs.org, Paul Walmsley , Palmer Dabbelt , linux-riscv@lists.infradead.org, Heiko Carstens , Christian Borntraeger , Sven Schnelle , linux-s390@vger.kernel.org, Mathieu Desnoyers , Andrew Cooper , David Laight , Julia Lawall , Nicolas Palix , Peter Zijlstra , Darren Hart , Davidlohr Bueso , =?UTF-8?Q?Andr=C3=A9_Almeida?= References: <20251027083700.573016505@linutronix.de> <20251027083745.862419776@linutronix.de> From: Christophe Leroy Content-Language: fr-FR In-Reply-To: <20251027083745.862419776@linutronix.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.80.249 listed in list.dnswl.org] -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 5 Le 27/10/2025 à 09:44, Thomas Gleixner a écrit : > From: Thomas Gleixner > > Replace the open coded implementation with the scoped user access guard. > > No functional change intended. > > Signed-off-by: Thomas Gleixner > Cc: Alexander Viro > Cc: Christian Brauner > Cc: Jan Kara > Cc: linux-fsdevel@vger.kernel.org Reviewed-by: Christophe Leroy > --- > V4: Use read guard - Peterz > Rename once more > V3: Adopt to scope changes > --- > fs/select.c | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > --- > --- a/fs/select.c > +++ b/fs/select.c > @@ -776,17 +776,13 @@ static inline int get_sigset_argpack(str > { > // the path is hot enough for overhead of copy_from_user() to matter > if (from) { > - if (can_do_masked_user_access()) > - from = masked_user_access_begin(from); > - else if (!user_read_access_begin(from, sizeof(*from))) > - return -EFAULT; > - unsafe_get_user(to->p, &from->p, Efault); > - unsafe_get_user(to->size, &from->size, Efault); > - user_read_access_end(); > + scoped_user_read_access(from, Efault) { > + unsafe_get_user(to->p, &from->p, Efault); > + unsafe_get_user(to->size, &from->size, Efault); > + } > } > return 0; > Efault: > - user_read_access_end(); > return -EFAULT; > } > > From - Tue Nov 04 06:53:21 2025 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 4BfcF8eiCWmLLR8AYBR5ng (envelope-from ) for ; Tue, 04 Nov 2025 06:52:55 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 04 Nov 2025 06:52:55 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1vGAuV-00000009Fh8-034G for hi@josie.lol; Tue, 04 Nov 2025 06:52:55 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id B64144EBDAF for ; Tue, 4 Nov 2025 06:52:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B01D32DEA93; Tue, 4 Nov 2025 06:50:32 +0000 (UTC) X-Original-To: linux-s390@vger.kernel.org Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CC03E2EBBB5; Tue, 4 Nov 2025 06:50:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.17.235.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762239032; cv=none; b=kX2qZVEqzx9V8x/sY3MihEiorzn4pmqUCWMysMaDuaVQnNHLRYaMayc+a5Q5JdbO4XfU+SR98yFcD60W2wR8/JShfiQc4P8gRfROEO5OWBIQelxx45b6kAHXPo1bJksXA4mWfk2skAfdweaX+dlAVztqdXvISu0s6CSULYMCCuU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762239032; c=relaxed/simple; bh=by2cO8Ki42/nHAReZn3vr372SHmYylTJ6gxOFBGWMf0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=vGu+Yqu4FXR6RTKWrT+CvBtruJGa3uGrWP1JTXk1Q8mgYSPreIfIDesX8VCsc2KLIWcHOq6Psh1ECaY2eVjmZ2Y11FrzDyrS+66aZrWdMjbFP4uMPrfZC4PRLjfRdgy/KO9KM+zPmr9qbCXmoisZE67BAKYcHxBn6Q8UHAONFSs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu; spf=pass smtp.mailfrom=csgroup.eu; arc=none smtp.client-ip=93.17.235.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=csgroup.eu Received: from localhost (mailhub4.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4d0z9m0gsPz9sSb; Tue, 4 Nov 2025 07:31:08 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tzBUMEXuRcrz; Tue, 4 Nov 2025 07:31:07 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4d0z9l6gDWz9sSZ; Tue, 4 Nov 2025 07:31:07 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id CCC188B76C; Tue, 4 Nov 2025 07:31:07 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id GoDVNgciAAnR; Tue, 4 Nov 2025 07:31:07 +0100 (CET) Received: from [192.168.235.99] (unknown [192.168.235.99]) by messagerie.si.c-s.fr (Postfix) with ESMTP id EA3368B763; Tue, 4 Nov 2025 07:31:05 +0100 (CET) Message-ID: <942a27d9-135a-4e59-8eff-a44c46f8bb76@csgroup.eu> Date: Tue, 4 Nov 2025 07:31:05 +0100 Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [patch V5 10/12] futex: Convert to get/put_user_inline() To: Thomas Gleixner , LKML Cc: Peter Zijlstra , Darren Hart , Davidlohr Bueso , =?UTF-8?Q?Andr=C3=A9_Almeida?= , kernel test robot , Russell King , linux-arm-kernel@lists.infradead.org, Linus Torvalds , x86@kernel.org, Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , linuxppc-dev@lists.ozlabs.org, Paul Walmsley , Palmer Dabbelt , linux-riscv@lists.infradead.org, Heiko Carstens , Christian Borntraeger , Sven Schnelle , linux-s390@vger.kernel.org, Mathieu Desnoyers , Andrew Cooper , David Laight , Julia Lawall , Nicolas Palix , Alexander Viro , Christian Brauner , Jan Kara , linux-fsdevel@vger.kernel.org References: <20251027083700.573016505@linutronix.de> <20251027083745.736737934@linutronix.de> From: Christophe Leroy Content-Language: fr-FR In-Reply-To: <20251027083745.736737934@linutronix.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 5 Le 27/10/2025 à 09:44, Thomas Gleixner a écrit : > From: Thomas Gleixner > > Replace the open coded implementation with the new get/put_user_inline() > helpers. This might be replaced by a regular get/put_user(), but that needs > a proper performance evaluation. > > No functional change intended > > Signed-off-by: Thomas Gleixner > Cc: Peter Zijlstra > Cc: Darren Hart > Cc: Davidlohr Bueso > Cc: "André Almeida" Reviewed-by: Christophe Leroy > --- > V5: Rename again and remove the helpers > V4: Rename once moar > V3: Adapt to scope changes > V2: Convert to scoped variant > --- > kernel/futex/core.c | 4 +-- > kernel/futex/futex.h | 58 ++------------------------------------------------- > 2 files changed, 5 insertions(+), 57 deletions(-) > --- > --- a/kernel/futex/core.c > +++ b/kernel/futex/core.c > @@ -581,7 +581,7 @@ int get_futex_key(u32 __user *uaddr, uns > if (flags & FLAGS_NUMA) { > u32 __user *naddr = (void *)uaddr + size / 2; > > - if (futex_get_value(&node, naddr)) > + if (get_user_inline(node, naddr)) > return -EFAULT; > > if ((node != FUTEX_NO_NODE) && > @@ -601,7 +601,7 @@ int get_futex_key(u32 __user *uaddr, uns > node = numa_node_id(); > node_updated = true; > } > - if (node_updated && futex_put_value(node, naddr)) > + if (node_updated && put_user_inline(node, naddr)) > return -EFAULT; > } > > --- a/kernel/futex/futex.h > +++ b/kernel/futex/futex.h > @@ -281,63 +281,11 @@ static inline int futex_cmpxchg_value_lo > return ret; > } > > -/* > - * This does a plain atomic user space read, and the user pointer has > - * already been verified earlier by get_futex_key() to be both aligned > - * and actually in user space, just like futex_atomic_cmpxchg_inatomic(). > - * > - * We still want to avoid any speculation, and while __get_user() is > - * the traditional model for this, it's actually slower than doing > - * this manually these days. > - * > - * We could just have a per-architecture special function for it, > - * the same way we do futex_atomic_cmpxchg_inatomic(), but rather > - * than force everybody to do that, write it out long-hand using > - * the low-level user-access infrastructure. > - * > - * This looks a bit overkill, but generally just results in a couple > - * of instructions. > - */ > -static __always_inline int futex_get_value(u32 *dest, u32 __user *from) > -{ > - u32 val; > - > - if (can_do_masked_user_access()) > - from = masked_user_access_begin(from); > - else if (!user_read_access_begin(from, sizeof(*from))) > - return -EFAULT; > - unsafe_get_user(val, from, Efault); > - user_read_access_end(); > - *dest = val; > - return 0; > -Efault: > - user_read_access_end(); > - return -EFAULT; > -} > - > -static __always_inline int futex_put_value(u32 val, u32 __user *to) > -{ > - if (can_do_masked_user_access()) > - to = masked_user_access_begin(to); > - else if (!user_write_access_begin(to, sizeof(*to))) > - return -EFAULT; > - unsafe_put_user(val, to, Efault); > - user_write_access_end(); > - return 0; > -Efault: > - user_write_access_end(); > - return -EFAULT; > -} > - > +/* Read from user memory with pagefaults disabled */ > static inline int futex_get_value_locked(u32 *dest, u32 __user *from) > { > - int ret; > - > - pagefault_disable(); > - ret = futex_get_value(dest, from); > - pagefault_enable(); > - > - return ret; > + guard(pagefault)(); > + return get_user_inline(*dest, from); > } > > extern void __futex_unqueue(struct futex_q *q); > From - Tue Nov 04 06:54:16 2025 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 4IjAHBOjCWmdwiEAYBR5ng (envelope-from ) for ; Tue, 04 Nov 2025 06:54:11 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 04 Nov 2025 06:54:11 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1vGAvi-00000009I4y-2vNI for hi@josie.lol; Tue, 04 Nov 2025 06:54:11 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E9E61189F190 for ; Tue, 4 Nov 2025 06:53:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B64A728C87D; Tue, 4 Nov 2025 06:50:37 +0000 (UTC) X-Original-To: linux-s390@vger.kernel.org Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7DBFD1C3306; Tue, 4 Nov 2025 06:50:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.17.235.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762239037; cv=none; b=SvGqtXJddVDpJtVuqoAcf5qM1kzI6OIPQPIGlHQPzSclxVZbbd+axlYjfxJT05hezvbaXW+AeC8sJXM0znh7xQLXvsj4AUJ99k3XVYT2JU29kHVf8AsVp6S4mNjA0fLkWglZLlOiM