All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@bfk.de>
To: Eric Blake <ebb9@byu.net>
Cc: Davide Libenzi <davidel@xmailserver.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	bug-coreutils@gnu.org, bug-gnulib@gnu.org,
	Ulrich Drepper <drepper@redhat.com>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] open: introduce O_NOSTD
Date: Fri, 28 Aug 2009 12:52:57 +0000	[thread overview]
Message-ID: <82ocq0p0ba.fsf@mid.bfk.de> (raw)
In-Reply-To: <4A97D16D.5060003@byu.net> (Eric Blake's message of "Fri\, 28 Aug 2009 06\:45\:33 -0600")

* Eric Blake:

> Your version fails to clear the cloexec bit of the final fd if the
> original caller didn't request O_CLOEXEC.

Okay, but you can fix that in a race-free manner (but I thought that
this was implied by open_safer).

> If the caller requested O_CLOEXEC, then your version takes 3, 5, or
> 7 syscalls depending on how many std fds were closed, while my
> version takes 3 syscalls regardless of how many std fds were closed.

I really don't see a way around that.  You can't pick a descriptor and
hope that it's unused.

> Also, your suggestion has a definite race in that you are calling
> open() multiple times rather than cloning an existing fd after the
> first open(), such that another process could alter which file is
> visited between your first and last open().

Sure, but this is an unobservable differen.ce

-- 
Florian Weimer                <fweimer@bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99

  reply	other threads:[~2009-08-28 12:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-24 12:22 [RFC] new open flag O_NOSTD Eric Blake
2009-08-25 12:16 ` [PATCH] open: introduce O_NOSTD Eric Blake
2009-08-25 21:53   ` Davide Libenzi
2009-08-27 13:54     ` Eric Blake
2009-08-27 14:22       ` Ulrich Drepper
2009-08-28 12:28         ` Eric Blake
2009-08-27 14:35       ` Florian Weimer
2009-08-28 12:45         ` Eric Blake
2009-08-28 12:52           ` Florian Weimer [this message]
2009-08-28 12:58             ` Eric Blake
2009-08-28 13:04             ` Eric Blake
2009-08-27 22:55       ` Davide Libenzi
2009-08-27 23:11         ` Ulrich Drepper
2009-08-30 11:12 ` [RFC] new open flag O_NOSTD James Youngman
2009-08-30 11:18   ` Jim Meyering

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=82ocq0p0ba.fsf@mid.bfk.de \
    --to=fweimer@bfk.de \
    --cc=bug-coreutils@gnu.org \
    --cc=bug-gnulib@gnu.org \
    --cc=davidel@xmailserver.org \
    --cc=drepper@redhat.com \
    --cc=ebb9@byu.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.