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.17-396-g58a1335


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  58a1335e76a553e1cf4edeebc27f16fc9b53d6e6 (commit)
      from  bb48a26acf98a377a0ec235d127311ae4fbfb623 (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=58a1335e76a553e1cf4edeebc27f16fc9b53d6e6

commit 58a1335e76a553e1cf4edeebc27f16fc9b53d6e6
Author: Petr Baudis <pasky@ucw.cz>
Date:   Thu Mar 14 01:16:53 2013 +0100

    Fix __times() handling of EFAULT when buf is NULL

diff --git a/ChangeLog b/ChangeLog
index c4cb2c8..9e7be29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-03-14  Petr Baudis  <pasky@ucw.cz>
+
+	* sysdeps/unix/sysv/linux/times.c (__times): On EFAULT, test
+	for non-NULL pointer before the memory validity test. Pointed
+	out by Holger Brunck <holger.brunck@keymile.com>.
+
 2013-03-13  Andreas Schwab  <schwab@suse.de>
 
 	* extra-lib.mk (extra-objs): Add static-only-routines as .oS
diff --git a/sysdeps/unix/sysv/linux/times.c b/sysdeps/unix/sysv/linux/times.c
index f3b5f01..e59bb4e 100644
--- a/sysdeps/unix/sysv/linux/times.c
+++ b/sysdeps/unix/sysv/linux/times.c
@@ -26,13 +26,14 @@ __times (struct tms *buf)
   INTERNAL_SYSCALL_DECL (err);
   clock_t ret = INTERNAL_SYSCALL (times, err, 1, buf);
   if (INTERNAL_SYSCALL_ERROR_P (ret, err)
-      && __builtin_expect (INTERNAL_SYSCALL_ERRNO (ret, err) == EFAULT, 0))
+      && __builtin_expect (INTERNAL_SYSCALL_ERRNO (ret, err) == EFAULT, 0)
+      && buf)
     {
       /* This might be an error or not.  For architectures which have
 	 no separate return value and error indicators we cannot
 	 distinguish a return value of -1 from an error.  Do it the
-	 hard way.  We crash applications which pass in an invalid BUF
-	 pointer.  */
+	 hard way.  We crash applications which pass in an invalid
+	 non-NULL BUF pointer.  Linux allows BUF to be NULL. */
 #define touch(v) \
       do {								      \
 	clock_t temp = v;						      \
@@ -44,7 +45,8 @@ __times (struct tms *buf)
       touch (buf->tms_cutime);
       touch (buf->tms_cstime);
 
-      /* If we come here the memory is valid and the kernel did not
+      /* If we come here the memory is valid (or BUF is NULL, which is
+       * a valid condition for the kernel syscall) and the kernel did not
 	 return an EFAULT error.  Return the value given by the kernel.  */
     }
 

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

Summary of changes:
 ChangeLog                       |    6 ++++++
 sysdeps/unix/sysv/linux/times.c |   10 ++++++----
 2 files changed, 12 insertions(+), 4 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]