[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] linux-user: implement pipe2 syscall
From: |
Martin Mohring |
Subject: |
Re: [Qemu-devel] [PATCH] linux-user: implement pipe2 syscall |
Date: |
Wed, 06 May 2009 11:18:46 +0200 |
User-agent: |
Thunderbird 2.0.0.19 (X11/20081227) |
Riku Voipio wrote:
> On Tue, May 05, 2009 at 11:58:09PM +0100, Jamie Lokier wrote:
>
>> 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.
>>
>
>
How do we want to handle if "O_CLOEXEC" is not defined on the host OS,
because kernel too old (Debian Etch, CentOS 5)? Should it then return
ENOSYS?
>> 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.
>>
>
> We haven't returned from the pipe2 syscall when setting the flag with fcntl.
> Before returning from the syscall, the pipe file descriptors could point
> to anything (unitialized memory, zeros, ...)
>
>
>
>
- [Qemu-devel] [PATCH] linux-user: implement pipe2 syscall, Riku Voipio, 2009/05/05
- [Qemu-devel] [PATCH] linux-user: implement pipe2 syscall [v2], Riku Voipio, 2009/05/05
- Re: [Qemu-devel] [PATCH] linux-user: implement pipe2 syscall, Jamie Lokier, 2009/05/05
- Re: [Qemu-devel] [PATCH] linux-user: implement pipe2 syscall, Riku Voipio, 2009/05/06
- Re: [Qemu-devel] [PATCH] linux-user: implement pipe2 syscall, Jamie Lokier, 2009/05/06
- Re: [Qemu-devel] [PATCH] linux-user: implement pipe2 syscall, Riku Voipio, 2009/05/06
- Re: [Qemu-devel] [PATCH] linux-user: implement pipe2 syscall, Martin Mohring, 2009/05/06
- Re: [Qemu-devel] [PATCH] linux-user: implement pipe2 syscall, Paul Brook, 2009/05/06
- Re: [Qemu-devel] [PATCH] linux-user: implement pipe2 syscall, Riku Voipio, 2009/05/06