Re: [libvirt] [PATCH v2 3/3] qemu-config: Add new -add-fd command line option

2012-10-11 Thread Corey Bryant
On 10/11/2012 12:04 PM, Eric Blake wrote: On 10/10/2012 04:31 PM, Eric Blake wrote: Another missing validation check is for duplicate use. With the monitor command, you ALWAYS have a unique fd (thanks to SCM_RIGHTS). But with the command line, I can type 'qemu -add-fd fd=4,set=1 -add-fd fd=

Re: [libvirt] [PATCH v2 3/3] qemu-config: Add new -add-fd command line option

2012-10-11 Thread Eric Blake
On 10/11/2012 10:04 AM, Eric Blake wrote: > Another idea: a hybrid approach - the _first_ -add-fd 4 directly adds 4 > to the set, all other -add-fd 4 end up adding dup(4) instead (well, > fcntl(F_DUPFD_CLOEXEC), but you get the picture). That is, do the > duplicate scanning, and if there is no dup

Re: [libvirt] [PATCH v2 3/3] qemu-config: Add new -add-fd command line option

2012-10-11 Thread Eric Blake
On 10/10/2012 04:31 PM, Eric Blake wrote: > Another missing validation check is for duplicate use. With the monitor > command, you ALWAYS have a unique fd (thanks to SCM_RIGHTS). But with > the command line, I can type 'qemu -add-fd fd=4,set=1 -add-fd > fd=4,set=2'. Oops - I've now corrupted yo

Re: [libvirt] [PATCH v2 3/3] qemu-config: Add new -add-fd command line option

2012-10-10 Thread Eric Blake
On 10/10/2012 08:20 AM, Corey Bryant wrote: > This option can be used for passing file descriptors on the > command line. It mirrors the existing add-fd QMP command which > allows an fd to be passed to QEMU via SCM_RIGHTS and added to an > fd set. > > This can be combined with commands such as -d

[libvirt] [PATCH v2 3/3] qemu-config: Add new -add-fd command line option

2012-10-10 Thread Corey Bryant
This option can be used for passing file descriptors on the command line. It mirrors the existing add-fd QMP command which allows an fd to be passed to QEMU via SCM_RIGHTS and added to an fd set. This can be combined with commands such as -drive to link file descriptors in an fd set to a drive: