Subject: kern/37390: dk(4) and minphys()
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <jakllsch@kollasch.net>
List: netbsd-bugs
Date: 11/15/2007 17:05:14
>Number:         37390
>Category:       kern
>Synopsis:       dk interacts badly with sd and maybe dk
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 15 17:05:14 +0000 2007
>Originator:     jakllsch@kollasch.net
>Release:        NetBSD 4.0_RC4
>Organization:
>Environment:
System: NetBSD terminus.kollasch.net 4.0_RC4 NetBSD 4.0_RC4 (TERMINUS) #0: Sat Nov 10 17:37:37 UTC 2007 root@terminus.kollasch.net:/usr/src/sys/arch/i386/compile/TERMINUS i386
Architecture: i386
Machine: i386
>Description:

I've discovered that accessing a dk(4) character device
backed by a sd(4) doesn't work. I believe this may also
be the case with ld(4).

Anyway, the failure happens at the first line of
sdminphys(), it's not returning a valid sd_softc.
I believe bp->b_dev is in this case not a sd(4),
but a dk(4).

>How-To-Repeat:

 1. attach a sd0
 2. attach a sd1
 3. detach sd0
 4. add a wedge (dk0) to sd1 
 5. read from (or write to) /dev/rdk0
 6. see the page fault in sdminphys()

>Fix:

complicated