[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 3/5] osdep: Enable qemu_open to dup pre-opene
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v3 3/5] osdep: Enable qemu_open to dup pre-opened fd |
Date: |
Fri, 15 Jun 2012 14:00:55 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 |
On 06/15/2012 01:19 PM, Corey Bryant wrote:
>>> There are some flags that I don't think we'll be able to change. For
>>> example: O_RDONLY, O_WRONLY, O_RDWR. I assume libvirt would open all
>>> files O_RDWR.
>>
>> I think we need to check all of them and fail qemu_open() if they don't
>> match. Those that qemu can change, should be just changed, of course.
>>
>
> Ok. I remember a scenario where QEMU opens a file read-only (perhaps to
> check headers and determine the file format) before re-opening it
> read-write. Perhaps this is only when format= isn't specified with
> -drive. I'm thinking we may need to change flags to read-write where
> they used to be read-only, in some circumstances.
In those situations, libvirt would pass fd with O_RDWR, and qemu_open()
would be fine requesting O_RDONLY the first time (subset is okay), and
O_RDWR the second time. Where you have to error out is where libvirt
passes O_RDONLY but qemu wants O_RDWR, and so forth.
>>
>> In which scenario would any client break if we set FD_CLOEXEC? I don't
>> think compatibility means we can't fix any bugs.
>>
>
> I don't know if it breaks any client. Maybe it's not a compatibility
> error. It dopes change behavior down the line though. If you think
> it's ok to set FD_CLOEXEC for getfd too, then I'm happy to do it.
The only case that a client might break is if there were a way to pass
an fd into qemu and then intentionally see that fd in a child process of
qemu. But in the case of 'migrate fd:nnn', you aren't spawning a child
process, and even in the case of 'migrate exec:command' (which libvirt
no longer uses if fd:nnn works), I don't see how the client could have
ever intentionally tried to use 'getfd' in advance to pass an extra fd
for use inside the 'exec:command' child. Besides, before 'pass-fd' was
around, how would the management app triggering the 'exec:command' even
know what fd number would accidentally be inherited into the
exec:command child? I think it is pretty much a straight bug-fix for
'getfd' to always set FD_CLOEXEC, and preferably set it atomically via
MSG_CMSG_CLOEXEC.
--
Eric Blake address@hidden +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v3 5/5] block: Prevent /dev/fd/X filename from being detected as floppy, (continued)
- [Qemu-devel] [PATCH v3 5/5] block: Prevent /dev/fd/X filename from being detected as floppy, Corey Bryant, 2012/06/14
- [Qemu-devel] [PATCH v3 3/5] osdep: Enable qemu_open to dup pre-opened fd, Corey Bryant, 2012/06/14
- Re: [Qemu-devel] [PATCH v3 3/5] osdep: Enable qemu_open to dup pre-opened fd, Eric Blake, 2012/06/15
- Re: [Qemu-devel] [PATCH v3 3/5] osdep: Enable qemu_open to dup pre-opened fd, Kevin Wolf, 2012/06/15
- Re: [Qemu-devel] [PATCH v3 3/5] osdep: Enable qemu_open to dup pre-opened fd, Corey Bryant, 2012/06/15
- Re: [Qemu-devel] [PATCH v3 3/5] osdep: Enable qemu_open to dup pre-opened fd,
Eric Blake <=
- Re: [Qemu-devel] [PATCH v3 3/5] osdep: Enable qemu_open to dup pre-opened fd, Corey Bryant, 2012/06/15
- Re: [Qemu-devel] [PATCH v3 3/5] osdep: Enable qemu_open to dup pre-opened fd, Kevin Wolf, 2012/06/18
- Re: [Qemu-devel] [PATCH v3 3/5] osdep: Enable qemu_open to dup pre-opened fd, Corey Bryant, 2012/06/19
Re: [Qemu-devel] [PATCH v3 0/5] file descriptor passing using pass-fd, Eric Blake, 2012/06/19
- Re: [Qemu-devel] [PATCH v3 0/5] file descriptor passing using pass-fd, Kevin Wolf, 2012/06/19
- Re: [Qemu-devel] [PATCH v3 0/5] file descriptor passing using pass-fd, Eric Blake, 2012/06/19
- Re: [Qemu-devel] [PATCH v3 0/5] file descriptor passing using pass-fd, Kevin Wolf, 2012/06/20
- Re: [Qemu-devel] [PATCH v3 0/5] file descriptor passing using pass-fd, Daniel P. Berrange, 2012/06/20
- Re: [Qemu-devel] [PATCH v3 0/5] file descriptor passing using pass-fd, Eric Blake, 2012/06/20
- Re: [Qemu-devel] [PATCH v3 0/5] file descriptor passing using pass-fd, Corey Bryant, 2012/06/20