This is the mail archive of the glibc-bugs@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]

[Bug nscd/5112] New: nscd segfaults when forking for paranoia mode when not caching all requests


When nscd is running with paranoia mode enabled and one of the caching databases
is disabled it will segfault when it is preparing to fork during paranoia mode.
 This is because the code in the paranoia function assumes that all databases
are in use.  It attempts to dereference uninitialized pointer in the disabled
database.  This problem used to occur during regular termination, in
termination_handler in nscd.c, but it was fixed by
http://sourceware.org/ml/libc-hacker/2005-02/msg00006.html.  While the code in
connections.c looks like a copy of termination_handler, this fix did not get
moved as well.

Here is a patch that adds the check to static void restart (void) in
connections.c.  While I'm not sure if this is the correct way to fix it, since
the code looks copied from the other function, it seems appropriate that the fix
would work in connections.c as well.  This patch is against the CVS version.
--- libc/nscd/connections.c.orig        2007-10-04 17:38:32.000000000 -0700
+++ libc/nscd/connections.c     2007-10-04 17:39:02.000000000 -0700
@@ -1285,6 +1285,9 @@
   /* Synchronize memory.  */
   for (int cnt = 0; cnt < lastdb; ++cnt)
     {
+      if (!dbs[cnt].enabled)
+       continue;
+
       /* Make sure nobody keeps using the database.  */
       dbs[cnt].head->timestamp = 0;

-- 
           Summary: nscd segfaults when forking for paranoia mode when not
                    caching all requests
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nscd
        AssignedTo: drepper at redhat dot com
        ReportedBy: bldewolf at csupomona dot edu
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=5112

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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