NetBSD Problem Report #46613

From www@NetBSD.org  Mon Jun 18 03:22:02 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id F325963B955
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 18 Jun 2012 03:22:01 +0000 (UTC)
Message-Id: <20120618032201.56BF563B8CC@www.NetBSD.org>
Date: Mon, 18 Jun 2012 03:22:01 +0000 (UTC)
From: uwe@NetBSD.org
Reply-To: uwe@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: syslogd is broken
X-Send-Pr-Version: www-1.0

>Number:         46613
>Category:       bin
>Synopsis:       syslogd is broken
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 18 03:25:00 +0000 2012
>Closed-Date:    
>Last-Modified:  Tue Jun 19 23:06:10 +0000 2012
>Originator:     Valery Ushakov
>Release:        current as of 2012-06-17
>Organization:
>Environment:
>Description:
After installing new current on my machine I see when booting:

Starting syslogd.
Jun 18 06:19:48 felix /netbsd: Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
Jun 18 06:19:48 felix /netbsd:    2006, 2007, 2008, 2009, 2010, 2011
[...etc...]

After some digging around I tracked it to usr.sbin/syslogd/syslogd.c at 

revision 1.108
date: 2012/06/05 19:33:17;  author: christos;  state: Exp;  lines: +58 -13
Open and write to ttys using non-blocking I/O to prevent DoS when hardware
or software flow control prevents tty writes or when the tty line is too
slow to respond.

One of the hunks in cfline() does

-               if ((f->f_file = open(p, O_WRONLY|O_APPEND, 0)) < 0) {
+               if (isatty(f->f_file)) {
[...]
+               if ((f->f_file = open(p, O_WRONLY|O_APPEND|flags, 0)) < 0) {

In other words, it now checks isatty(f_file) *before* it opens it.


All sort of bad things follow...

>How-To-Repeat:
Boot current.
>Fix:
Redo that change to cfline.

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 19 Jun 2012 06:30:17 +0000
State-Changed-Why:
christos fixed it today


From: "Valeriy E. Ushakov" <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/46613 (syslogd is broken)
Date: Tue, 19 Jun 2012 16:10:54 +0400

 On Tue, Jun 19, 2012 at 06:30:19 +0000, dholland@NetBSD.org wrote:

 > State-Changed-From-To: open->closed
 > State-Changed-By: dholland@NetBSD.org
 > State-Changed-When: Tue, 19 Jun 2012 06:30:17 +0000
 > State-Changed-Why:
 > christos fixed it today

 There's still something wrong with the new async code it seems, since
 I see

 Jun 19 15:56:42 felix syslogd[119]: /dev/console: Invalid argument

 logged to /var/log/messages when I mistype root password when I log in
 from console.  After that syslogd seems to give up on console - there
 are no more

 Jun 19 16:08:10 felix login: 1 LOGIN FAILURE ON console

 messages printed on console and according to fstat syslogd has closed
 its console fd.

 -uwe

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, 
	uwe@NetBSD.org
Cc: 
Subject: Re: bin/46613 (syslogd is broken)
Date: Tue, 19 Jun 2012 09:23:21 -0400

 On Jun 19,  1:20pm, uwe@stderr.spb.ru ("Valeriy E. Ushakov") wrote:
 -- Subject: Re: bin/46613 (syslogd is broken)

 |  There's still something wrong with the new async code it seems, since
 |  I see
 |  
 |  Jun 19 15:56:42 felix syslogd[119]: /dev/console: Invalid argument
 |  
 |  logged to /var/log/messages when I mistype root password when I log in
 |  from console.  After that syslogd seems to give up on console - there
 |  are no more
 |  
 |  Jun 19 16:08:10 felix login: 1 LOGIN FAILURE ON console
 |  
 |  messages printed on console and according to fstat syslogd has closed
 |  its console fd.

 Ok, I will take a look, thanks.

 christos

From: "Valeriy E. Ushakov" <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/46613 (syslogd is broken)
Date: Tue, 19 Jun 2012 17:23:41 +0400

 On Tue, Jun 19, 2012 at 16:10:54 +0400, Valeriy E. Ushakov wrote:

 > There's still something wrong with the new async code it seems, since
 > I see
 > 
 > Jun 19 15:56:42 felix syslogd[119]: /dev/console: Invalid argument
 > 
 > logged to /var/log/messages when I mistype root password when I log in
 > from console.  After that syslogd seems to give up on console - there
 > are no more
 > 
 > Jun 19 16:08:10 felix login: 1 LOGIN FAILURE ON console
 > 
 > messages printed on console and according to fstat syslogd has closed
 > its console fd.

 writev1 logic seems to be botched, I didn't have time to debug it in
 details, but on the second iteration iov is moved past the valid array
 and writev returns EINVAL, causing the descriptor to get closed.

 -uwe

State-Changed-From-To: closed->open
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 19 Jun 2012 23:06:10 +0000
State-Changed-Why:
another problem appeared


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.