NetBSD Problem Report #33023

From dyoung@ojctech.com  Tue Mar  7 08:48:46 2006
Return-Path: <dyoung@ojctech.com>
Received: from noam.i.ojctech.com (elmendorf.ojctech.com [64.198.255.10])
	by narn.netbsd.org (Postfix) with ESMTP id 0F1D663B89A
	for <gnats-bugs@gnats.NetBSD.org>; Tue,  7 Mar 2006 08:48:46 +0000 (UTC)
Message-Id: <20060307084840.75AC71C12D3@noam.i.ojctech.com>
Date: Tue,  7 Mar 2006 02:48:40 -0600 (CST)
From: dyoung@ojctech.com
Reply-To: dyoung@ojctech.com
To: gnats-bugs@netbsd.org
Subject: device files behave unexpectedly under union mounts
X-Send-Pr-Version: 3.95

>Number:         33023
>Category:       kern
>Synopsis:       device files behave unexpectedly under union mounts
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 07 08:50:02 +0000 2006
>Originator:     David Young
>Release:        NetBSD 3.99.7
>Organization:
	OJC Technologies
>Environment:


System: NetBSD elmendorf.ojctech.com 3.99.7 NetBSD 3.99.7 (GENERIC) #9: Wed Aug 31 22:47:06 CDT 2005 dyoung@cuw.ojctech.com:/u3/dyoung/radix-nbsd/i386/O/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
If I union-mount a filesystem (e.g., /dev/vnd0a) over a directory
containing device special files (e.g., /dev/), writing to the device
special files (/dev/null) has an unexpected result.  Namely, the
device special file is "copied up" to the top filesystem as a
*regular file*.  For example, if I run 'echo test > /dev/null', a
regular file called 'null' is created in the top layer.  Its contents
are "test\n".
>How-To-Repeat:
Run these commands:

% mkdir foo
% cd foo
% cp /dev/MAKEDEV .
% su root -c "./MAKEDEV std"
% cd ..
% mkdir empty
% makefs -s 1440k -t ffs ./zoom.img ./empty/
% su root -c "vnconfig vnd0 ./zoom.img"
% su root -c "mount -o union /dev/vnd0a ./foo"
% cd foo
% ls -l
total 52
-r-xr-xr-x  1 dyoung  users    25429 Mar  7 02:27 MAKEDEV
crw-------  1 root    wheel    0,  0 Mar  7 02:28 console
crw-------  1 root    wheel    0,  1 Mar  7 02:28 constty
crw-r-----  1 root    kmem     4,  0 Mar  7 02:28 drum
crw-------  1 root    wheel    7,  0 Mar  7 02:28 klog
crw-r-----  1 root    kmem     2,  1 Mar  7 02:28 kmem
cr--r--r--  1 root    wheel  101,  0 Mar  7 02:28 ksyms
crw-r-----  1 root    kmem     2,  0 Mar  7 02:28 mem
crw-rw-rw-  1 root    wheel    2,  2 Mar  7 02:28 null
crw-rw-rw-  1 root    wheel   22,  2 Mar  7 02:28 stderr
crw-rw-rw-  1 root    wheel   22,  0 Mar  7 02:28 stdin
crw-rw-rw-  1 root    wheel   22,  1 Mar  7 02:28 stdout
crw-rw-rw-  1 root    wheel    1,  0 Mar  7 02:28 tty
crw-rw-rw-  1 root    wheel    2, 12 Mar  7 02:28 zero
% echo test > ./null
% ls -l 
total 54
-r-xr-xr-x  1 dyoung  users    25429 Mar  7 02:27 MAKEDEV
crw-------  1 root    wheel    0,  0 Mar  7 02:28 console
crw-------  1 root    wheel    0,  1 Mar  7 02:28 constty
crw-r-----  1 root    kmem     4,  0 Mar  7 02:28 drum
crw-------  1 root    wheel    7,  0 Mar  7 02:28 klog
crw-r-----  1 root    kmem     2,  1 Mar  7 02:28 kmem
cr--r--r--  1 root    wheel  101,  0 Mar  7 02:28 ksyms
crw-r-----  1 root    kmem     2,  0 Mar  7 02:28 mem
-rw-r--r--  1 dyoung  users        5 Mar  7 02:34 null
crw-rw-rw-  1 root    wheel   22,  2 Mar  7 02:28 stderr
crw-rw-rw-  1 root    wheel   22,  0 Mar  7 02:28 stdin
crw-rw-rw-  1 root    wheel   22,  1 Mar  7 02:28 stdout
crw-rw-rw-  1 root    wheel    1,  0 Mar  7 02:28 tty
crw-rw-rw-  1 root    wheel    2, 12 Mar  7 02:28 zero
% ls -l foo
total 52
-r-xr-xr-x  1 dyoung  users    25429 Mar  7 02:27 MAKEDEV
crw-------  1 root    wheel    0,  0 Mar  7 02:28 console
crw-------  1 root    wheel    0,  1 Mar  7 02:28 constty
crw-r-----  1 root    kmem     4,  0 Mar  7 02:28 drum
crw-------  1 root    wheel    7,  0 Mar  7 02:28 klog
crw-r-----  1 root    kmem     2,  1 Mar  7 02:28 kmem
cr--r--r--  1 root    wheel  101,  0 Mar  7 02:28 ksyms
crw-r-----  1 root    kmem     2,  0 Mar  7 02:28 mem
crw-rw-rw-  1 root    wheel    2,  2 Mar  7 02:28 null
crw-rw-rw-  1 root    wheel   22,  2 Mar  7 02:28 stderr
crw-rw-rw-  1 root    wheel   22,  0 Mar  7 02:28 stdin
crw-rw-rw-  1 root    wheel   22,  1 Mar  7 02:28 stdout
crw-rw-rw-  1 root    wheel    1,  0 Mar  7 02:28 tty
crw-rw-rw-  1 root    wheel    2, 12 Mar  7 02:28 zero
>Fix:
I do not know how to fix it.

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.