lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250209190003.661db659@pumpkin>
Date: Sun, 9 Feb 2025 19:00:03 +0000
From: David Laight <david.laight.linux@...il.com>
To: Jason Gunthorpe <jgg@...dia.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, Linus Torvalds
 <torvalds@...ux-foundation.org>, linux-mm@...ck.org,
 linux-kernel@...r.kernel.org, x86@...nel.org, Jan Kara <jack@...e.cz>, John
 Hubbard <jhubbard@...dia.com>, Peter Xu <peterx@...hat.com>, Dave Hansen
 <dave.hansen@...ux.intel.com>, Andy Lutomirski <luto@...nel.org>, Peter
 Zijlstra <peterz@...radead.org>, Thomas Gleixner <tglx@...utronix.de>, Ingo
 Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>
Subject: Re: [PATCH 1/1] mm: Remove the access_ok() call from
 gup_fast_fallback().

On Sun, 9 Feb 2025 14:24:22 -0400
Jason Gunthorpe <jgg@...dia.com> wrote:

> On Sun, Feb 09, 2025 at 05:47:11PM +0000, David Laight wrote:
> > Historiaclly the code relied on access_ok() to validate the address range.
> > Commit 26f4c328079d7 added an explicit wrap check before access_ok().
> > Commit c28b1fc70390d then changed the wrap test to use check_add_overflow().
> > Commit 6014bc27561f2 relaxed the checks in x86-64's access_ok() and added
> >   an explicit check for TASK_SIZE here to make up for it.
> > That left a pointless access_ok() call with its associated 'lfence' that
> >   can never actually fail.
> > So just delete the test.
> > 
> > Signed-off-by: David Laight <david.laight.linux@...il.com>
> > ---
> >  mm/gup.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)  
> 
> Reviewed-by: Jason Gunthorpe <jgg@...dia.com>
> 
> I often wonder about about access_ok() calls, if they still do
> anything..

They still do 'stuff' and end up containing a slow memory synchronising
instruction (to avoid speculative accesses controlled by the application).

But there are better ways to handle bad user pointers.
So, mostly access_ok() isn't needed outside the architecture code
that handles userspace accesses.

	David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ