RE: [PATCH 04/14] x86: use more conventional access_ok() definition
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: "'Linus Torvalds'" <torvalds@xxxxxxxxxxxxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxxxx>
- Subject: RE: [PATCH 04/14] x86: use more conventional access_ok() definition
- From: David Laight <David.Laight@xxxxxxxxxx>
- Date: Mon, 14 Feb 2022 22:13:34 +0000
- Accept-language: en-GB, en-US
- Cc: Mark Rutland <mark.rutland@xxxxxxx>, Rich Felker <dalias@xxxxxxxx>, "linux-ia64@xxxxxxxxxxxxxxx" <linux-ia64@xxxxxxxxxxxxxxx>, Linux-sh list <linux-sh@xxxxxxxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, "open list:BROADCOM NVRAM DRIVER" <linux-mips@xxxxxxxxxxxxxxx>, Max Filippov <jcmvbkbc@xxxxxxxxx>, Guo Ren <guoren@xxxxxxxxxx>, sparclinux <sparclinux@xxxxxxxxxxxxxxx>, linux-riscv <linux-riscv@xxxxxxxxxxxxxxxxxxx>, Will Deacon <will@xxxxxxxxxx>, Ard Biesheuvel <ardb@xxxxxxxxxx>, linux-arch <linux-arch@xxxxxxxxxxxxxxx>, linux-s390 <linux-s390@xxxxxxxxxxxxxxx>, "Brian Cain" <bcain@xxxxxxxxxxxxxx>, "open list:QUALCOMM HEXAGON..." <linux-hexagon@xxxxxxxxxxxxxxx>, Helge Deller <deller@xxxxxx>, "the arch/x86 maintainers" <x86@xxxxxxxxxx>, Russell King - ARM Linux <linux@xxxxxxxxxxxxxxx>, "linux-csky@xxxxxxxxxxxxxxx" <linux-csky@xxxxxxxxxxxxxxx>, Christoph Hellwig <hch@xxxxxx>, "Christoph Hellwig" <hch@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, "Geert Uytterhoeven" <geert@xxxxxxxxxxxxxx>, "open list:SYNOPSYS ARC ARCHITECTURE" <linux-snps-arc@xxxxxxxxxxxxxxxxxxx>, "open list:TENSILICA XTENSA PORT (xtensa)" <linux-xtensa@xxxxxxxxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Heiko Carstens <hca@xxxxxxxxxxxxx>, linux-um <linux-um@xxxxxxxxxxxxxxxxxxx>, Richard Weinberger <richard@xxxxxx>, linux-m68k <linux-m68k@xxxxxxxxxxxxxxx>, Openrisc <openrisc@xxxxxxxxxxxxxxxxxxxx>, Greentime Hu <green.hu@xxxxxxxxx>, Stafford Horne <shorne@xxxxxxxxx>, "Linux ARM" <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, Michal Simek <monstr@xxxxxxxxx>, Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>, Nick Hu <nickhu@xxxxxxxxxxxxx>, Parisc List <linux-parisc@xxxxxxxxxxxxxxx>, Linux-MM <linux-mm@xxxxxxxxx>, Linux API <linux-api@xxxxxxxxxxxxxxx>, "Linux Kernel Mailing List" <linux-kernel@xxxxxxxxxxxxxxx>, Dinh Nguyen <dinguyen@xxxxxxxxxx>, "Eric W . Biederman" <ebiederm@xxxxxxxxxxxx>, alpha <linux-alpha@xxxxxxxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, linuxppc-dev <linuxppc-dev@xxxxxxxxxxxxxxxx>, David Miller <davem@xxxxxxxxxxxxx>, Al Viro <viro@xxxxxxxxxxxxxxxxxx>
- In-reply-to: <CAHk-=wgYu67OwP4LhcrPdDVxv2mOsx-Xsc2DKoVW6GZwKFtOYQ@mail.gmail.com>
- References: <20220214163452.1568807-1-arnd@kernel.org> <20220214163452.1568807-5-arnd@kernel.org> <YgqLFYqIqkIsNC92@infradead.org> <CAK8P3a1F3JaYaJPy9bSCG1+YV6EN05PE0DbwpD_GT1qRwFSJ-w@mail.gmail.com> <CAHk-=whq6_Nh3cB3FieP481VcRyCu69X3=wO1yLHGmcZEj69SA@mail.gmail.com> <CAHk-=wgYu67OwP4LhcrPdDVxv2mOsx-Xsc2DKoVW6GZwKFtOYQ@mail.gmail.com>
From: Linus Torvalds
> Sent: 14 February 2022 20:24
> >
> > x86-64 has always(*) used TASK_SIZE_MAX for access_ok(), and the
> > get_user() assembler implementation does the same.
>
> Side note: we could just check the sign bit instead, and avoid big
> constants that way.
The cheap test for most 64bit is (addr | size) >> 62 != 0.
I did some tests last week and the compilers correctly optimise
out constant size.
Doesn't sparc64 still need a wrap test?
Or is that assumed because there is always an unmapped page
and transfer are 'adequately' done on increasing addresses?
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]