Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Aug 2001 08:44:43 -0700 (PDT)
From:      Russell Cattelan <cattelan@thebarn.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/29808: ypserv dumps core in yp_find_db
Message-ID:  <200108171544.f7HFihX74733@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         29808
>Category:       bin
>Synopsis:       ypserv dumps core in yp_find_db
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Aug 17 08:50:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Russell Cattelan
>Release:        
>Organization:
Digital Elves Inc.
>Environment:
FreeBSD congo.borg.umn.edu 4.3-STABLE FreeBSD 4.3-STABLE #1: Wed Jun 20 19:16:17 CDT 2001     root@congo.borg.umn.edu:/.amd_mnt/tigris/export/barn/build/src4/sys/compile/CONGO  i386

>Description:
This machine is a slave server to an IRIX ypmaster server.
Every once in a while the ypserv process will core with
either qptr or qptr->dbptr being NULL.
The simple fix it so add checks for NULL but 
given this is a circular list how could these
pointers end up NULL?



#0  yp_find_db (name=0xbfbfe3dc "lcse-c/services", key=0x0, size=0)
    at /.amd_mnt/tigris/export/barn/build/src4/usr.sbin/ypserv/yp_dblookup.c:335
335                     if (qptr->dbptr && !strcmp(qptr->dbptr->name, name)) {
(gdb) ping qptr
Undefined command: "ping".  Try "help".
(gdb) print qptr
$1 = (struct circleq_entry *) 0x0
(gdb) list
330     /.amd_mnt/tigris/export/barn/build/src4/usr.sbin/ypserv/yp_dblookup.c: No such file o
r directory.
(gdb) dir /usr/src//usr.sbin/ypserv/
Source directories searched: /usr/src//usr.sbin/ypserv:$cdir:$cwd
(gdb) list
330     {
331             register struct circleq_entry *qptr;
332
333             for (qptr = qhead.cqh_first; qptr != (void *)&qhead;
334                                                     qptr = qptr->links.cqe_next) {
335                     if (qptr->dbptr && !strcmp(qptr->dbptr->name, name)) {
336                             if (size) {
337                                     if (size != qptr->dbptr->size ||
338                                        strncmp(qptr->dbptr->key, key, size))
339                                             continue;
(gdb) quit

>How-To-Repeat:

>Fix:
Index: yp_dblookup.c
===================================================================
RCS file: /home/cattelan/FreeBSD-CVS/src/usr.sbin/ypserv/yp_dblookup.c,v
retrieving revision 1.17
diff -c -r1.17 yp_dblookup.c
*** yp_dblookup.c       1999/08/28 01:21:11     1.17
--- yp_dblookup.c       2001/08/17 15:34:55
***************
*** 234,245 ****
--- 234,250 ----
  
        for (qptr = qhead.cqh_first; qptr != (void *)&qhead;
                                                qptr = qptr->links.cqe_next) {
+         if (qptr->dbptr && qptr->dbptr->name){
                if (!strcmp(qptr->dbptr->name, buf)) {
                        if (qptr->dbptr->flags & flag)
                                return(1);
                        else
                                return(0);
                }
+         } else {
+           fprintf(stderr,"got null qptr->dbptr or -> name\n");
+           return(0);
+         }
        }
  
        if (yp_open_db_cache(domain, map, NULL, 0) == NULL)
***************
*** 327,333 ****
  
        for (qptr = qhead.cqh_first; qptr != (void *)&qhead;
                                                qptr = qptr->links.cqe_next) {
!               if (!strcmp(qptr->dbptr->name, name)) {
                        if (size) {
                                if (size != qptr->dbptr->size ||
                                   strncmp(qptr->dbptr->key, key, size))
--- 332,338 ----
  
        for (qptr = qhead.cqh_first; qptr != (void *)&qhead;
                                                qptr = qptr->links.cqe_next) {
!               if (qptr && qptr->dbptr && !strcmp(qptr->dbptr->name, name)) {
                        if (size) {
                                if (size != qptr->dbptr->size ||
                                   strncmp(qptr->dbptr->key, key, size))

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200108171544.f7HFihX74733>