Re: [libvirt] [PATCH v3] qemu: Pass file descriptor when using TPM passthrough

2015-02-06 Thread Eric Blake
On 02/06/2015 10:49 AM, Daniel P. Berrange wrote: I'm still trying to figure out how virCommandReorderFDs() got into the picture (I didn't write that section of the code); when I originally worked on virCommand, the only way to pass fds to the child was in direct positions (same fd in child

Re: [libvirt] [PATCH v3] qemu: Pass file descriptor when using TPM passthrough

2015-02-06 Thread Stefan Berger
On 02/06/2015 01:58 PM, Eric Blake wrote: On 02/06/2015 10:49 AM, Daniel P. Berrange wrote: I'm still trying to figure out how virCommandReorderFDs() got into the picture (I didn't write that section of the code); when I originally worked on virCommand, the only way to pass fds to the child

Re: [libvirt] [PATCH v3] qemu: Pass file descriptor when using TPM passthrough

2015-02-06 Thread Stefan Berger
On 02/06/2015 01:56 PM, Eric Blake wrote: On 02/06/2015 09:41 AM, Stefan Berger wrote: @@ -214,6 +215,12 @@ virCommandReorderFDs(virCommandPtr cmd) if (!cmd || cmd-has_error || !cmd-npassfd) return; +if ((cmd-flags VIR_EXEC_FIXED_FDS)) { +

Re: [libvirt] [PATCH v3] qemu: Pass file descriptor when using TPM passthrough

2015-02-06 Thread Eric Blake
On 02/06/2015 12:19 PM, Stefan Berger wrote: virCommandReorderFDs is not used on WIN32 -- that would then mean that the fdsets could not be used on WIN32 or a different return value would have to be given here. Like return cmd-npassfd -1 on WIN32 ? virCommand in general has problems

Re: [libvirt] [PATCH v3] qemu: Pass file descriptor when using TPM passthrough

2015-02-06 Thread Eric Blake
On 02/06/2015 09:41 AM, Stefan Berger wrote: @@ -214,6 +215,12 @@ virCommandReorderFDs(virCommandPtr cmd) if (!cmd || cmd-has_error || !cmd-npassfd) return; +if ((cmd-flags VIR_EXEC_FIXED_FDS)) { +virReportError(VIR_ERR_INTERNAL_ERROR, %s, +

Re: [libvirt] [PATCH v3] qemu: Pass file descriptor when using TPM passthrough

2015-02-06 Thread Stefan Berger
On 02/06/2015 03:11 PM, Eric Blake wrote: On 02/06/2015 12:19 PM, Stefan Berger wrote: virCommandReorderFDs is not used on WIN32 -- that would then mean that the fdsets could not be used on WIN32 or a different return value would have to be given here. Like return cmd-npassfd -1 on WIN32 ?

Re: [libvirt] [PATCH v3] qemu: Pass file descriptor when using TPM passthrough

2015-02-06 Thread Eric Blake
On 02/06/2015 04:12 PM, Stefan Berger wrote: it's not that simple unfortunately; if we started to re-order / re-map using dup() the file descriptors then all fd's that make it onto the command line, like those for -netdev and others, also need to be adapted to have that re-ordered fd on the

Re: [libvirt] [PATCH v3] qemu: Pass file descriptor when using TPM passthrough

2015-02-06 Thread Stefan Berger
On 02/06/2015 02:43 PM, Stefan Berger wrote: On 02/06/2015 01:58 PM, Eric Blake wrote: On 02/06/2015 10:49 AM, Daniel P. Berrange wrote: I'm still trying to figure out how virCommandReorderFDs() got into the picture (I didn't write that section of the code); when I originally worked on

Re: [libvirt] [PATCH v3] qemu: Pass file descriptor when using TPM passthrough

2015-02-06 Thread Stefan Berger
On 01/30/2015 07:17 PM, Eric Blake wrote: On 11/20/2014 08:08 AM, Stefan Berger wrote: Pass the TPM file descriptor to QEMU via command line. Instead of passing /dev/tpm0 we now pass /dev/fdset/10 and the additional parameters -add-fd set=10,fd=20. This addresses the use case when QEMU is

Re: [libvirt] [PATCH v3] qemu: Pass file descriptor when using TPM passthrough

2015-02-06 Thread Daniel P. Berrange
On Fri, Jan 30, 2015 at 05:17:56PM -0700, Eric Blake wrote: On 11/20/2014 08:08 AM, Stefan Berger wrote: Wow, I've been horribly slow at reviewing this. Do feel free to ping on list if no one seems to notice a patch, to widen the chances of anyone taking a glance at it. Pass the TPM

Re: [libvirt] [PATCH v3] qemu: Pass file descriptor when using TPM passthrough

2015-02-05 Thread Stefan Berger
On 01/30/2015 07:17 PM, Eric Blake wrote: +} +i++; +} + +return -1; +} + /** * virCommandSetPidFile: * @cmd: the command to modify diff --git a/src/util/vircommand.h b/src/util/vircommand.h index bf65de4..198da2f 100644 --- a/src/util/vircommand.h +++

Re: [libvirt] [PATCH v3] qemu: Pass file descriptor when using TPM passthrough

2015-01-30 Thread Eric Blake
On 11/20/2014 08:08 AM, Stefan Berger wrote: Wow, I've been horribly slow at reviewing this. Do feel free to ping on list if no one seems to notice a patch, to widen the chances of anyone taking a glance at it. Pass the TPM file descriptor to QEMU via command line. Instead of passing

[libvirt] [PATCH v3] qemu: Pass file descriptor when using TPM passthrough

2014-11-20 Thread Stefan Berger
Pass the TPM file descriptor to QEMU via command line. Instead of passing /dev/tpm0 we now pass /dev/fdset/10 and the additional parameters -add-fd set=10,fd=20. This addresses the use case when QEMU is started with non-root privileges and QEMU cannot open /dev/tpm0 for example. One problem is