NetBSD Problem Report #35327

From christianbiere@gmx.de  Wed Dec 27 00:42:04 2006
Return-Path: <christianbiere@gmx.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 8C18063B8C9
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 27 Dec 2006 00:42:04 +0000 (UTC)
Message-Id: <20061227004754.GA22392@cyclonus>
Date: Wed, 27 Dec 2006 01:47:55 +0100
From: Christian Biere <christianbiere@gmx.de>,
	Christian Biere <christianbiere@gmx.de>
To: gnats-bugs@NetBSD.org
Subject: mount ignores read-only flag
X-Send-Pr-Version: 3.95

>Number:         35327
>Category:       kern
>Synopsis:       mount ignores read-only flag
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    yamt
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 27 00:45:00 +0000 2006
>Closed-Date:    Mon Jan 01 23:40:05 +0000 2007
>Last-Modified:  Mon Feb 28 03:32:20 +0000 2011
>Originator:     Christian Biere
>Release:        NetBSD 4.99.7
>Organization:

>Environment:
System: NetBSD cyclonus 4.99.7 NetBSD 4.99.7 (STARSCREAM) #0: Tue Dec 26 16:14:48 CET 2006 src@cyclonus:/o/NetBSD/obj/sys/arch/i386/compile/STARSCREAM i386
Architecture: i386
Machine: i386
>Description:
As with sources of today, the read-only flag in /etc/fstab is ignored. The only
thing I updated was the kernel, so it's seemingly a kernel bug. My userland was
compiled and updated September 30th.
>How-To-Repeat:

$ grep wd0m /etc/fstab
/dev/wd0m    /s           ffs    ro,noatime,nodev,nosuid,noexec,softdep	   0 2

$ /sbin/mount | grep wd0m
/dev/wd0m on /s type ffs (noexec, nosuid, nodev, noatime, soft dependencies, local)

This is not a display glitch, the partition is writable. "ro" is also ignored when
mounting manually. Only by using -u afterwards can read-only be enabled.

# ktruss mount -o ro,nodev,noatime,noexec,nosuid /dev/wd0m /s
  4068      1 ktruss   emul(netbsd)
  4068      1 ktruss   fcntl(0x4, 0x3, 0)          = 1
  4068      1 ktruss   fcntl(0x4, 0x4, 0x1)        = 0
  4068      1 mount    emul(netbsd)
  4068      1 mount    execve("/sbin/mount", 0xbfbfedf8, 0xbfbfee10) JUSTRETURN
  4068      1 mount    mmap(0, 0x8000, 0x3, 0x1002, 0xffffffff, 0, 0, 0) = 0xbbbeb000
  4068      1 mount    open("/etc/ld.so.conf", 0, 0xffffffff) = 3
  4068      1 mount    __fstat30(0x3, 0xbfbfed08)  = 0
  4068      1 mount    mmap(0, 0x37, 0x1, 0x1, 0x3, 0, 0, 0) = 0xbbbea000
  4068      1 mount    close(0x3)                  = 0
  4068      1 mount    munmap(0xbbbea000, 0x37)    = 0
  4068      1 mount    open("/lib/libc.so.12", 0, 0) = 3
  4068      1 mount    __fstat30(0x3, 0xbfbfe624)  = 0
  4068      1 mount    mmap(0, 0x1000, 0x1, 0x1, 0x3, 0, 0, 0) = 0xbbbea000
  4068      1 mount    munmap(0xbbbea000, 0x1000)  = 0
  4068      1 mount    mmap(0, 0xda000, 0x5, 0x2, 0x3, 0, 0, 0) = 0xbbb11000
  4068      1 mount    mmap(0xbbbd4000, 0x7000, 0x3, 0x12, 0x3, 0, 0xc2000, 0) = 0xbbbd4000
  4068      1 mount    mmap(0xbbbdb000, 0x10000, 0x3, 0x1012, 0xffffffff, 0, 0, 0) = 0xbbbdb000
  4068      1 mount    close(0x3)                  = 0
  4068      1 mount    __sysctl(0xbfbfe284, 0x2, 0xbfbfe28c, 0xbfbfe290, 0, 0) = 0
  4068      1 mount    readlink("/etc/malloc.conf", 0xbfbfe2c0, 0x3f) = 3
  4068      1 mount    mmap(0, 0x1000, 0x3, 0x1002, 0xffffffff, 0, 0, 0) = 0xbbb10000
  4068      1 mount    break(0x804c540)            = 0
  4068      1 mount    break(0x804d540)            = 0
  4068      1 mount    break(0x804e000)            = 0
  4068      1 mount    open("/dev/wd0m", 0, 0x804aae0) = 3
  4068      1 mount    ioctl(0x3, DIOCGWEDGEINFO, 0x804c460) Err#25 ENOTTY
  4068      1 mount    ioctl(0x3, DIOCGDINFO, 0xbfbfebf8) = 0
       "WEV\M^B\^E\0\0\0SAMSUNG SV1203N fictitious\0\0\0\0\0\0\0\^B\0\0?\0\0\0\^P\0\0\0\M-8\M^L\^C\0\M-p\^C\0\0\M^@\^T\M-z\r"
  4068      1 mount    close(0x3)                  = 0
  4068      1 mount    __lstat30("/s", 0xbfbfc9e8) = 0
  4068      1 mount    break(0x804f000)            = 0
  4068      1 mount    __vfork14()                 = 2501
  4068      1 mount    wait4(0x9c5, 0xbfbfe374, 0, 0) = 2501
  4068      1 mount    getuid()                    = 0
  4068      1 mount    open("/var/run/mountd.pid", 0, 0x1b6) Err#2 ENOENT
  4068      1 mount    exit(0)

>Fix:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->yamt
Responsible-Changed-By: yamt@netbsd.org
Responsible-Changed-When: Wed, 27 Dec 2006 01:25:33 +0000
Responsible-Changed-Why:
mine.


From: Christian Biere <christianbiere@gmx.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/35327: mount ignores read-only flag
Date: Wed, 27 Dec 2006 02:44:44 +0100

 This seems to fix it:

 Index: vfs_syscalls.c
 ===================================================================
 RCS file: /cvsroot/src/sys/kern/vfs_syscalls.c,v
 retrieving revision 1.286
 diff -u -p -r1.286 vfs_syscalls.c
 --- vfs_syscalls.c	26 Dec 2006 12:39:01 -0000	1.286
 +++ vfs_syscalls.c	27 Dec 2006 01:36:53 -0000
 @@ -378,7 +379,7 @@ mount_domount(struct lwp *l, struct vnod
  	 * Set the mount level flags.
  	 */
  	mp->mnt_flag = flags &
 -	   (MNT_FORCE | MNT_NOSUID | MNT_NOEXEC | MNT_NODEV |
 +	   (MNT_FORCE | MNT_NOSUID | MNT_NOEXEC | MNT_NODEV | MNT_RDONLY |
  	    MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOCOREDUMP |
  	    MNT_NOATIME | MNT_NODEVMTIME | MNT_SYMPERM | MNT_SOFTDEP |
  	    MNT_IGNORE);

From: YAMAMOTO Takashi <yamt@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/35327 CVS commit: src/sys/kern
Date: Wed, 27 Dec 2006 08:55:35 +0000 (UTC)

 Module Name:	src
 Committed By:	yamt
 Date:		Wed Dec 27 08:55:35 UTC 2006

 Modified Files:
 	src/sys/kern: vfs_syscalls.c

 Log Message:
 mount_domount: don't forget to handle MNT_RDONLY.
 PR/35327 from Christian Biere.


 To generate a diff of this commit:
 cvs rdiff -r1.286 -r1.287 src/sys/kern/vfs_syscalls.c

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

State-Changed-From-To: open->closed
State-Changed-By: yamt@netbsd.org
State-Changed-When: Mon, 01 Jan 2007 23:40:05 +0000
State-Changed-Why:
fixed.  thanks.


>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.