[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <82ocq0p0ba.fsf@mid.bfk.de>
Date: Fri, 28 Aug 2009 12:52:57 +0000
From: Florian Weimer <fweimer@....de>
To: Eric Blake <ebb9@....net>
Cc: Davide Libenzi <davidel@...ilserver.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
bug-coreutils@....org, bug-gnulib@....org,
Ulrich Drepper <drepper@...hat.com>,
Ingo Molnar <mingo@...e.hu>
Subject: Re: [PATCH] open: introduce O_NOSTD
* 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@....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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists