[libvirt] [PATCH RFC] qemu: caps: Don't try to ask for CAP_DAC_OVERRIDE if non-root

Peter Krempa pkrempa at redhat.com
Mon Feb 4 15:32:52 UTC 2019


On Mon, Feb 04, 2019 at 16:26:02 +0100, Peter Krempa wrote:
> It will not work. This breaks qemu capabilities probing as a user.
> ---
>  src/qemu/qemu_capabilities.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 7ed5f94803..81ef0357e7 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -4524,7 +4524,8 @@ virQEMUCapsInitQMPCommandRun(virQEMUCapsInitQMPCommandPtr cmd,
>  #if WITH_CAPNG
>      /* QEMU might run into permission issues, e.g. /dev/sev (0600), override
>       * them just for the purpose of probing */
> -    virCommandAllowCap(cmd->cmd, CAP_DAC_OVERRIDE);
> +    if (geteuid() == 0)

Possibly replacing this with driver->privileged for the qemu driver but
that is not easily accessible.

> +        virCommandAllowCap(cmd->cmd, CAP_DAC_OVERRIDE);
>  #endif
> 
>      virCommandSetGID(cmd->cmd, cmd->runGid);
> -- 
> 2.20.1
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190204/d78d7ce7/attachment-0001.sig>


More information about the libvir-list mailing list