c6d234
commit 9aaaab7c6e4176e61c59b0a63c6ba906d875dc0e
c6d234
Author: Andreas Schwab <schwab@suse.de>
c6d234
Date:   Tue May 22 10:37:59 2018 +0200
c6d234
c6d234
    Don't write beyond destination in __mempcpy_avx512_no_vzeroupper (bug 23196)
c6d234
    
c6d234
    When compiled as mempcpy, the return value is the end of the destination
c6d234
    buffer, thus it cannot be used to refer to the start of it.
c6d234
c6d234
Conflicts:
c6d234
	sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S
c6d234
c6d234
Change applied to sysdeps/x86_64/multiarch/memcpy-avx512-no-vzeroupper.S
c6d234
instead.
c6d234
c6d234
diff --git a/string/test-mempcpy.c b/string/test-mempcpy.c
c6d234
index 1679e9d11f282c55..7ccce13e71bd10a9 100644
c6d234
--- a/string/test-mempcpy.c
c6d234
+++ b/string/test-mempcpy.c
c6d234
@@ -18,6 +18,7 @@
c6d234
    <http://www.gnu.org/licenses/>.  */
c6d234
 
c6d234
 #define MEMCPY_RESULT(dst, len) (dst) + (len)
c6d234
+#define MIN_PAGE_SIZE 131072
c6d234
 #define TEST_MAIN
c6d234
 #define TEST_NAME "mempcpy"
c6d234
 #include "test-string.h"
c6d234
diff --git a/sysdeps/x86_64/multiarch/memcpy-avx512-no-vzeroupper.S b/sysdeps/x86_64/multiarch/memcpy-avx512-no-vzeroupper.S
c6d234
index 058e871847a77c45..b78710ea9359e129 100644
c6d234
--- a/sysdeps/x86_64/multiarch/memcpy-avx512-no-vzeroupper.S
c6d234
+++ b/sysdeps/x86_64/multiarch/memcpy-avx512-no-vzeroupper.S
c6d234
@@ -333,6 +333,7 @@ L(preloop_large):
c6d234
 	vmovups	(%rsi), %zmm4
c6d234
 	vmovups	0x40(%rsi), %zmm5
c6d234
 
c6d234
+	mov	%rdi, %r11
c6d234
 /* Align destination for access with non-temporal stores in the loop.  */
c6d234
 	mov	%rdi, %r8
c6d234
 	and	$-0x80, %rdi
c6d234
@@ -363,8 +364,8 @@ L(gobble_256bytes_nt_loop):
c6d234
 	cmp	$256, %rdx
c6d234
 	ja	L(gobble_256bytes_nt_loop)
c6d234
 	sfence
c6d234
-	vmovups	%zmm4, (%rax)
c6d234
-	vmovups	%zmm5, 0x40(%rax)
c6d234
+	vmovups	%zmm4, (%r11)
c6d234
+	vmovups	%zmm5, 0x40(%r11)
c6d234
 	jmp	L(check)
c6d234
 
c6d234
 L(preloop_large_bkw):