FAILED: patch "[PATCH] x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user," failed to apply to 4.9-stable tree
Subsystems (14)
[email protected]
maintainerThe patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From ec6347bb43395cb92126788a1a5b25302543f815 Mon Sep 17 00:00:00 2001
From: Dan Williams <[email protected]>
Date: Mon, 5 Oct 2020 20:40:16 -0700
Subject: [PATCH] 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:
Quoted 11 lines · Linus Torvalds
Quoted 6 lines · Dan Williams
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 makescopy_to_user()work for the wrong reason relative to the name.Right.
Quoted 8 lines
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. ]
arch/powerpc/Kconfig +1 -1
@@ -136,7 +136,7 @@ config PPC select ARCH_HAS_STRICT_KERNEL_RWX if (PPC32 && !HIBERNATION) select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAS_UACCESS_FLUSHCACHE - select ARCH_HAS_UACCESS_MCSAFE if PPC64 + select ARCH_HAS_COPY_MC if PPC64 select ARCH_HAS_UBSAN_SANITIZE_ALL select ARCH_HAVE_NMI_SAFE_CMPXCHG select ARCH_KEEP_MEMBLOCK
arch/powerpc/include/asm/string.h +0 -2
@@ -53,9 +53,7 @@ void *__memmove(void *to, const void *from, __kernel_size_t n);#ifndef CONFIG_KASAN #define __HAVE_ARCH_MEMSET32#define __HAVE_ARCH_MEMSET64 -#define __HAVE_ARCH_MEMCPY_MCSAFE -extern int memcpy_mcsafe (void *dst,const void *src,__kernel_size_t sz);extern void *__memset16 (uint16_t *,uint16_t v,__kernel_size_t );extern void *__memset32 (uint32_t *,uint32_t v,__kernel_size_t );extern void *__memset64 (uint64_t *,uint64_t v,__kernel_size_t );
arch/powerpc/include/asm/uaccess.h +26 -14
@@ -435,6 +435,32 @@ do { \extern unsigned long __copy_tofrom_user (void __user *to,const void __user *from,unsigned long size); +#ifdef CONFIG_ARCH_HAS_COPY_MC +unsigned long __must_check +copy_mc_generic (void *to,const void *from,unsigned long size); + +static inline unsigned long __must_check +copy_mc_to_kernel (void *to,const void *from,unsigned long size) +{ +return copy_mc_generic (to, from, size); +} +#define copy_mc_to_kernel copy_mc_to_kernel + +static inline unsigned long __must_check +copy_mc_to_user (void __user *to,const void *from,unsigned long n) +{ +if (likely (check_copy_size (from, n, true))) { +if (access_ok (to, n)) { +allow_write_to_user (to, n); + n =copy_mc_generic ((void *)to, from, n); +prevent_write_to_user (to, n); + } + } + +return n; +} +#endif +#ifdef __powerpc64__static inline unsigned long raw_copy_in_user (void __user *to,const void __user *from,unsigned long n)
@@ -523,20 +549,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)return ret; } -static __always_inline unsigned long __must_check -copy_to_user_mcsafe (void __user *to,const void *from,unsigned long n) -{ -if (likely (check_copy_size (from, n, true))) { -if (access_ok (to, n)) { -allow_write_to_user (to, n); - n =memcpy_mcsafe ((void *)to, from, n); -prevent_write_to_user (to, n); - } - } - -return n; -} -unsigned long __arch_clear_user (void __user *addr,unsigned long size);static inline unsigned long clear_user (void __user *addr,unsigned long size)
arch/powerpc/lib/Makefile +1 -1
@@ -39,7 +39,7 @@ obj-$(CONFIG_PPC_BOOK3S_64) += copyuser_power7.o copypage_power7.o \ memcpy_power7.o obj64-y += copypage_64.o copyuser_64.o mem_64.o hweight_64.o \ - memcpy_64.o memcpy_mcsafe_64.o + memcpy_64.o copy_mc_64.o ifndef CONFIG_PPC_QUEUED_SPINLOCKS obj64-$(CONFIG_SMP) += locks.o
arch/powerpc/lib/copy_mc_64.S renamed from arch/powerpc/lib/memcpy_mcsafe_64.S +2 -2
@@ -50,7 +50,7 @@ err3; stb r0,0(r3) blr -_GLOBAL(memcpy_mcsafe) +_GLOBAL(copy_mc_generic) mr r7,r5 cmpldi r5,16 blt .Lshort_copy
@@ -239,4 +239,4 @@ err1; stb r0,0(r3) 15: li r3,0 blr -EXPORT_SYMBOL_GPL(memcpy_mcsafe); +EXPORT_SYMBOL_GPL(copy_mc_generic);
arch/x86/Kconfig +1 -1
@@ -75,7 +75,7 @@ config X86 select ARCH_HAS_PTE_DEVMAP if X86_64 select ARCH_HAS_PTE_SPECIAL select ARCH_HAS_UACCESS_FLUSHCACHE if X86_64 - select ARCH_HAS_UACCESS_MCSAFE if X86_64 && X86_MCE + select ARCH_HAS_COPY_MC if X86_64 select ARCH_HAS_SET_MEMORY select ARCH_HAS_SET_DIRECT_MAP select ARCH_HAS_STRICT_KERNEL_RWX
arch/x86/Kconfig.debug +1 -1
@@ -62,7 +62,7 @@ config EARLY_PRINTK_USB_XDBC You should normally say N here, unless you want to debug early crashes or need a very simple printk logging facility. -config MCSAFE_TEST +config COPY_MC_TEST def_bool n config EFI_PGT_DUMP
arch/x86/include/asm/copy_mc_test.h new file +75 -0
75 lines not on this page · raw message
arch/x86/include/asm/mce.h +9 -0
@@ -174,6 +174,15 @@ extern void mce_unregister_decode_chain(struct notifier_block *nb);extern int mce_p5_enabled; +#ifdef CONFIG_ARCH_HAS_COPY_MC +extern void enable_copy_mc_fragile (void ); +unsigned long __must_check copy_mc_fragile (void *dst,const void *src,unsigned cnt); +#else +static inline void enable_copy_mc_fragile (void ) +{ +} +#endif +#ifdef CONFIG_X86_MCE int mcheck_init (void );void mcheck_cpu_init (struct cpuinfo_x86 *c);
arch/x86/include/asm/mcsafe_test.h deleted +0 -75
75 lines not on this page · raw message
arch/x86/include/asm/string_64.h +0 -32
@@ -82,38 +82,6 @@ int strcmp(const char *cs, const char *ct);#endif -#define __HAVE_ARCH_MEMCPY_MCSAFE 1 -__must_check unsigned long __memcpy_mcsafe (void *dst,const void *src, -size_t cnt); -DECLARE_STATIC_KEY_FALSE (mcsafe_key); - -/** -* memcpy_mcsafe - copy memory with indication if a machine check happened -* -* @dst: destination address -* @src: source address -* @cnt: number of bytes to copy -* -* Low level memory copy function that catches machine checks -* We only call into the "safe" function on systems that can -* actually do machine check recovery. Everyone else can just -* use memcpy(). -* -* Return 0 for success, or number of bytes not copied if there was an -* exception. -*/ -static __always_inline __must_check unsigned long -memcpy_mcsafe (void *dst,const void *src,size_t cnt) -{ -#ifdef CONFIG_X86_MCE -if (static_branch_unlikely (&mcsafe_key)) -return __memcpy_mcsafe (dst, src, cnt); - else -#endif -memcpy (dst, src, cnt); -return 0 ; -} -#ifdef CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE #define __HAVE_ARCH_MEMCPY_FLUSHCACHE 1void __memcpy_flushcache (void *dst,const void *src,size_t cnt);
arch/x86/include/asm/uaccess.h +9 -0
@@ -455,6 +455,15 @@ extern __must_check long strnlen_user(const char __user *str, long n);unsigned long __must_check clear_user (void __user *mem,unsigned long len);unsigned long __must_check __clear_user (void __user *mem,unsigned long len); +#ifdef CONFIG_ARCH_HAS_COPY_MC +unsigned long __must_check +copy_mc_to_kernel (void *to,const void *from,unsigned len); +#define copy_mc_to_kernel copy_mc_to_kernel + +unsigned long __must_check +copy_mc_to_user (void *to,const void *from,unsigned len); +#endif +/* * movsl can be slow when source and dest are not both 8-byte aligned */
arch/x86/include/asm/uaccess_64.h +0 -20
@@ -46,22 +46,6 @@ copy_user_generic(void *to, const void *from, unsigned len)return ret; } -static __always_inline __must_check unsigned long -copy_to_user_mcsafe (void *to,const void *from,unsigned len) -{ -unsigned long ret; - -__uaccess_begin (); -/* -* Note, __memcpy_mcsafe() is explicitly used since it can -* handle exceptions / faults. memcpy_mcsafe() may fall back to -* memcpy() which lacks this handling. -*/ - ret =__memcpy_mcsafe (to, from, len); -__uaccess_end (); -return ret; -} -static __always_inline __must_check unsigned long raw_copy_from_user (void *dst,const void __user *src,unsigned long size) {
@@ -102,8 +86,4 @@ __copy_from_user_flushcache(void *dst, const void __user *src, unsigned size)kasan_check_write (dst, size); return __copy_user_flushcache(dst, src, size); } - -unsigned long -mcsafe_handle_tail (char *to,char *from,unsigned len); -#endif /* _ASM_X86_UACCESS_64_H */
arch/x86/kernel/cpu/mce/core.c +2 -6
@@ -40,7 +40,6 @@#include <linux/debugfs.h> #include <linux/irq_work.h> #include <linux/export.h> -#include <linux/jump_label.h> #include <linux/set_memory.h> #include <linux/sync_core.h> #include <linux/task_work.h>
@@ -2124,7 +2123,7 @@ void mce_disable_bank(int bank)and older. * mce=nobootlog Don't log MCEs from before booting. * mce=bios_cmci_threshold Don't program the CMCI threshold -* mce=recovery force enable memcpy_mcsafe() +* mce=recovery force enable copy_mc_fragile() */ static int __init mcheck_enable (char *str) {
@@ -2732,13 +2731,10 @@ static void __init mcheck_debugfs_init(void)static void __init mcheck_debugfs_init (void ) { }#endif -DEFINE_STATIC_KEY_FALSE (mcsafe_key); -EXPORT_SYMBOL_GPL (mcsafe_key); -static int __init mcheck_late_init (void ) {if (mca_cfg.recovery) -static_branch_inc (&mcsafe_key); +enable_copy_mc_fragile ();mcheck_debugfs_init ();
arch/x86/kernel/quirks.c +3 -7
@@ -8,6 +8,7 @@#include <asm/hpet.h> #include <asm/setup.h> +#include <asm/mce.h> #if defined(CONFIG_X86_IO_APIC ) && defined(CONFIG_SMP ) && defined(CONFIG_PCI )
@@ -624,10 +625,6 @@ static void amd_disable_seq_and_redirect_scrub(struct pci_dev *dev)DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_AMD ,PCI_DEVICE_ID_AMD_16H_NB_F3 , amd_disable_seq_and_redirect_scrub); -#if defined(CONFIG_X86_64 ) && defined(CONFIG_X86_MCE ) -#include <linux/jump_label.h> -#include <asm/string_64.h> -/* Ivy Bridge, Haswell, Broadwell */ static void quirk_intel_brickland_xeon_ras_cap (struct pci_dev *pdev) {
@@ -636,7 +633,7 @@ static void quirk_intel_brickland_xeon_ras_cap(struct pci_dev *pdev)pci_read_config_dword (pdev,0x84 , &capid0);if (capid0 &0x10 ) -static_branch_inc (&mcsafe_key); +enable_copy_mc_fragile (); }/* Skylake */
@@ -653,7 +650,7 @@ static void quirk_intel_purley_xeon_ras_cap(struct pci_dev *pdev)* enabled, so memory machine check recovery is also enabled. */ if ((capid0 &0xc0 ) ==0xc0 || (capid5 &0x1e0 )) -static_branch_inc (&mcsafe_key); +enable_copy_mc_fragile (); }DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x0ec3 , quirk_intel_brickland_xeon_ras_cap);
@@ -661,7 +658,6 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2fc0, quirk_intel_brickland_xeon_DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x6fc0 , quirk_intel_brickland_xeon_ras_cap);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x2083 , quirk_intel_purley_xeon_ras_cap);#endif -#endif bool x86_apple_machine;EXPORT_SYMBOL (x86_apple_machine);
arch/x86/lib/Makefile +1 -0
@@ -44,6 +44,7 @@ obj-$(CONFIG_SMP) += msr-smp.o cache-smp.o lib-y := delay.o misc.o cmdline.o cpu.o lib-y += usercopy_$(BITS).o usercopy.o getuser.o putuser.o lib-y += memcpy_$(BITS).o +lib-$(CONFIG_ARCH_HAS_COPY_MC) += copy_mc.o copy_mc_64.o lib-$(CONFIG_INSTRUCTION_DECODER) += insn.o inat.o insn-eval.o lib-$(CONFIG_RANDOMIZE_BASE) += kaslr.o lib-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o
arch/x86/lib/copy_mc.c new file +82 -0
82 lines not on this page · raw message
arch/x86/lib/copy_mc_64.S new file +127 -0
127 lines not on this page · raw message
arch/x86/lib/memcpy_64.S +0 -115
124 lines not on this page · raw message
arch/x86/lib/usercopy_64.c +0 -21
@@ -56,27 +56,6 @@ unsigned long clear_user(void __user *to, unsigned long n) }EXPORT_SYMBOL (clear_user); -/* -* Similar to copy_user_handle_tail, probe for the write fault point, -* but reuse __memcpy_mcsafe in case a new read error is encountered. -* clac() is handled in _copy_to_iter_mcsafe(). -*/ -__visible notrace unsigned long -mcsafe_handle_tail (char *to,char *from,unsigned len) -{ -for (; len; --len, to++, from++) { -/* -* Call the assembly routine back directly since -* memcpy_mcsafe() may silently fallback to memcpy. -*/ -unsigned long rem =__memcpy_mcsafe (to, from,1 ); - -if (rem) -break ; - } -return len; -} -#ifdef CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE /** * clean_cache_range - write back a cache range with CLWB
drivers/md/dm-writecache.c +9 -6
@@ -49,7 +49,7 @@ do { \#define pmem_assign (dest, src) ((dest) = (src))#endif -#if defined(__HAVE_ARCH_MEMCPY_MCSAFE) && defined(DM_WRITECACHE_HAS_PMEM ) +#if IS_ENABLED (CONFIG_ARCH_HAS_COPY_MC ) && defined(DM_WRITECACHE_HAS_PMEM )#define DM_WRITECACHE_HANDLE_HARDWARE_ERRORS #endif
@@ -984,7 +984,8 @@ static void writecache_resume(struct dm_target *ti) } wc->freelist_size =0 ; - r =memcpy_mcsafe (&sb_seq_count, &sb (wc)->seq_count,sizeof (uint64_t )); + r =copy_mc_to_kernel (&sb_seq_count, &sb (wc)->seq_count, +sizeof (uint64_t ));if (r) {writecache_error (wc, r,"hardware memory error when reading superblock: %d" , r); sb_seq_count =cpu_to_le64 (0 );
@@ -1000,7 +1001,8 @@ static void writecache_resume(struct dm_target *ti) e->seq_count =-1 ;continue ; } - r =memcpy_mcsafe (&wme,memory_entry (wc, e),sizeof (struct wc_memory_entry )); + r =copy_mc_to_kernel (&wme,memory_entry (wc, e), +sizeof (struct wc_memory_entry ));if (r) {writecache_error (wc, r,"hardware memory error when reading metadata entry %lu: %d" , (unsigned long )b, r);
@@ -1198,7 +1200,7 @@ static void bio_copy_block(struct dm_writecache *wc, struct bio *bio, void *dataif (rw ==READ ) {int r; - r =memcpy_mcsafe (buf, data, size); + r =copy_mc_to_kernel (buf, data, size);flush_dcache_page (bio_page (bio));if (unlikely (r)) {writecache_error (wc, r,"hardware memory error when reading data: %d" , r);
@@ -2341,7 +2343,7 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv) } } - r =memcpy_mcsafe (&s,sb (wc),sizeof (struct wc_memory_superblock )); + r =copy_mc_to_kernel (&s,sb (wc),sizeof (struct wc_memory_superblock ));if (r) { ti->error ="Hardware memory error when reading superblock" ; goto bad;
@@ -2352,7 +2354,8 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv) ti->error ="Unable to initialize device" ; goto bad; } - r =memcpy_mcsafe (&s,sb (wc),sizeof (struct wc_memory_superblock )); + r =copy_mc_to_kernel (&s,sb (wc), +sizeof (struct wc_memory_superblock ));if (r) { ti->error ="Hardware memory error when reading superblock" ; goto bad;
drivers/nvdimm/claim.c +1 -1
@@ -268,7 +268,7 @@ static int nsio_rw_bytes(struct nd_namespace_common *ndns,if (rw ==READ ) {if (unlikely (is_bad_pmem (&nsio->bb, sector, sz_align)))return -EIO ; -if (memcpy_mcsafe (buf, nsio->addr + offset, size) !=0 ) +if (copy_mc_to_kernel (buf, nsio->addr + offset, size) !=0 )return -EIO ;return 0 ; }
drivers/nvdimm/pmem.c +3 -3
@@ -125,7 +125,7 @@ static blk_status_t read_pmem(struct page *page, unsigned int off,while (len) { mem =kmap_atomic (page); chunk = min_t(unsigned int, len, PAGE_SIZE - off); - rem =memcpy_mcsafe (mem + off, pmem_addr, chunk); + rem =copy_mc_to_kernel (mem + off, pmem_addr, chunk);kunmap_atomic (mem);if (rem)return BLK_STS_IOERR ;
@@ -304,7 +304,7 @@ static long pmem_dax_direct_access(struct dax_device *dax_dev,/* * Use the 'no check' versions of copy_from_iter_flushcache() and -* copy_to_iter_mcsafe() to bypass HARDENED_USERCOPY overhead. Bounds +* copy_mc_to_iter() to bypass HARDENED_USERCOPY overhead. Bounds * checking, both file offset and device offset, is handled by * dax_iomap_actor() */
@@ -317,7 +317,7 @@ static size_t pmem_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff,static size_t pmem_copy_to_iter (struct dax_device *dax_dev,pgoff_t pgoff,void *addr,size_t bytes,struct iov_iter *i) { -return _copy_to_iter_mcsafe (addr, bytes, i); +return _copy_mc_to_iter (addr, bytes, i); }static const struct dax_operations pmem_dax_ops = {
include/linux/string.h +1 -8
@@ -161,20 +161,13 @@ extern int bcmp(const void *,const void *,__kernel_size_t);#ifndef __HAVE_ARCH_MEMCHRextern void *memchr (const void *,int ,__kernel_size_t );#endif -#ifndef __HAVE_ARCH_MEMCPY_MCSAFE -static inline __must_check unsigned long memcpy_mcsafe (void *dst, -const void *src,size_t cnt) -{ -memcpy (dst, src, cnt); -return 0 ; -} -#endif #ifndef __HAVE_ARCH_MEMCPY_FLUSHCACHEstatic inline void memcpy_flushcache (void *dst,const void *src,size_t cnt) {memcpy (dst, src, cnt); }#endif +void *memchr_inv (const void *s,int c,size_t n);char *strreplace (char *s,char old,char new);
include/linux/uaccess.h +13 -0
@@ -179,6 +179,19 @@ copy_in_user(void __user *to, const void __user *from, unsigned long n) }#endif +#ifndef copy_mc_to_kernel +/* +* Without arch opt-in this generic copy_mc_to_kernel() will not handle +* #MC (or arch equivalent) during source read. +*/ +static inline unsigned long __must_check +copy_mc_to_kernel (void *dst,const void *src,size_t cnt) +{ +memcpy (dst, src, cnt); +return 0 ; +} +#endif + static __always_inline void pagefault_disabled_inc(void) { current->pagefault_disabled++;
include/linux/uio.h +5 -5
@@ -185,10 +185,10 @@ size_t _copy_from_iter_flushcache(void *addr, size_t bytes, struct iov_iter *i);#define _copy_from_iter_flushcache _copy_from_iter_nocache#endif -#ifdef CONFIG_ARCH_HAS_UACCESS_MCSAFE -size_t _copy_to_iter_mcsafe (const void *addr,size_t bytes,struct iov_iter *i); +#ifdef CONFIG_ARCH_HAS_COPY_MC +size_t _copy_mc_to_iter (const void *addr,size_t bytes,struct iov_iter *i);#else -#define _copy_to_iter_mcsafe _copy_to_iter +#define _copy_mc_to_iter _copy_to_iter#endif static __always_inline __must_check
@@ -201,12 +201,12 @@ size_t copy_from_iter_flushcache(void *addr, size_t bytes, struct iov_iter *i) }static __always_inline __must_check -size_t copy_to_iter_mcsafe(void *addr, size_t bytes, struct iov_iter *i) +size_t copy_mc_to_iter(void *addr, size_t bytes, struct iov_iter *i) {if (unlikely (!check_copy_size (addr, bytes, true)))return 0 ;else -return _copy_to_iter_mcsafe (addr, bytes, i); +return _copy_mc_to_iter (addr, bytes, i); }size_t iov_iter_zero (size_t bytes,struct iov_iter *);
lib/Kconfig +6 -1
@@ -635,7 +635,12 @@ config UACCESS_MEMCPY config ARCH_HAS_UACCESS_FLUSHCACHE bool -config ARCH_HAS_UACCESS_MCSAFE +# arch has a concept of a recoverable synchronous exception due to a +# memory-read error like x86 machine-check or ARM data-abort, and +# implements copy_mc_to_{user,kernel} to abort and report +# 'bytes-transferred' if that exception fires when accessing the source +# buffer. +config ARCH_HAS_COPY_MC bool # Temporary. Goes away when all archs are cleaned up
lib/iov_iter.c +23 -25
117 lines not on this page · raw message
tools/arch/x86/include/asm/mcsafe_test.h deleted +0 -13
@@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _MCSAFE_TEST_H_ -#define _MCSAFE_TEST_H_ - -.macro MCSAFE_TEST_CTL -.endm - -.macro MCSAFE_TEST_SRC reg count target -.endm - -.macro MCSAFE_TEST_DST reg count target -.endm -#endif /* _MCSAFE_TEST_H_ */
tools/arch/x86/lib/memcpy_64.S +0 -115
124 lines not on this page · raw message
tools/objtool/check.c +2 -2
@@ -548,8 +548,8 @@ static const char *uaccess_safe_builtin[] = {"__ubsan_handle_shift_out_of_bounds" ,/* misc */ "csum_partial_copy_generic" , -"__memcpy_mcsafe" , -"mcsafe_handle_tail" , +"copy_mc_fragile" , +"copy_mc_fragile_handle_tail" ,"ftrace_likely_update" ,/* CONFIG_TRACE_BRANCH_PROFILING */ NULL };
tools/perf/bench/Build +0 -1
@@ -13,7 +13,6 @@ perf-y += synthesize.o perf-y += kallsyms-parse.o perf-y += find-bit-bench.o -perf-$(CONFIG_X86_64) += mem-memcpy-x86-64-lib.o perf-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o perf-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o
tools/perf/bench/mem-memcpy-x86-64-lib.c deleted +0 -24
@@ -1,24 +0,0 @@ -/* -* From code in arch/x86/lib/usercopy_64.c, copied to keep tools/ copy -* of the kernel's arch/x86/lib/memcpy_64.s used in 'perf bench mem memcpy' -* happy. -*/ -#include <linux/types.h> - -unsigned long __memcpy_mcsafe (void *dst,const void *src,size_t cnt); -unsigned long mcsafe_handle_tail (char *to,char *from,unsigned len); - -unsigned long mcsafe_handle_tail (char *to,char *from,unsigned len) -{ -for (; len; --len, to++, from++) { -/* -* Call the assembly routine back directly since -* memcpy_mcsafe() may silently fallback to memcpy. -*/ -unsigned long rem =__memcpy_mcsafe (to, from,1 ); - -if (rem) -break ; - } -return len; -}
tools/testing/nvdimm/test/nfit.c +25 -24
111 lines not on this page · raw message
tools/testing/selftests/powerpc/copyloops/.gitignore +1 -1
@@ -12,4 +12,4 @@ memcpy_p7_t1 copyuser_64_exc_t0 copyuser_64_exc_t1 copyuser_64_exc_t2 -memcpy_mcsafe_64 +copy_mc_64
tools/testing/selftests/powerpc/copyloops/Makefile +3 -3
@@ -12,7 +12,7 @@ ASFLAGS = $(CFLAGS) -Wa,-mpower4 TEST_GEN_PROGS := copyuser_64_t0 copyuser_64_t1 copyuser_64_t2 \ copyuser_p7_t0 copyuser_p7_t1 \ memcpy_64_t0 memcpy_64_t1 memcpy_64_t2 \ - memcpy_p7_t0 memcpy_p7_t1 memcpy_mcsafe_64 \ + memcpy_p7_t0 memcpy_p7_t1 copy_mc_64 \ copyuser_64_exc_t0 copyuser_64_exc_t1 copyuser_64_exc_t2 EXTRA_SOURCES := validate.c ../harness.c stubs.S
@@ -45,9 +45,9 @@ $(OUTPUT)/memcpy_p7_t%: memcpy_power7.S $(EXTRA_SOURCES) -D SELFTEST_CASE=$(subst memcpy_p7_t,,$(notdir $@)) \ -o $@ $^ -$(OUTPUT)/memcpy_mcsafe_64: memcpy_mcsafe_64.S $(EXTRA_SOURCES) +$(OUTPUT)/copy_mc_64: copy_mc_64.S $(EXTRA_SOURCES) $(CC) $(CPPFLAGS) $(CFLAGS) \ - -D COPY_LOOP=test_memcpy_mcsafe \ + -D COPY_LOOP=test_copy_mc_generic \ -o $@ $^ $(OUTPUT)/copyuser_64_exc_t%: copyuser_64.S exc_validate.c ../harness.c \
tools/testing/selftests/powerpc/copyloops/copy_mc_64.S new file +1 -0
@@ -0,0 +1 @@ +../../../../../arch/powerpc/lib/copy_mc_64.S
tools/testing/selftests/powerpc/copyloops/memcpy_mcsafe_64.S deleted +0 -1
@@ -1 +0,0 @@ -../../../../../arch/powerpc/lib/memcpy_mcsafe_64.S