This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, hjl/x32/release/2.15, updated. glibc-2.15-124-ga924047


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, hjl/x32/release/2.15 has been updated
       via  a924047473718dd3f14894aadfd1a24e704b0bfe (commit)
      from  41a996aafa6d26523963ef0d5a9c3c9f94985eb0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a924047473718dd3f14894aadfd1a24e704b0bfe

commit a924047473718dd3f14894aadfd1a24e704b0bfe
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Jun 14 09:58:43 2012 -0700

    Use RAX_LP/RDX_LP on SAVE_PTR in x86_64 strtok.S
    
    cherry-pick 49bdf4c19d35c8ae4070699dc0267db3b9a7d79c

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index e088046..54fd015 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,3 +1,11 @@
+2012-06-14  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #14229]
+	* string/Makefile (tests): Add tst-strtok_r.
+	* string/tst-strtok_r.c: New file.
+	* sysdeps/x86_64/strtok.S: Use LP_SIZE on save_ptr and use
+	RAX_LP/RDX_LP on SAVE_PTR.
+
 2012-05-26  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S: Use R*_LP
diff --git a/string/Makefile b/string/Makefile
index 459cf81..b637bd2 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -57,7 +57,7 @@ tests		:= tester inl-tester noinl-tester testcopy test-ffs	\
 		   tst-strtok tst-strxfrm bug-strcoll1 tst-strfry	\
 		   bug-strtok1 $(addprefix test-,$(strop-tests))	\
 		   bug-envz1 tst-strxfrm2 tst-endian tst-svc2		\
-		   bug-strstr1 bug-strchr1
+		   bug-strstr1 bug-strchr1 tst-strtok_r
 distribute	:= memcopy.h pagecopy.h tst-svc.expect test-string.h	\
 		   str-two-way.h
 
diff --git a/string/tst-strtok_r.c b/string/tst-strtok_r.c
new file mode 100644
index 0000000..5f1cee3
--- /dev/null
+++ b/string/tst-strtok_r.c
@@ -0,0 +1,38 @@
+/* Test strtok_r regression for BZ #14229.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define TEST_MAIN
+#define BUF1PAGES 1
+#include "test-string.h"
+
+int
+test_main (void)
+{
+  char line[] = "udf 75868 1 - Live 0xffffffffa0bfb000\n";
+  char **saveptrp;
+  char *tok;
+
+  test_init ();
+
+  /* Check strtok_r won't write beyond the size of (*saveptrp).  */
+  saveptrp = (char **) (buf1 + page_size - sizeof (*saveptrp));
+  tok = strtok_r (line, " \t", saveptrp);
+  return strcmp (tok, "udf") != 0;
+}
+
+#include "../test-skeleton.c"
diff --git a/sysdeps/x86_64/strtok.S b/sysdeps/x86_64/strtok.S
index 4037f0b..d0b69a9 100644
--- a/sysdeps/x86_64/strtok.S
+++ b/sysdeps/x86_64/strtok.S
@@ -1,6 +1,6 @@
 /* strtok (str, delim) -- Return next DELIM separated token from STR.
    For AMD x86-64.
-   Copyright (C) 1998,2000-2003,2005,2006 Free Software Foundation, Inc.
+   Copyright (C) 1998-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Based on i686 version contributed by Ulrich Drepper
    <drepper@cygnus.com>, 1998.
@@ -46,9 +46,9 @@
 	.bss
 	.local save_ptr
 	ASM_TYPE_DIRECTIVE (save_ptr, @object)
-	.size save_ptr, 8
+	.size save_ptr, LP_SIZE
 save_ptr:
-	.space 8
+	.space LP_SIZE
 
 # ifdef PIC
 #  define SAVE_PTR save_ptr(%rip)
@@ -80,13 +80,12 @@ ENTRY (BP_SYM (FUNCTION))
 
 #ifdef USE_AS_STRTOK_R
 	/* The value is stored in the third argument.  */
-	movq %rdx, %rax
-	movq %rdx, %r9		/* Save value - see def. of SAVE_PTR.  */
-	movq (%rax), %rax
+	mov %RDX_LP, %R9_LP	/* Save value - see def. of SAVE_PTR.  */
+	mov (%rdx), %RAX_LP
 #else
 	/* The value is in the local variable defined above.  But
 	   we have to take care for PIC code.  */
-	movq SAVE_PTR, %rax
+	mov SAVE_PTR, %RAX_LP
 #endif
 	movq %r8, %rdx		/* Get start of string.  */
 
@@ -195,7 +194,7 @@ L(8):	cmpq %rax, %rdx
 	cmovne %rcx, %rdx
 
 	/* Store the pointer to the next character.  */
-	movq %rdx, SAVE_PTR
+	mov %RDX_LP, SAVE_PTR
 
 L(epilogue):
 	/* Remove the stopset table.  */
@@ -206,7 +205,7 @@ L(epilogue):
 L(returnNULL):
 	xorl %eax, %eax
 	/* Store the pointer to the next character.  */
-	movq %rdx, SAVE_PTR
+	mov %RDX_LP, SAVE_PTR
 	jmp L(epilogue)
 
 END (BP_SYM (FUNCTION))

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog.x32                            |    8 +++++++
 string/Makefile                          |    2 +-
 string/{test-stpcpy.c => tst-strtok_r.c} |   33 +++++++++++++++--------------
 sysdeps/x86_64/strtok.S                  |   17 +++++++--------
 4 files changed, 34 insertions(+), 26 deletions(-)
 copy string/{test-stpcpy.c => tst-strtok_r.c} (54%)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]