From: Jamie Lokier <jamie@shareable.org>
To: Riku Voipio <riku.voipio@iki.fi>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] linux-user: implement pipe2 syscall
Date: Tue, 5 May 2009 23:58:09 +0100 [thread overview]
Message-ID: <20090505225809.GJ7574@shareable.org> (raw)
In-Reply-To: <20090505133048.GA29646@kos.to>
Riku Voipio wrote:
> implement pipe2 syscall. instead of calling pipe2 directly
> (which was introduced in 2.6.27), emulate the flag functionality
> with fcntl.
This is wrong with multiple threads if the flag contains FD_CLOEXEC.
If that situation is possible, please don't do this.
The point of pipe2() with FD_CLOEXEC is to be atomic: make sure
another thread can never see the file descriptor with FD_CLOEXEC not set.
If you can't guarantee that, it's better to return ENOSYS as every
application using pipe2() like this has a fallback to use pipe() and
FD_CLOEXEC itself, and probably has application logic to protect
against the race condition.
If there's only one thread, or if you can arrange to block any
concurrent clone/fork/execve calls in other threads (in QEMU) during
the race window, then it's fine to emulate it with fcntl.
-- Jamie
next prev parent reply other threads:[~2009-05-05 22:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-05 13:30 [Qemu-devel] [PATCH] linux-user: implement pipe2 syscall Riku Voipio
2009-05-05 20:43 ` [Qemu-devel] [PATCH] linux-user: implement pipe2 syscall [v2] Riku Voipio
2009-05-05 22:58 ` Jamie Lokier [this message]
2009-05-06 8:00 ` [Qemu-devel] [PATCH] linux-user: implement pipe2 syscall Riku Voipio
2009-05-06 9:18 ` Martin Mohring
2009-05-06 10:53 ` Jamie Lokier
2009-05-06 11:02 ` Riku Voipio
2009-05-06 11:08 ` Jamie Lokier
2009-05-06 12:02 ` Riku Voipio
2009-05-06 12:23 ` Paul Brook
2009-05-06 14:26 ` Riku Voipio
2009-05-06 12:46 ` Martin Mohring
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=20090505225809.GJ7574@shareable.org \
--to=jamie@shareable.org \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
/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;
as well as URLs for NNTP newsgroup(s).