Re: [PATCH 04/14] x86: use more conventional access_ok() definition

2022-02-14 Thread Al Viro
On Mon, Feb 14, 2022 at 08:17:07PM +, Al Viro wrote: > On Mon, Feb 14, 2022 at 12:01:05PM -0800, Linus Torvalds wrote: > > On Mon, Feb 14, 2022 at 11:46 AM Arnd Bergmann wrote: > > > > > > As Al pointed out, they turned out to be necessary on sparc64, but the > > > only > > > definitions are

RE: [PATCH 04/14] x86: use more conventional access_ok() definition

2022-02-14 Thread David Laight
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

Re: [PATCH 04/14] x86: use more conventional access_ok() definition

2022-02-14 Thread Linus Torvalds
On Mon, Feb 14, 2022 at 12:01 PM Linus Torvalds wrote: > > 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. Right now we actually have this

Re: [PATCH 04/14] x86: use more conventional access_ok() definition

2022-02-14 Thread Al Viro
On Mon, Feb 14, 2022 at 12:01:05PM -0800, Linus Torvalds wrote: > On Mon, Feb 14, 2022 at 11:46 AM Arnd Bergmann wrote: > > > > As Al pointed out, they turned out to be necessary on sparc64, but the only > > definitions are on sparc64 and x86, so it's possible that they serve a > > similar > >

Re: [PATCH 04/14] x86: use more conventional access_ok() definition

2022-02-14 Thread Linus Torvalds
On Mon, Feb 14, 2022 at 11:46 AM Arnd Bergmann wrote: > > As Al pointed out, they turned out to be necessary on sparc64, but the only > definitions are on sparc64 and x86, so it's possible that they serve a similar > purpose here, in which case changing the limit from TASK_SIZE to > TASK_SIZE_MAX

Re: [PATCH 04/14] x86: use more conventional access_ok() definition

2022-02-14 Thread Christoph Hellwig
On Mon, Feb 14, 2022 at 08:45:52PM +0100, Arnd Bergmann wrote: > As Al pointed out, they turned out to be necessary on sparc64, but the only > definitions are on sparc64 and x86, so it's possible that they serve a similar > purpose here, in which case changing the limit from TASK_SIZE to >

Re: [PATCH 04/14] x86: use more conventional access_ok() definition

2022-02-14 Thread Arnd Bergmann
On Mon, Feb 14, 2022 at 6:02 PM Christoph Hellwig wrote: > > On Mon, Feb 14, 2022 at 05:34:42PM +0100, Arnd Bergmann wrote: > > +#define __range_not_ok(addr, size, limit)(!__access_ok(addr, size)) > > +#define __chk_range_not_ok(addr, size, limit)(!__access_ok((void > > __user

Re: [PATCH 04/14] x86: use more conventional access_ok() definition

2022-02-14 Thread Christoph Hellwig
On Mon, Feb 14, 2022 at 05:34:42PM +0100, Arnd Bergmann wrote: > +#define __range_not_ok(addr, size, limit)(!__access_ok(addr, size)) > +#define __chk_range_not_ok(addr, size, limit)(!__access_ok((void > __user *)addr, size)) Can we just kill these off insted of letting themm