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.10-386-gea547a1


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  ea547a1a6e350b758fcda76b919b3aa774752318 (commit)
      from  5c53736b52d5032171813d813d4a7ad505102b61 (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=ea547a1a6e350b758fcda76b919b3aa774752318

commit ea547a1a6e350b758fcda76b919b3aa774752318
Author: Anders Johansson <ajohansson@novell.com>
Date:   Thu Oct 29 22:18:26 2009 -0700

    Fix a few asserts and IO calls in nscd.
    
    The nscd/*cache.c files contain assert()s, writeall() and sendfileall() calls
    that invalidly use together &dataset->resp and total where either dataset or
    dataset->head.recsize should be used instead one of the components. In the
    writeall() and sendfileall() cases, it is unlikely to matter in practice, but
    the assertions can fail sometimes without a proper reason.

diff --git a/ChangeLog b/ChangeLog
index 3fae505..47241cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-08-18  Anders Johansson  <ajohansson@novell.com>
+
+	* nscd/aicache.c: Fix mixing up dataset and dataset->resp
+	offsets and record sizes in assert()s and response sending.
+	* nscd/grpcache.c: Likewise.
+	* nscd/hstcache.c: Likewise.
+	* nscd/initgrcache.c: Likewise.
+	* nscd/pwdcache.c: Likewise.
+
 2009-10-29  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #10540]
diff --git a/nscd/aicache.c b/nscd/aicache.c
index 524c0a6..992357d 100644
--- a/nscd/aicache.c
+++ b/nscd/aicache.c
@@ -453,13 +453,13 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
 	    {
 	      assert (db->wr_fd != -1);
 	      assert ((char *) &dataset->resp > (char *) db->data);
-	      assert ((char *) &dataset->resp - (char *) db->head + total
+	      assert ((char *) dataset - (char *) db->head + total
 		      <= (sizeof (struct database_pers_head)
 			  + db->head->module * sizeof (ref_t)
 			  + db->head->data_size));
 	      ssize_t written;
 	      written = sendfileall (fd, db->wr_fd, (char *) &dataset->resp
-				     - (char *) db->head, total);
+				     - (char *) db->head, dataset->head.recsize);
 # ifndef __ASSUME_SENDFILE
 	      if (written == -1 && errno == ENOSYS)
 		goto use_write;
@@ -470,7 +470,7 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
 	  use_write:
 # endif
 #endif
-	    writeall (fd, &dataset->resp, total);
+	    writeall (fd, &dataset->resp, dataset->head.recsize);
 	}
 
       goto out;
diff --git a/nscd/grpcache.c b/nscd/grpcache.c
index 184d538..bd101c6 100644
--- a/nscd/grpcache.c
+++ b/nscd/grpcache.c
@@ -295,14 +295,14 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
 	    {
 	      assert (db->wr_fd != -1);
 	      assert ((char *) &dataset->resp > (char *) db->data);
-	      assert ((char *) &dataset->resp - (char *) db->head
+	      assert ((char *) dataset - (char *) db->head
 		      + total
 		      <= (sizeof (struct database_pers_head)
 			  + db->head->module * sizeof (ref_t)
 			  + db->head->data_size));
 	      written = sendfileall (fd, db->wr_fd,
 				     (char *) &dataset->resp
-				     - (char *) db->head, total);
+				     - (char *) db->head, dataset->head.recsize);
 # ifndef __ASSUME_SENDFILE
 	      if (written == -1 && errno == ENOSYS)
 		goto use_write;
@@ -313,7 +313,7 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
 	  use_write:
 # endif
 #endif
-	    written = writeall (fd, &dataset->resp, total);
+	    written = writeall (fd, &dataset->resp, dataset->head.recsize);
 	}
 
       /* Add the record to the database.  But only if it has not been
diff --git a/nscd/hstcache.c b/nscd/hstcache.c
index 51e2273..228f6fd 100644
--- a/nscd/hstcache.c
+++ b/nscd/hstcache.c
@@ -337,7 +337,7 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req,
 	    {
 	      assert (db->wr_fd != -1);
 	      assert ((char *) &dataset->resp > (char *) db->data);
-	      assert ((char *) &dataset->resp - (char *) db->head
+	      assert ((char *) dataset - (char *) db->head
 		      + total
 		      <= (sizeof (struct database_pers_head)
 			  + db->head->module * sizeof (ref_t)
diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c
index c33aaf3..8195b66 100644
--- a/nscd/initgrcache.c
+++ b/nscd/initgrcache.c
@@ -350,14 +350,14 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
 	    {
 	      assert (db->wr_fd != -1);
 	      assert ((char *) &dataset->resp > (char *) db->data);
-	      assert ((char *) &dataset->resp - (char *) db->head
+	      assert ((char *) dataset - (char *) db->head
 		      + total
 		      <= (sizeof (struct database_pers_head)
 			  + db->head->module * sizeof (ref_t)
 			  + db->head->data_size));
 	      written = sendfileall (fd, db->wr_fd,
 				     (char *) &dataset->resp
-				     - (char *) db->head, total);
+				     - (char *) db->head, dataset->head.recsize);
 # ifndef __ASSUME_SENDFILE
 	      if (written == -1 && errno == ENOSYS)
 		goto use_write;
@@ -368,7 +368,7 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
 	  use_write:
 # endif
 #endif
-	    written = writeall (fd, &dataset->resp, total);
+	    written = writeall (fd, &dataset->resp, dataset->head.recsize);
 	}
 
 
diff --git a/nscd/pwdcache.c b/nscd/pwdcache.c
index 2338e7e..75f2221 100644
--- a/nscd/pwdcache.c
+++ b/nscd/pwdcache.c
@@ -290,14 +290,14 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
 	    {
 	      assert (db->wr_fd != -1);
 	      assert ((char *) &dataset->resp > (char *) db->data);
-	      assert ((char *) &dataset->resp - (char *) db->head
+	      assert ((char *) dataset - (char *) db->head
 		      + total
 		      <= (sizeof (struct database_pers_head)
                           + db->head->module * sizeof (ref_t)
                           + db->head->data_size));
 	      written = sendfileall (fd, db->wr_fd,
 				     (char *) &dataset->resp
-				     - (char *) db->head, total);
+				     - (char *) db->head, dataset->head.recsize );
 # ifndef __ASSUME_SENDFILE
 	      if (written == -1 && errno == ENOSYS)
 		goto use_write;
@@ -308,7 +308,7 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
 	  use_write:
 # endif
 #endif
-	    written = writeall (fd, &dataset->resp, total);
+	    written = writeall (fd, &dataset->resp, dataset->head.recsize);
 	}
 
 

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

Summary of changes:
 ChangeLog          |    9 +++++++++
 nscd/aicache.c     |    6 +++---
 nscd/grpcache.c    |    6 +++---
 nscd/hstcache.c    |    2 +-
 nscd/initgrcache.c |    6 +++---
 nscd/pwdcache.c    |    6 +++---
 6 files changed, 22 insertions(+), 13 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]