Re: [PATCH 1/1] mm: Remove the access_ok() call from gup_fast_fallback().

From: Jason Gunthorpe
Date: Sun Feb 09 2025 - 13:24:35 EST


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@xxxxxxxxx>
> ---
> mm/gup.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

I often wonder about about access_ok() calls, if they still do
anything..

Jason