From: Andries.Brouwer@cwi.nl
To: Andries.Brouwer@cwi.nl, viro@math.psu.edu
Cc: bcrl@redhat.com, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, torvalds@transmeta.com
Subject: Re: Why side-effects on open(2) are evil. (was Re: [RFD w/info-PATCH] device arguments from lookup)
Date: Sat, 19 May 2001 18:41:39 +0200 (MET DST) [thread overview]
Message-ID: <UTC200105191641.SAA53411.aeb@vlet.cwi.nl> (raw)
>> Opening device files often has interesting side effects.
> Too bad. They can be triggered by similar races between attacker
> changing the type of object (file<->symlink) and backup.
Yes. This is a well-known security problem.
Doing
stat("file", &s);
if (action desired) {
action("file");
}
is no good because there is a race.
But doing
fd = open("file", flags);
fstat(fd, &s);
if (action desired) {
f_action(fd);
}
is no good either because the open() has unknown side effects.
It helps to add flags like O_NONBLOCK and perhaps O_NOCTTY,
but that is not quite good enough.
One would like to have a version of the open() call that was
guaranteed free of side effects, and gave a fd only -
perhaps for stat(), perhaps for ioctl().
This guarantee could perhaps be obtained by omitting the
f->f_op->open(inode,f);
call in dentry_open() when the open call is
open("file", O_FDONLY);
Of course it may be that we afterwards decide that fd must
be used, and then it needs upgrading:
fd = f_open(fd, O_RDWR);
Andries
[Such a construction allows various cleanups.
But no doubt it has problems that I have not yet thought of.]
next reply other threads:[~2001-05-19 16:42 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-19 16:41 Andries.Brouwer [this message]
2001-05-19 16:51 ` Why side-effects on open(2) are evil. (was Re: [RFD w/info-PATCH] device arguments from lookup) Alexander Viro
2001-05-19 17:14 ` Matthew Wilcox
2001-05-19 23:24 ` Alexander Viro
2001-05-20 11:18 ` Matthew Kirkwood
-- strict thread matches above, loose matches on Subject: below --
2001-05-19 14:19 Andries.Brouwer
2001-05-19 14:58 ` Alexander Viro
2001-05-19 6:23 [RFD w/info-PATCH] device arguments from lookup, partion code in userspace Ben LaHaise
2001-05-19 13:57 ` Why side-effects on open(2) are evil. (was Re: [RFD w/info-PATCH] device arguments from lookup) Alexander Viro
2001-05-19 15:10 ` Why side-effects on open(2) are evil. (was Re: [RFD w/info-PATCH]device " Abramo Bagnara
2001-05-19 15:18 ` Alexander Viro
2001-05-19 16:01 ` Willem Konynenberg
2001-05-20 20:52 ` Pavel Machek
2001-05-20 20:53 ` Pavel Machek
2001-05-19 18:13 ` Why side-effects on open(2) are evil. (was Re: [RFD w/info-PATCH] device " Linus Torvalds
2001-05-19 23:19 ` Alexander Viro
2001-05-19 23:31 ` Why side-effects on open(2) are evil. (was Re: [RFD w/info-PATCH]device " Jeff Garzik
2001-05-19 23:32 ` Jeff Garzik
2001-05-19 23:39 ` Alexander Viro
2001-05-21 17:16 ` Oliver Xymoron
2001-05-21 16:26 ` David Lang
2001-05-21 18:04 ` Oliver Xymoron
2001-05-21 20:14 ` Daniel Phillips
2001-05-22 15:24 ` Oliver Xymoron
2001-05-22 16:51 ` Daniel Phillips
2001-05-22 17:49 ` Oliver Xymoron
2001-05-22 20:22 ` Daniel Phillips
2001-05-23 4:19 ` Edgar Toernig
2001-05-23 4:50 ` Alexander Viro
2001-05-23 13:50 ` Daniel Phillips
2001-05-23 13:50 ` Daniel Phillips
2001-05-23 15:58 ` Oliver Xymoron
2001-05-24 0:23 ` Edgar Toernig
2001-05-24 7:47 ` Marko Kreen
2001-05-24 14:39 ` Oliver Xymoron
2001-05-24 17:25 ` Daniel Phillips
2001-05-24 20:59 ` Edgar Toernig
2001-05-24 21:26 ` Alexander Viro
2001-05-25 1:03 ` Daniel Phillips
2001-05-25 11:00 ` Daniel Phillips
2001-05-26 3:07 ` Edgar Toernig
2001-05-26 22:36 ` Daniel Phillips
2001-05-27 13:32 ` Edgar Toernig
2001-05-27 20:40 ` Ben LaHaise
2001-05-27 20:45 ` Daniel Phillips
2001-05-27 21:50 ` Marko Kreen
2001-05-28 1:26 ` Horst von Brand
2001-05-29 10:54 ` Daniel Phillips
2001-05-29 13:54 ` Horst von Brand
2001-05-19 23:52 ` Edgar Toernig
2001-05-20 0:18 ` Alexander Viro
2001-05-20 0:32 ` Linus Torvalds
2001-05-20 0:52 ` Jeff Garzik
2001-05-20 1:03 ` Jeff Garzik
2001-05-21 9:45 ` Andrew Clausen
2001-05-21 17:22 ` Oliver Xymoron
2001-05-22 18:53 ` Andreas Dilger
2001-05-24 9:20 ` Malcolm Beattie
2001-05-24 19:15 ` Andreas Dilger
2001-05-22 18:41 ` Andreas Dilger
2001-05-22 19:06 ` Linus Torvalds
2001-05-22 19:16 ` Peter J. Braam
2001-05-22 20:10 ` Andreas Dilger
2001-05-22 20:59 ` Peter J. Braam
2001-05-23 9:23 ` Stephen C. Tweedie
2001-05-24 21:07 ` Daniel Phillips
2001-05-24 22:00 ` Hans Reiser
2001-05-25 10:56 ` Daniel Phillips
2001-05-23 9:13 ` Stephen C. Tweedie
2001-05-20 20:23 ` Why side-effects on open(2) are evil. (was Re: [RFD w/info-PATCH] device " Pavel Machek
2001-05-21 20:38 ` Alexander Viro
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=UTC200105191641.SAA53411.aeb@vlet.cwi.nl \
--to=andries.brouwer@cwi.nl \
--cc=bcrl@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
--cc=viro@math.psu.edu \
/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