[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250822195303.0d9fb6eb@pumpkin>
Date: Fri, 22 Aug 2025 19:53:03 +0100
From: David Laight <david.laight.linux@...il.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Christophe Leroy <christophe.leroy@...roup.eu>, Michael Ellerman
<mpe@...erman.id.au>, Nicholas Piggin <npiggin@...il.com>, Madhavan
Srinivasan <maddy@...ux.ibm.com>, Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>, Thomas
Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, Peter
Zijlstra <peterz@...radead.org>, Darren Hart <dvhart@...radead.org>,
Davidlohr Bueso <dave@...olabs.net>, Andre Almeida
<andrealmeid@...lia.com>, Andrew Morton <akpm@...ux-foundation.org>, Dave
Hansen <dave.hansen@...ux.intel.com>, Daniel Borkmann
<daniel@...earbox.net>, linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org, linux-block@...r.kernel.org
Subject: Re: [PATCH v2 02/10] uaccess: Add speculation barrier to
copy_from_user_iter()
On Fri, 22 Aug 2025 09:46:37 -0400
Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> On Fri, 22 Aug 2025 at 05:58, Christophe Leroy
> <christophe.leroy@...roup.eu> wrote:
> >
> > The results of "access_ok()" can be mis-speculated. The result is that
> > you can end speculatively:
> >
> > if (access_ok(from, size))
> > // Right here
>
> I actually think that we should probably just make access_ok() itself do this.
You'd need to re-introduce the read/write parameter.
And you'd want it to be compile time.
Although going through the code changing them to read_access_ok()
and write_access_ok() would probably leave you with a lot fewer calls.
> We don't have *that* many users since we have been de-emphasizing the
> "check ahead of time" model, and any that are performance-critical can
> these days be turned into masked addresses.
Or aim to allocate a guard page on all archs, support 'masked' access
on all of them, and then just delete access_ok().
That'll make it look less ugly.
Perhaps not this week though :-)
David
>
> As it is, now we're in the situation that careful places - like
> _inline_copy_from_user(), and with your patch copy_from_user_iter() -
> do maybe wethis by hand and are ugly as a result, and lazy and
> probably incorrect places don't do it at all.
>
> That said, I don't object to this patch and maybe we should do that
> access_ok() change later and independently of any powerpc work.
>
> Linus
Powered by blists - more mailing lists