Re: [RFC PATCH v1 7/9] x86: Add unsafe_copy_from_user()
Yury Norov <[email protected]> Mon, 27 Apr 2026 18:30:16 -0400
| Newsgroups | gmane.comp.freedesktop.xorg.drivers.intel,gmane.linux.ports.alpha,gmane.linux.kernel,gmane.linux.kernel.arc,gmane.linux.ports.arm.kernel,gmane.linux.ports.mips,gmane.linux.ports.ppc64.devel,gmane.comp.emulators.kvm.devel,gmane.linux.ports.riscv,gmane.linux.ports.sparc,gmane.linux.uml.devel,gmane.linux.kernel.efi,gmane.comp.freedesktop.amd-gfx,gmane.comp.video.dri.devel,gmane.linux.network,gmane.linux.kernel.wireless.general,gmane.linux.kernel.spi.devel,gmane.linux.drivers.video-input-infrastructure,gmane.linux.serial,gmane.linux.usb.general,gmane.comp.emulators.xen.devel,gmane.linux.file-systems,gmane.linux.kernel.bpf,gmane.linux.kernel.mm,gmane.linux.x25,gmane.linux.kernel.rust,gmane.linux.sound,gmane.linux.ports.hexagon,gmane.linux.ports.parisc,gmane.linux.ports.sh.devel,gmane.linux.kernel.cross-arch |
|---|---|
| Message-ID | <ae_jeJLlVWjJ4sOY@yury> |
On Mon, Apr 27, 2026 at 02:52:05PM -0700, Linus Torvalds wrote: > On Mon, 27 Apr 2026 at 12:19, Yury Norov <[email protected]> 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... Thanks, Yury