[libvirt] [PATCH] tpm: Use /dev/null for cancel path if none was found

Stefan Berger posted 1 patch 116 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1498759271-25487-1-git-send-email-stefanb@linux.vnet.ibm.com
src/util/virtpm.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

[libvirt] [PATCH] tpm: Use /dev/null for cancel path if none was found

Posted by Stefan Berger 116 weeks ago
TPM 2 does not implement sysfs files for cancellation of commands.
We therefore use /dev/null for the cancel path passed to QEMU.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
---
 src/util/virtpm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/util/virtpm.c b/src/util/virtpm.c
index 6d9b065..d5c10da 100644
--- a/src/util/virtpm.c
+++ b/src/util/virtpm.c
@@ -61,9 +61,7 @@ virTPMCreateCancelPath(const char *devpath)
                 VIR_FREE(path);
             }
             if (!path)
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("No usable sysfs TPM cancel file could be "
-                                 "found"));
+                ignore_value(VIR_STRDUP(path, "/dev/null"));
         } else {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("TPM device path %s is invalid"), devpath);
-- 
2.5.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] tpm: Use /dev/null for cancel path if none was found

Posted by Daniel P. Berrange 116 weeks ago
On Thu, Jun 29, 2017 at 02:01:11PM -0400, Stefan Berger wrote:
> TPM 2 does not implement sysfs files for cancellation of commands.
> We therefore use /dev/null for the cancel path passed to QEMU.
> 
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> ---
>  src/util/virtpm.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/src/util/virtpm.c b/src/util/virtpm.c
> index 6d9b065..d5c10da 100644
> --- a/src/util/virtpm.c
> +++ b/src/util/virtpm.c
> @@ -61,9 +61,7 @@ virTPMCreateCancelPath(const char *devpath)
>                  VIR_FREE(path);
>              }
>              if (!path)
> -                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> -                               _("No usable sysfs TPM cancel file could be "
> -                                 "found"));
> +                ignore_value(VIR_STRDUP(path, "/dev/null"));
>          } else {
>              virReportError(VIR_ERR_INTERNAL_ERROR,
>                             _("TPM device path %s is invalid"), devpath);

It would be better to simply not set the cancel-path= argument to QEMU if
it is not required / available.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] tpm: Use /dev/null for cancel path if none was found

Posted by Stefan Berger 116 weeks ago
On 06/29/2017 02:06 PM, Daniel P. Berrange wrote:
> On Thu, Jun 29, 2017 at 02:01:11PM -0400, Stefan Berger wrote:
>> TPM 2 does not implement sysfs files for cancellation of commands.
>> We therefore use /dev/null for the cancel path passed to QEMU.
>>
>> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
>> ---
>>   src/util/virtpm.c | 4 +---
>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/src/util/virtpm.c b/src/util/virtpm.c
>> index 6d9b065..d5c10da 100644
>> --- a/src/util/virtpm.c
>> +++ b/src/util/virtpm.c
>> @@ -61,9 +61,7 @@ virTPMCreateCancelPath(const char *devpath)
>>                   VIR_FREE(path);
>>               }
>>               if (!path)
>> -                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>> -                               _("No usable sysfs TPM cancel file could be "
>> -                                 "found"));
>> +                ignore_value(VIR_STRDUP(path, "/dev/null"));
>>           } else {
>>               virReportError(VIR_ERR_INTERNAL_ERROR,
>>                              _("TPM device path %s is invalid"), devpath);
> It would be better to simply not set the cancel-path= argument to QEMU if
> it is not required / available.

Unfortunately QEMU will do the same thing as libvirt, that is search for 
the sysfs cancel path, unless it is provided via command line. We 
provide it here with a 'dummy path.'

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] tpm: Use /dev/null for cancel path if none was found

Posted by Javier Martinez Canillas 116 weeks ago
Hello Stefan,

On 06/29/2017 08:01 PM, Stefan Berger wrote:
> TPM 2 does not implement sysfs files for cancellation of commands.
> We therefore use /dev/null for the cancel path passed to QEMU.
> 
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> ---
>  src/util/virtpm.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/src/util/virtpm.c b/src/util/virtpm.c
> index 6d9b065..d5c10da 100644
> --- a/src/util/virtpm.c
> +++ b/src/util/virtpm.c
> @@ -61,9 +61,7 @@ virTPMCreateCancelPath(const char *devpath)
>                  VIR_FREE(path);
>              }
>              if (!path)
> -                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> -                               _("No usable sysfs TPM cancel file could be "
> -                                 "found"));
> +                ignore_value(VIR_STRDUP(path, "/dev/null"));
>          } else {
>              virReportError(VIR_ERR_INTERNAL_ERROR,
>                             _("TPM device path %s is invalid"), devpath);
> 

Thanks a lot for the patch. Now libvirt does not complain anymore about the
missing cancel file and I could access the host TPM2.0 correctly from guest.

Tested-by: Javier Martinez Canillas <javierm@redhat.com>

Best regards,
-- 
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] tpm: Use /dev/null for cancel path if none was found

Posted by Javier Martinez Canillas 109 weeks ago
Hello,

On 06/29/2017 08:01 PM, Stefan Berger wrote:
> TPM 2 does not implement sysfs files for cancellation of commands.
> We therefore use /dev/null for the cancel path passed to QEMU.
> 
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> ---
>  src/util/virtpm.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/src/util/virtpm.c b/src/util/virtpm.c
> index 6d9b065..d5c10da 100644
> --- a/src/util/virtpm.c
> +++ b/src/util/virtpm.c
> @@ -61,9 +61,7 @@ virTPMCreateCancelPath(const char *devpath)
>                  VIR_FREE(path);
>              }
>              if (!path)
> -                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> -                               _("No usable sysfs TPM cancel file could be "
> -                                 "found"));
> +                ignore_value(VIR_STRDUP(path, "/dev/null"));
>          } else {
>              virReportError(VIR_ERR_INTERNAL_ERROR,
>                             _("TPM device path %s is invalid"), devpath);
> 

I see that this patch hasn't landed in libvirt yet.

Best regards,
-- 
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] tpm: Use /dev/null for cancel path if none was found

Posted by Marc-André Lureau 106 weeks ago
Hi

On Thu, Jun 29, 2017 at 7:01 PM Stefan Berger <stefanb@linux.vnet.ibm.com>
wrote:

> TPM 2 does not implement sysfs files for cancellation of commands.
> We therefore use /dev/null for the cancel path passed to QEMU.
>
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
>  src/util/virtpm.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/src/util/virtpm.c b/src/util/virtpm.c
> index 6d9b065..d5c10da 100644
> --- a/src/util/virtpm.c
> +++ b/src/util/virtpm.c
> @@ -61,9 +61,7 @@ virTPMCreateCancelPath(const char *devpath)
>                  VIR_FREE(path);
>              }
>              if (!path)
> -                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> -                               _("No usable sysfs TPM cancel file could
> be "
> -                                 "found"));
> +                ignore_value(VIR_STRDUP(path, "/dev/null"));
>          } else {
>              virReportError(VIR_ERR_INTERNAL_ERROR,
>                             _("TPM device path %s is invalid"), devpath);
> --
> 2.5.5
>
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
>
-- 
Marc-André Lureau
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] tpm: Use /dev/null for cancel path if none was found

Posted by Jiri Denemark 106 weeks ago
On Thu, Sep 07, 2017 at 11:34:09 +0000, Marc-André Lureau wrote:
> Hi
> 
> On Thu, Jun 29, 2017 at 7:01 PM Stefan Berger <stefanb@linux.vnet.ibm.com>
> wrote:
> 
> > TPM 2 does not implement sysfs files for cancellation of commands.
> > We therefore use /dev/null for the cancel path passed to QEMU.
> >
> > Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> >
> 
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Pushed.

Jirka

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list