From: Andries Brouwer <aeb@veritas.com>
To: Peter Cordes <peter@llama.nslug.ns.ca>
Cc: linux-kernel@vger.kernel.org
Subject: Re: access() says EROFS even for device files if /dev is mounted RO
Date: Mon, 27 Nov 2000 13:42:51 +0100 [thread overview]
Message-ID: <20001127134251.A8164@veritas.com> (raw)
In-Reply-To: <20001126233522.A436@llama.nslug.ns.ca>
In-Reply-To: <20001126233522.A436@llama.nslug.ns.ca>; from peter@llama.nslug.ns.ca on Sun, Nov 26, 2000 at 11:35:22PM -0400
On Sun, Nov 26, 2000 at 11:35:22PM -0400, Peter Cordes wrote:
> While doing some hdparm hacking, after booting with init=/bin/sh, I noticed
> that open(1) doesn't work when / is mounted read only.
Already long ago open(1) was renamed to openvt(1), so it may be that
have a very old version. See a recent kbd or console-tools.
> access("/dev/tty2", R_OK|W_OK) = -1 EROFS (Read-only file system)
> However, this is wrong. You _can_ write to device files on read-only
> filesystems. (open shouldn't bother calling access(), but the kernel should
> definitely give the right answer!)
You misunderstand the function of access(). The standard says
[EROFS] write access shall fail if write access is requested
for a file on a read-only file system
It does not look at whether you ask write access to a directory
or a special device file (and whether the filesystem was mounted nodev or not).
So, probably you found a flaw in openvt: the use of access is almost always
a bug - it doesnt tell you what you want to know. You may send me a patch
if you want to.
On the other hand, on recent kernels access() doesnt fail in this situation.
That is a kernel bug, I suppose. Will investigate later.
Andries - aeb@cwi.nl
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2000-11-27 13:13 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-11-27 3:35 access() says EROFS even for device files if /dev is mounted RO Peter Cordes
2000-11-27 12:42 ` Andries Brouwer [this message]
2000-11-27 21:47 ` Rogier Wolff
2000-11-28 0:09 ` Andries Brouwer
2000-11-28 14:04 ` Rogier Wolff
2000-11-28 21:37 ` Andries Brouwer
2000-11-29 12:01 ` Hugh Dickins
2000-11-29 12:39 ` Alexander Viro
2000-11-29 15:46 ` Hugh Dickins
2000-11-29 16:18 ` Alexander Viro
2000-11-29 16:40 ` Tigran Aivazian
2000-11-29 16:52 ` Alexander Viro
2000-12-01 17:12 ` Olivier Galibert
2000-12-01 17:59 ` Richard B. Johnson
2000-11-29 16:24 ` Tigran Aivazian
2000-11-29 16:25 ` Tigran Aivazian
2000-11-29 16:42 ` Alexander Viro
2000-11-29 16:58 ` Tigran Aivazian
2000-11-29 17:07 ` Tigran Aivazian
2000-11-29 16:48 ` Hugh Dickins
2000-11-29 14:24 ` Richard B. Johnson
2000-11-29 14:33 ` Broken NTFS Joseph K. Malek
2000-11-29 19:28 ` Jeff V. Merkey
2000-11-28 22:56 ` access() says EROFS even for device files if /dev is mounted RO Peter Cordes
2000-11-28 23:23 ` Alexander Viro
-- strict thread matches above, loose matches on Subject: below --
2000-11-29 17:17 Andries.Brouwer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20001127134251.A8164@veritas.com \
--to=aeb@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peter@llama.nslug.ns.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox