From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <1b38321dd9fcb942a015fd7101606737@isd.dp.ua> To: 9fans@9fans.net From: yaroslav Date: Wed, 26 Jan 2011 17:16:17 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] passwd(1) over ssh fails: race in telnetd Topicbox-Message-UUID: a16ec942-ead6-11e9-9d60-3106f5b1d025 passwd(1), while started on telnetd-simulated /dev/cons (via ssh), gets killed for writing on closed pipe after "Confirm:" message. I think it is because of close()/open() race in /sys/src/cmd/ip/telnetd.c:/^conssim/+/open/+/consctl/. Readln opens and closes consctl, and when two readln calls are made, next open may be attempted before the daemon reopens of its end of the simulated consctl. A fast workaround is injection of sleep(100) between readln calls in /sys/src/cmd/auth/passwd.c:102. Suggestions for the proper fix? - Iaroslav