[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <07050857-c9d2-bab2-2191-8d244d6f7708@csgroup.eu>
Date: Wed, 16 Feb 2022 19:43:22 +0000
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Arnd Bergmann <arnd@...nel.org>, Ard Biesheuvel <ardb@...nel.org>
CC: Mark Rutland <mark.rutland@....com>, Rich Felker <dalias@...c.org>,
"linux-ia64@...r.kernel.org" <linux-ia64@...r.kernel.org>,
Linux-sh list <linux-sh@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
"open list:MIPS" <linux-mips@...r.kernel.org>,
Linux Memory Management List <linux-mm@...ck.org>,
Guo Ren <guoren@...nel.org>,
"open list:SPARC + UltraSPARC (sparc/sparc64)"
<sparclinux@...r.kernel.org>,
"open list:QUALCOMM HEXAGON..." <linux-hexagon@...r.kernel.org>,
linux-riscv <linux-riscv@...ts.infradead.org>,
Will Deacon <will@...nel.org>, Christoph Hellwig <hch@....de>,
linux-arch <linux-arch@...r.kernel.org>,
"open list:S390" <linux-s390@...r.kernel.org>,
Brian Cain <bcain@...eaurora.org>,
Helge Deller <deller@....de>, X86 ML <x86@...nel.org>,
Russell King <linux@...linux.org.uk>,
"linux-csky@...r.kernel.org" <linux-csky@...r.kernel.org>,
Ingo Molnar <mingo@...hat.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
"open list:SYNOPSYS ARC ARCHITECTURE"
<linux-snps-arc@...ts.infradead.org>,
Robin Murphy <robin.murphy@....com>,
"open list:TENSILICA XTENSA PORT (xtensa)"
<linux-xtensa@...ux-xtensa.org>, Arnd Bergmann <arnd@...db.de>,
Heiko Carstens <hca@...ux.ibm.com>,
alpha <linux-alpha@...r.kernel.org>,
linux-um <linux-um@...ts.infradead.org>,
"open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)"
<linuxppc-dev@...ts.ozlabs.org>,
linux-m68k <linux-m68k@...ts.linux-m68k.org>,
Openrisc <openrisc@...ts.librecores.org>,
Greentime Hu <green.hu@...il.com>,
Stafford Horne <shorne@...il.com>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Michal Simek <monstr@...str.eu>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
"open list:PARISC ARCHITECTURE" <linux-parisc@...r.kernel.org>,
Nick Hu <nickhu@...estech.com>,
Max Filippov <jcmvbkbc@...il.com>,
Linux API <linux-api@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Dinh Nguyen <dinguyen@...nel.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Richard Weinberger <richard@....at>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH 08/14] arm64: simplify access_ok()
Le 15/02/2022 à 10:12, Arnd Bergmann a écrit :
> On Tue, Feb 15, 2022 at 9:17 AM Ard Biesheuvel <ardb@...nel.org> wrote:
>> On Mon, 14 Feb 2022 at 17:37, Arnd Bergmann <arnd@...nel.org> wrote:
>>> From: Arnd Bergmann <arnd@...db.de>
>>>
>>
>> With set_fs() out of the picture, wouldn't it be sufficient to check
>> that bit #55 is clear? (the bit that selects between TTBR0 and TTBR1)
>> That would also remove the need to strip the tag from the address.
>>
>> Something like
>>
>> asm goto("tbnz %0, #55, %2 \n"
>> "tbnz %1, #55, %2 \n"
>> :: "r"(addr), "r"(addr + size - 1) :: notok);
>> return 1;
>> notok:
>> return 0;
>>
>> with an additional sanity check on the size which the compiler could
>> eliminate for compile-time constant values.
>
> That should work, but I don't see it as a clear enough advantage to
> have a custom implementation. For the constant-size case, it probably
> isn't better than a compiler-scheduled comparison against a
> constant limit, but it does hurt maintainability when the next person
> wants to change the behavior of access_ok() globally.
>
> If we want to get into micro-optimizing uaccess, I think a better target
> would be a CONFIG_CC_HAS_ASM_GOTO_OUTPUT version
> of __get_user()/__put_user as we have on x86 and powerpc.
>
There is also the user block accesses with
user_access_begin()/user_access_end() together with unsafe_put_user()
and unsafe_get_user() which allowed us to optimise user accesses on
powerpc, especially in the signal code.
Christophe
Powered by blists - more mailing lists