NetBSD Problem Report #38888
From www@NetBSD.org Sun Jun 8 12:50:36 2008
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by narn.NetBSD.org (Postfix) with ESMTP id D53A663B91E
for <gnats-bugs@gnats.netbsd.org>; Sun, 8 Jun 2008 12:50:36 +0000 (UTC)
Message-Id: <20080608125036.A269463B8BC@narn.NetBSD.org>
Date: Sun, 8 Jun 2008 12:50:36 +0000 (UTC)
From: ad@netbsd.org
Reply-To: ad@netbsd.org
To: gnats-bugs@NetBSD.org
Subject: cnputc() has no locking
X-Send-Pr-Version: www-1.0
>Number: 38888
>Category: kern
>Synopsis: cnputc() has no locking
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Jun 08 12:55:00 +0000 2008
>Originator: Andrew Doran
>Release: 4.99.64
>Organization:
The NetBSD Project
>Environment:
n/a
>Description:
cnputc() calls into tty drivers and beyond the printf mutex, no locking
is done.
>How-To-Repeat:
Code inspection.
>Fix:
Something like this maybe? In subr_prf.c:putchar():
if ((flags & TOCONS) && constty == NULL && c != '\0') {
if (!mutex_tryenter(&tty_lock)) {
/* queue character and defer to soft interrupt */;
} else {
(*v_putc)(c);
mutex_exit(&tty_lock);
}
}
We would also need to block out high-level pseudo-dma interrupts
from serial devices. I'm hoping to introduce a pdma_lock to cover
those.
.. also, we would need to avoid taking the locks if in DDB, or if
the system is going down in flames.
(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.