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 master updated. glibc-2.21-560-g213a2be


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, master has been updated
       via  213a2be7b4f08aba6d2e863106fa6c6b123f2360 (commit)
      from  01964dd6638ecd6409d4d63979ba0e93aba742f5 (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://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=213a2be7b4f08aba6d2e863106fa6c6b123f2360

commit 213a2be7b4f08aba6d2e863106fa6c6b123f2360
Author: Torvald Riegel <triegel@redhat.com>
Date:   Fri Jul 3 20:35:26 2015 +0200

    Do not create invalid pointers in C code of string functions.
    
    Some of the x86 string functions create pointers based on input strings
    that may be outside of the input strings.  When this happens in C code,
    the compiler can potentially detect this, leading to warnings in
    application code when those string functions are inlined.  Perform those
    operations in the assembly code instead of the C code to fix this.

diff --git a/ChangeLog b/ChangeLog
index 15deac7..c6c3356 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-07-07  Torvald Riegel  <triegel@redhat.com>
+
+	[BZ #18633]
+	* sysdeps/x86/bits/string.h (__memmove_g): Do not create invalid
+	pointer in C code.
+	(__strcat_c): Likewise.
+	(__strcat_g): Likewise.
+
 2015-07-07  Cyril Hrubis <chrubis@suse.cz>
 
 	[BZ #18592]
diff --git a/NEWS b/NEWS
index 53dea6e..569a7d6 100644
--- a/NEWS
+++ b/NEWS
@@ -25,7 +25,7 @@ Version 2.22
   18496, 18497, 18498, 18502, 18507, 18512, 18513, 18519, 18520, 18522,
   18527, 18528, 18529, 18530, 18532, 18533, 18534, 18536, 18539, 18540,
   18542, 18544, 18545, 18546, 18547, 18549, 18553, 18558, 18569, 18583,
-  18585, 18586, 18592, 18593, 18594, 18602, 18612, 18613, 18619.
+  18585, 18586, 18592, 18593, 18594, 18602, 18612, 18613, 18619, 18633.
 
 * Cache information can be queried via sysconf() function on s390 e.g. with
   _SC_LEVEL1_ICACHE_SIZE as argument.
diff --git a/sysdeps/x86/bits/string.h b/sysdeps/x86/bits/string.h
index a117f6b..4973620 100644
--- a/sysdeps/x86/bits/string.h
+++ b/sysdeps/x86/bits/string.h
@@ -176,13 +176,15 @@ __memmove_g (void *__dest, const void *__src, size_t __n)
 	 "m" ( *(struct { __extension__ char __x[__n]; } *)__src));
   else
     __asm__ __volatile__
-      ("std\n\t"
+      ("decl %1\n\t"
+       "decl %2\n\t"
+       "std\n\t"
        "rep; movsb\n\t"
        "cld"
        : "=&c" (__d0), "=&S" (__d1), "=&D" (__d2),
 	 "=m" ( *(struct { __extension__ char __x[__n]; } *)__dest)
-       : "0" (__n), "1" (__n - 1 + (const char *) __src),
-	 "2" (__n - 1 + (char *) __tmp),
+       : "0" (__n), "1" (__n + (const char *) __src),
+	 "2" (__n + (char *) __tmp),
 	 "m" ( *(struct { __extension__ char __x[__n]; } *)__src));
   return __dest;
 }
@@ -999,9 +1001,10 @@ __strcat_c (char *__dest, const char __src[], size_t __srclen)
      : "cc");
   --__tmp;
 # else
-  register char *__tmp = __dest - 1;
+  register char *__tmp = __dest;
   __asm__ __volatile__
-    ("1:\n\t"
+    ("decl	%0\n\t"
+     "1:\n\t"
      "incl	%0\n\t"
      "cmpb	$0,(%0)\n\t"
      "jne	1b\n"
@@ -1020,10 +1023,11 @@ __STRING_INLINE char *__strcat_g (char *__dest, const char *__src);
 __STRING_INLINE char *
 __strcat_g (char *__dest, const char *__src)
 {
-  register char *__tmp = __dest - 1;
+  register char *__tmp = __dest;
   register char __dummy;
   __asm__ __volatile__
-    ("1:\n\t"
+    ("decl	%1\n\t"
+     "1:\n\t"
      "incl	%1\n\t"
      "cmpb	$0,(%1)\n\t"
      "jne	1b\n"

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

Summary of changes:
 ChangeLog                 |    8 ++++++++
 NEWS                      |    2 +-
 sysdeps/x86/bits/string.h |   18 +++++++++++-------
 3 files changed, 20 insertions(+), 8 deletions(-)


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]