Re: [RFC PATCH v1 7/9] x86: Add unsafe_copy_from_user()

Segher Boessenkool
2026-04-28T11:21:20Z

Hi!

On Mon, Apr 27, 2026 at 06:30:16PM -0400, Yury Norov wrote:
> On Mon, Apr 27, 2026 at 02:52:05PM -0700, Linus Torvalds wrote:
> > On Mon, 27 Apr 2026 at 12:19, Yury Norov <ynorov@nvidia.com> wrote:
> > >
> > > This is what Linus said when added x86 implementation for copy_from_user()
> > > in c512c69187197:
> >
> > Note that some things have happily changed in the six+ years since...
> >
> > > That's partly because we have no current users of it, but also partly
> > > because the copy_from_user() case is slightly different and cannot
> > > efficiently be implemented in terms of a unsafe_get_user() loop (because
> > > gcc can't do asm goto with outputs).
> >
> > now everybody can do asm goto with outputs.
> >
> > Yes, it's disabled on older versions, so it's not *always* available,
> > but all modern versions do it. And if you care about performance, you
> > won't be using an old compiler.
>
> The minimal GCC version is 8.1, and asm goto with outputs is supported
> since GCC-11. That would brake the build, if we just switch to using it
> without "CC_IS_GCC && (GCC_VERSION >= 110100)" guard.
>
> Is it worth to maintain 2 version of the function? I don't know...

GCC 11 was released five years and a day ago. The last GCC 11 release
(that of 11.5) is not even two years ago though (but there will be no
more!)

So it would be not conservative at all to require GCC 11 as minimum now,
some people might even call it a bit aggressive. But in a year (or
maybe two) the lay of the land will be rather different.

Segher