oss-sec mailing list archives

AW: Re: open(2) with side effects


From: Fiedler Roman <Roman.Fiedler () ait ac at>
Date: Thu, 23 Apr 2015 14:55:05 +0000

Von: Florian Weimer [mailto:fweimer () redhat com]

On 04/23/2015 04:16 PM, Stephane Chazelas wrote:
2015-04-23 15:08:43 +0200, Florian Weimer:
How common are file names on Linux which, when just opened and closed
(maybe with fstat or fgetattr inbetween), trigger side effects, such as
tape rewind?
[...]

Depends what you mean by side effect.

I'm only interested in side effects which are visible to other users and
not directly related to global resource consumption (e.g., dentry usage
or disk space due to keeping open a deleted file).

Pretend that I'm writing a backup tool or something AV-like, which has
to files without interfering with anything else.

Well, then make sure that you only use the openat calls and walk only a
single level of directory at any time. Otherwise O_NOFOLLOW is futile and
any file or /proc/[pid]/ data may end up in the backup or to be AV-scanned.

I would avoid going over FUSE-mounts also, there are so many ways to block
the process or play tricks with changing directory content.

And of course, have fd 0/1/2 open before opening anything else writable,
otherwise random open and error message may have unexpected side effects

Attachment: smime.p7s
Description:


Current thread: