Re: [PATCH v2 10/18] m68k: fix access_ok for coldfire
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
- Subject: Re: [PATCH v2 10/18] m68k: fix access_ok for coldfire
- From: Arnd Bergmann <arnd@xxxxxxxxxx>
- Date: Fri, 18 Feb 2022 10:24:50 +0100
- Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>, Christoph Hellwig <hch@xxxxxx>, Linux-Arch <linux-arch@xxxxxxxxxxxxxxx>, Linux MM <linux-mm@xxxxxxxxx>, Linux API <linux-api@xxxxxxxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, Al Viro <viro@xxxxxxxxxxxxxxxxxx>, Russell King <linux@xxxxxxxxxxxxxxx>, Will Deacon <will@xxxxxxxxxx>, Guo Ren <guoren@xxxxxxxxxx>, Brian Cain <bcain@xxxxxxxxxxxxxx>, Michal Simek <monstr@xxxxxxxxx>, Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>, Nick Hu <nickhu@xxxxxxxxxxxxx>, Greentime Hu <green.hu@xxxxxxxxx>, Dinh Nguyen <dinguyen@xxxxxxxxxx>, Stafford Horne <shorne@xxxxxxxxx>, Helge Deller <deller@xxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Mark Rutland <mark.rutland@xxxxxxx>, Heiko Carstens <hca@xxxxxxxxxxxxx>, Rich Felker <dalias@xxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, Richard Weinberger <richard@xxxxxx>, "the arch/x86 maintainers" <x86@xxxxxxxxxx>, Max Filippov <jcmvbkbc@xxxxxxxxx>, "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Ard Biesheuvel <ardb@xxxxxxxxxx>, alpha <linux-alpha@xxxxxxxxxxxxxxx>, arcml <linux-snps-arc@xxxxxxxxxxxxxxxxxxx>, linux-csky@xxxxxxxxxxxxxxx, "open list:QUALCOMM HEXAGON..." <linux-hexagon@xxxxxxxxxxxxxxx>, "linux-ia64@xxxxxxxxxxxxxxx" <linux-ia64@xxxxxxxxxxxxxxx>, linux-m68k <linux-m68k@xxxxxxxxxxxxxxx>, "open list:BROADCOM NVRAM DRIVER" <linux-mips@xxxxxxxxxxxxxxx>, Openrisc <openrisc@xxxxxxxxxxxxxxxxxxxx>, Parisc List <linux-parisc@xxxxxxxxxxxxxxx>, linuxppc-dev <linuxppc-dev@xxxxxxxxxxxxxxxx>, linux-riscv <linux-riscv@xxxxxxxxxxxxxxxxxxx>, linux-s390 <linux-s390@xxxxxxxxxxxxxxx>, Linux-sh list <linux-sh@xxxxxxxxxxxxxxx>, sparclinux <sparclinux@xxxxxxxxxxxxxxx>, linux-um <linux-um@xxxxxxxxxxxxxxxxxxx>, "open list:TENSILICA XTENSA PORT (xtensa)" <linux-xtensa@xxxxxxxxxxxxxxxx>
- In-reply-to: <CAMuHMdWMhP5WgZ7CvOz53SyfizaAvLkHbeuds8G+_nZkwzhWWw@mail.gmail.com>
- References: <20220216131332.1489939-1-arnd@kernel.org> <20220216131332.1489939-11-arnd@kernel.org> <CAMuHMdWMhP5WgZ7CvOz53SyfizaAvLkHbeuds8G+_nZkwzhWWw@mail.gmail.com>
On Fri, Feb 18, 2022 at 10:00 AM Geert Uytterhoeven
<geert@xxxxxxxxxxxxxx> wrote:
> > /* We let the MMU do all checking */
> > -static inline int access_ok(const void __user *addr,
> > +static inline int access_ok(const void __user *ptr,
> > unsigned long size)
> > {
> > + unsigned long limit = TASK_SIZE;
> > + unsigned long addr = (unsigned long)ptr;
> > +
> > /*
> > * XXX: for !CONFIG_CPU_HAS_ADDRESS_SPACES this really needs to check
> > * for TASK_SIZE!
> > + * Removing this helper is probably sufficient.
> > */
>
> Shouldn't the above comment block be removed completely,
> as this is now implemented below?
Yes, obviously. Fixed now.
> > - return 1;
> > + if (IS_ENABLED(CONFIG_CPU_HAS_ADDRESS_SPACES))
> > + return 1;
I just noticed this should have the same change that I made for the
generic version, changed it now to
+ if (IS_ENABLED(CONFIG_CPU_HAS_ADDRESS_SPACES) ||
+ !IS_ENABLED(CONFIG_MMU))
This is gone again after the cleanup patch, when the generic version
is used instead.
> > + return (size <= limit) && (addr <= (limit - size));
> > }
>
> Any pesky compilers that warn (or worse with -Werror) about
> "condition always true" for TASK_SIZE = 0xFFFFFFFFUL?
No, using a local variable avoids this warning.
Arnd
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]