RE: udmabuf error with libvirt + QEMU

2022-02-01 Thread M, Shivakumar
Hi Daniel,

You're right , /dev/udmabuf is required for GTK display for GL support. I agree 
passing the device using qemu:arg breaks the security confinement of Libvirt. 
For our use-case we need to have the GL support, is there any way to specify 
the GTK display option in the Libvirt XML ? or any other alternatives?

Thanks,
Shiv

-Original Message-
From: Daniel P. Berrangé  
Sent: Tuesday, February 1, 2022 8:11 PM
To: M, Shivakumar 
Cc: libvirt-users@redhat.com
Subject: Re: udmabuf error with libvirt + QEMU

On Tue, Feb 01, 2022 at 02:27:55PM +, M, Shivakumar wrote:
> Hi,
> 
> We are seeing an issue with udambuf, where it says "open /dev/udmabuf: No 
> such file or directory " even if the device exits. This issue particularly we 
> are seeing with libvirt. When we run the QEMU args on the command line, 
> everything works as expected.
> It seems to be some permission issue when we use the Libvirt, please help us 
> on resolving this.

When libvirt launches QEMU it puts in place a number of strict security 
protections. Libvirt will grant access on a per-file basis to resources on the 
host that QEMU should be allowed to access based on the device configuration in 
the XML.

In your case though you're using command line passthrough:

>   
> 
> 
> 
> 
> 
>   

This is totally opaque to libvirt and so libvirt won't be granting access to 
any resources needed by these args. I'm assuming /dev/udmabuf is needed by the 
GTK display for GL support, or something along those lines.

For further information about your options please consult this page:

  https://libvirt.org/kbase/qemu-passthrough-security.html

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 :|




Re: udmabuf error with libvirt + QEMU

2022-02-01 Thread Daniel P . Berrangé
On Tue, Feb 01, 2022 at 02:27:55PM +, M, Shivakumar wrote:
> Hi,
> 
> We are seeing an issue with udambuf, where it says "open /dev/udmabuf: No 
> such file or directory " even if the device exits. This issue particularly we 
> are seeing with libvirt. When we run the QEMU args on the command line, 
> everything works as expected.
> It seems to be some permission issue when we use the Libvirt, please help us 
> on resolving this.

When libvirt launches QEMU it puts in place a number of strict
security protections. Libvirt will grant access on a per-file
basis to resources on the host that QEMU should be allowed to
access based on the device configuration in the XML.

In your case though you're using command line passthrough:

>   
> 
> 
> 
> 
> 
>   

This is totally opaque to libvirt and so libvirt won't be
granting access to any resources needed by these args. I'm
assuming /dev/udmabuf is needed by the GTK display for GL
support, or something along those lines.

For further information about your options please consult this page:

  https://libvirt.org/kbase/qemu-passthrough-security.html

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 :|



Re: udmabuf error with libvirt + QEMU

2022-02-01 Thread Peter Krempa
On Tue, Feb 01, 2022 at 14:27:55 +, M, Shivakumar wrote:
> Hi,
> 
> We are seeing an issue with udambuf, where it says "open /dev/udmabuf: No 
> such file or directory " even if the device exits. This issue particularly we 
> are seeing with libvirt. When we run the QEMU args on the command line, 
> everything works as expected.
> It seems to be some permission issue when we use the Libvirt, please help us 
> on resolving this.

libvirt runs qemu in a mount namespace where we propagate only nodes
from /dev/ which are know and used by libvirt so that the qemu proces is
confined to only what it needs.

Ideally you'll impelemt the support for the 'blob' parameter you are
using in a way which allows the use of the appropriate files for qemu:

> 
> Libvirt XML:
> 
> http://libvirt.org/schemas/domain/qemu/1.0 type="kvm">
>   win-vm-0
>   4194304
>   4194304
>   
> 
>   
>   6
>   
> hvm
> 
> 
>   
>   
> 
> 
> 
>   
>   
>   
> 
> 
>   
>   
> 
>   
>   
>  
>   destroy
>   restart
>   destroy
>   
> /usr/bin/qemu-system-x86_64
> 
>   
>   
>   
>   
>   
>   
> 
> 
>   
>   
> 
> 
>   
>   
> 
>   
> 
> 
>   
>   
> 
> 
>   
>   
> 
>   
> 
>   
>   
> 
> 
> 
> 
> 

Libvirt doesn't interpret this in any way so you'll need to implement
support for what you want.

Alternatively as a proof-of-concept/workaround you can set the
'cgroup_device_acl' setting in /etc/libvirt/qemu.conf. But as noted that
is not really a supportable solution.