linux/tools/arch/x86/include/asm
Dan Williams ec6347bb43 x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}()
In reaction to a proposal to introduce a memcpy_mcsafe_fast()
implementation Linus points out that memcpy_mcsafe() is poorly named
relative to communicating the scope of the interface. Specifically what
addresses are valid to pass as source, destination, and what faults /
exceptions are handled.

Of particular concern is that even though x86 might be able to handle
the semantics of copy_mc_to_user() with its common copy_user_generic()
implementation other archs likely need / want an explicit path for this
case:

  On Fri, May 1, 2020 at 11:28 AM Linus Torvalds <torvalds@linux-foundation.org> wrote:
  >
  > On Thu, Apr 30, 2020 at 6:21 PM Dan Williams <dan.j.williams@intel.com> wrote:
  > >
  > > However now I see that copy_user_generic() works for the wrong reason.
  > > It works because the exception on the source address due to poison
  > > looks no different than a write fault on the user address to the
  > > caller, it's still just a short copy. So it makes copy_to_user() work
  > > for the wrong reason relative to the name.
  >
  > Right.
  >
  > And it won't work that way on other architectures. On x86, we have a
  > generic function that can take faults on either side, and we use it
  > for both cases (and for the "in_user" case too), but that's an
  > artifact of the architecture oddity.
  >
  > In fact, it's probably wrong even on x86 - because it can hide bugs -
  > but writing those things is painful enough that everybody prefers
  > having just one function.

Replace a single top-level memcpy_mcsafe() with either
copy_mc_to_user(), or copy_mc_to_kernel().

Introduce an x86 copy_mc_fragile() name as the rename for the
low-level x86 implementation formerly named memcpy_mcsafe(). It is used
as the slow / careful backend that is supplanted by a fast
copy_mc_generic() in a follow-on patch.

One side-effect of this reorganization is that separating copy_mc_64.S
to its own file means that perf no longer needs to track dependencies
for its memcpy_64.S benchmarks.

 [ bp: Massage a bit. ]

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Cc: <stable@vger.kernel.org>
Link: http://lore.kernel.org/r/CAHk-=wjSqtXAqfUJxFtWNwmguFASTgB0dz1dT3V-78Quiezqbg@mail.gmail.com
Link: https://lkml.kernel.org/r/160195561680.2163339.11574962055305783722.stgit@dwillia2-desk3.amr.corp.intel.com
2020-10-06 11:18:04 +02:00
..
atomic.h Merge branch 'linus' into locking/core, to resolve conflicts 2017-11-07 10:32:44 +01:00
barrier.h tools: add smp_* barrier variants to include infrastructure 2019-04-11 14:45:50 -07:00
cmpxchg.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cpufeatures.h tools arch x86: Sync asm/cpufeatures.h with the kernel sources 2020-08-07 08:56:59 -03:00
disabled-features.h tools headers x86: Sync disabled-features.h 2020-02-12 12:29:41 -03:00
emulate_prefix.h x86: xen: insn: Decode Xen and KVM emulate-prefix signature 2019-10-17 21:31:57 +02:00
inat_types.h objtool: Move x86 insn decoder to a common location 2019-08-31 22:27:52 -03:00
inat.h perf intel-pt: Use shared x86 insn decoder 2019-08-31 22:27:52 -03:00
insn.h x86: xen: insn: Decode Xen and KVM emulate-prefix signature 2019-10-17 21:31:57 +02:00
irq_vectors.h tools arch x86: Grab a copy of the file containing the IRQ vector defines 2019-10-15 15:42:01 -03:00
msr-index.h tools arch x86: Sync the msr-index.h copy with the kernel sources 2020-08-07 08:45:47 -03:00
orc_types.h objtool: Remove SAVE/RESTORE hints 2020-04-22 10:53:50 +02:00
required-features.h tools/headers: Synchronize kernel ABI headers, v4.17-rc1 2018-04-17 09:47:39 -03:00
rmwcc.h jump_label: move 'asm goto' support test to Kconfig 2019-01-06 09:46:51 +09:00
unistd_32.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
unistd_64.h KVM: selftests: Add demand paging content to the demand paging test 2020-03-16 17:56:48 +01:00