NetBSD Problem Report #48571

From paul@whooppee.com  Tue Feb  4 17:55:08 2014
Return-Path: <paul@whooppee.com>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 8546BA646F
	for <gnats-bugs@gnats.NetBSD.org>; Tue,  4 Feb 2014 17:55:08 +0000 (UTC)
Message-Id: <20140204175506.D275424842A@screamer.whooppee.com>
Date: Tue,  4 Feb 2014 09:55:06 -0800 (PST)
From: paul@whooppee.com
Reply-To: paul@whooppee.com
To: gnats-bugs@NetBSD.org
Subject: config(1) ioconf is insufficient for pseudo-devices
X-Send-Pr-Version: 3.95

>Number:         48571
>Category:       bin
>Synopsis:       config(1) ioconf is insufficient for pseudo-devices
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 04 18:00:00 +0000 2014
>Last-Modified:  Wed Aug 19 03:40:00 +0000 2015
>Originator:     Paul Goyette
>Release:        NetBSD 6.99.28
>Organization:
-------------------------------------------------------------------------
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |                          | pgoyette at netbsd.org  |
-------------------------------------------------------------------------
>Environment:


System: NetBSD screamer.whooppee.com 6.99.28 NetBSD 6.99.28 (WHOOPPEE (shared) 2013-12-14 23:34:52) #13: Sat Dec 14 16:05:43 PST 2013 paul@screamer.whooppee.com:/build/netbsd-local/obj/amd64/sys/arch/amd64/compile/WHOOPPEE amd64
Architecture: x86_64
Machine: amd64
>Description:
The (undocumented) ioconf statement for config(1) generates structs that
are not useable for calling config_{init,fini}_component().

The generated cfattach structure contains only one entry (of two NULL
pointers) to indicate end-of-list.  We need an additional entry that
points the device's cfattach <device>_ca as generated by CFATTACH_DECL*. 
Also, the generated ioconf.c file should include an extern declaration
for the <device>_ca structure.

Additionally, the generated file contains an empty cfdata list, with only
a single NULL entry to terminate the list.  But the first entry of this
list gets passsed by config_init_component() to config_devalloc() and is
dereferenced in order to pass the driver's name to config_cfdriver_lookup().
This results in a panic.

When used for a "real" device, both of these structures are created to
be directly useable by config_{init,fini}_component().

It would be really nice if we could use ioconf structures and calls to
config_{init,fini}_component to standardize device driver modules, even
for pseudo-devices.


>How-To-Repeat:

>Fix:


>Audit-Trail:
From: "Paul Goyette" <pgoyette@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48571 CVS commit: src/usr.bin/config
Date: Wed, 19 Aug 2015 03:39:45 +0000

 Module Name:	src
 Committed By:	pgoyette
 Date:		Wed Aug 19 03:39:45 UTC 2015

 Modified Files:
 	src/usr.bin/config: TODO

 Log Message:
 Insert comment regarding PR/48571 so it doesn't get lost.

 	config(1) ioconf is insufficient for pseudo-devices

 config_{init,fini}_component


 To generate a diff of this commit:
 cvs rdiff -u -r1.17 -r1.18 src/usr.bin/config/TODO

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>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-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.