This is the mail archive of the
mailing list for the glibc project.
Fix MIPS64 memcpy regression
- From: Joseph Myers <joseph at codesourcery dot com>
- To: <libc-alpha at sourceware dot org>, <sellcey at imgtec dot com>
- Date: Thu, 21 Jan 2016 21:53:55 +0000
- Subject: Fix MIPS64 memcpy regression
- Authentication-results: sourceware.org; auth=none
The MIPS memcpy optimizations at
introduced a bug causing many string function tests to fail with
segfaults for n32 and n64:
(Some failures in other directories could also be caused by this bug.)
The problem is that after the check for whether a word of input is
left that can be copied as a word before moving to byte copies, a load
can occur in the branch delay slot, resulting in a segfault if we are
at the end of a page and the following page is unmapped. I don't see
how this would have passed the tests as reported in the original patch
posting (different kernel configurations affecting the code setting up
unmapped pages, maybe?), since the tests in question don't appear to
have changed recently.
This patch adds a nop in the delay slot.
Tested with string/ tests for n32. Will commit subject to full
testing for n32 and n64.
2016-01-21 Joseph Myers <firstname.lastname@example.org>
* sysdeps/mips/memcpy.S (MEMCPY_NAME) [USE_DOUBLE]: Avoid word
load in branch delay slot when less than a word of input left.
diff --git a/sysdeps/mips/memcpy.S b/sysdeps/mips/memcpy.S
index d79e144..9ae0ba6 100644
@@ -565,6 +565,7 @@ L(lastw):
andi t8,a2,3 /* a2 is the remainder past 4 byte chunks. */
Joseph S. Myers