From owner-freebsd-bugs Wed Dec 30 10:30:11 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA15381 for freebsd-bugs-outgoing; Wed, 30 Dec 1998 10:30:11 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA15363 for ; Wed, 30 Dec 1998 10:30:09 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id KAA29297; Wed, 30 Dec 1998 10:30:01 -0800 (PST) Received: from gw-nl3.philips.com (gw-nl3.philips.com [192.68.44.35]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA14401 for ; Wed, 30 Dec 1998 10:20:29 -0800 (PST) (envelope-from jbackus@plex.nl) Received: from smtprelay-nl1.philips.com (localhost.philips.com [127.0.0.1]) by gw-nl3.philips.com with ESMTP id TAA14938 for ; Wed, 30 Dec 1998 19:20:09 +0100 (MET) (envelope-from jbackus@plex.nl) Received: from smtprelay-eur1.philips.com(130.139.36.3) by gw-nl3.philips.com via mwrap (4.0a) id xma014936; Wed, 30 Dec 98 19:20:09 +0100 Received: from dibbs1.eur.cis.philips.com (dibbs1.eur.cis.philips.com [130.139.33.66]) by smtprelay-nl1.philips.com (8.8.5/8.6.10-1.2.2m-970826) with ESMTP id TAA19198 for ; Wed, 30 Dec 1998 19:20:08 +0100 (MET) Received: from hal.mpn.cp.philips.com (hal.mpn.cp.philips.com [130.139.64.195]) by dibbs1.eur.cis.philips.com (8.8.8/8.8.8) with SMTP id TAA11957 for ; Wed, 30 Dec 1998 19:20:08 +0100 (MET) Received: (qmail 32467 invoked from network); 30 Dec 1998 18:20:28 -0000 Received: from unknown (HELO jos.mp-c.com) (172.16.121.86) by hal.mpn.cp.philips.com with SMTP; 30 Dec 1998 18:20:28 -0000 Received: (qmail 1596 invoked by uid 1000); 30 Dec 1998 17:21:17 -0000 Message-Id: <19981230172117.1595.qmail@jos.mp-c.com> Date: 30 Dec 1998 17:21:17 -0000 From: jbackus@plex.nl Reply-To: Jos Backus To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/9247: pw/pwd_mkdb deadlock on /etc/master.passwd Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 9247 >Category: bin >Synopsis: One cannot invoke the no-lock function of pwd_mkdb >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Dec 30 10:30:01 PST 1998 >Last-Modified: >Originator: Jos Backus >Organization: Organized? Me? >Release: FreeBSD 3.0-CURRENT i386 >Environment: -current, possibly -stable as of today >Description: pw deadlocks because it doesn't close the open fd it is holding to /etc/master.passwd before forking/exec'ing ``pwd_mkdb -C''. pwd_mkdb subsequently tries to flock /etc/master.passwd exclusively, resulting in deadlock. >How-To-Repeat: # pw useradd -g nofiles -n alias -d /var/qmail/alias -s /bin/false Bingo. You now have to ``killall -9 pwd_mkdb''. kdump output: 1476 pw CALL open(0x804f52c,0x20,0) 1476 pw NAMI "/etc/master.passwd" 1476 pw RET open 4 Note: no intervening close(4). 1476 pw CALL fork 1476 pw RET fork 1477/0x5c5 1476 pw CALL wait4(0x5c5,0xefbfc8f0,0,0) 1477 pw RET fork 0 1477 pw CALL execve(0x80513a7,0xefbfc8f4,0xefbfdb5c) 1477 pw NAMI "/usr/sbin/pwd_mkdb" 1477 pw NAMI "/usr/libexec/ld-elf.so.1" 1477 pwd_mkdb RET execve 0 Note: no intervening close(4). 1477 pwd_mkdb CALL open(0xefbfdc6e,0,0x1b6) 1477 pwd_mkdb NAMI "/etc/master.passwd" 1477 pwd_mkdb RET open 5 1477 pwd_mkdb CALL flock(0x5,0x2) 1476 pw PSIG SIGINT SIG_DFL 1477 pwd_mkdb PSIG SIGKILL SIG_DFL >Fix: This fix makes things work but is of course unacceptable in this form. The problem seems to be that endpwent() doesn't actually close fd 4. pwupd.c.orig Wed Dec 30 18:00:19 1998 pwupd.c Wed Dec 30 18:00:00 1998 -109,6 +109,7 @@ int rc = 0; endpwent(); + close(4); /* * First, let's check the see if the database is alright >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message