Date: 30 Dec 1998 17:21:17 -0000 From: jbackus@plex.nl To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: bin/9247: pw/pwd_mkdb deadlock on /etc/master.passwd Message-ID: <19981230172117.1595.qmail@jos.mp-c.com>
next in thread | raw e-mail | index | archive | help
>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19981230172117.1595.qmail>