linux/arch
David S. Miller 62268585e5 sparc64: Fix several bugs in memmove().
[ Upstream commit 2077cef4d5 ]

Firstly, handle zero length calls properly.  Believe it or not there
are a few of these happening during early boot.

Next, we can't just drop to a memcpy() call in the forward copy case
where dst <= src.  The reason is that the cache initializing stores
used in the Niagara memcpy() implementations can end up clearing out
cache lines before we've sourced their original contents completely.

For example, considering NG4memcpy, the main unrolled loop begins like
this:

     load   src + 0x00
     load   src + 0x08
     load   src + 0x10
     load   src + 0x18
     load   src + 0x20
     store  dst + 0x00

Assume dst is 64 byte aligned and let's say that dst is src - 8 for
this memcpy() call.  That store at the end there is the one to the
first line in the cache line, thus clearing the whole line, which thus
clobbers "src + 0x28" before it even gets loaded.

To avoid this, just fall through to a simple copy only mildly
optimized for the case where src and dst are 8 byte aligned and the
length is a multiple of 8 as well.  We could get fancy and call
GENmemcpy() but this is good enough for how this thing is actually
used.

Reported-by: David Ahern <david.ahern@oracle.com>
Reported-by: Bob Picco <bpicco@meloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
History 2015-03-24 08:22:10 -04:00
..
alpha vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
arc ARC: Fix KSTK_ESP() 2015-03-14 15:37:27 -04:00
arm hx4700: regulator: declare full constraints 2015-03-06 14:53:03 -08:00
arm64 arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian 2015-03-06 14:53:03 -08:00
avr32 vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
blackfin Merge branch 'for-3.18-consistent-ops' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu 2014-10-15 07:48:18 +02:00
c6x irq_work: Introduce arch_irq_work_has_interrupt() 2014-09-13 18:38:07 +02:00
cris vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
frv vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
hexagon Merge branch 'locking-arch-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-10-13 15:48:00 +02:00
ia64 vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
m32r vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
m68k vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
metag metag: Fix KSTK_EIP() and KSTK_ESP() macros 2015-03-06 14:53:04 -08:00
microblaze vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
mips KVM: MIPS: Fix trace event to save PC directly 2015-03-14 15:37:22 -04:00
mn10300 vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
openrisc vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
parisc vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
powerpc cxl: Fix device_node reference counting 2015-03-23 21:02:54 -04:00
s390 KVM: s390: avoid memory leaks if __inject_vm() fails 2015-03-06 14:53:03 -08:00
score vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
sh vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
sparc sparc64: Fix several bugs in memmove(). 2015-03-24 08:22:10 -04:00
tile vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
um vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
unicore32 nosave: consolidate __nosave_{begin,end} in <asm/sections.h> 2014-10-09 22:26:04 -04:00
x86 KVM: emulate: fix CMPXCHG8B on 32-bit hosts 2015-03-14 15:37:22 -04:00
xtensa vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
.gitignore arch: Ignore arch/i386 and arch/x86_64 2008-01-19 21:29:39 -08:00
Kconfig seccomp: Document two-phase seccomp and arch-provided seccomp_data 2014-09-03 14:58:17 -07:00