Re: [PATCH] qemu: fix improper initialization of cgroupControllers bitmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 12, 2016 at 01:50:44PM -0400, Laine Stump wrote:
> virQEMUDriverConfigNew() always initializes the bitmap in its
> cgroupControllers member to -1 (i.e. all 1's).
> 
> Prior to commit a9331394, if qemu.conf had a line with
> "cgroup_controllers", cgroupControllers would get reset to 0 before
> going through a loop setting a bit for each named cgroup
> controller. commit a9331394 left out the "reset to 0" part, so
> cgroupControllers would always be -1; if you didn't want a controller
> included, there was no longer a way to make that happen.
> 
> This was discovered by users who were using qemu commandline
> passthrough to use the "input-linux" method of directing
> keyboard/mouse input to a virtual machine:
> 
> https://www.redhat.com/archives/vfio-users/2016-April/msg00105.html
> 
> Here's the first report I found of the problem encountered after
> upgrading libvirt beyond v2.0.0:
> 
> https://www.redhat.com/archives/vfio-users/2016-August/msg00053.html
> 
> Thanks to sL1pKn07 SpinFlo <sl1pkn07@xxxxxxxxx> for bringing the
> problem up in IRC, and then taking the time to do a git bisect and
> find the patch that started the problem.
> ---
>  src/qemu/qemu_conf.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
> index e7b2d8d..dad8334 100644
> --- a/src/qemu/qemu_conf.c
> +++ b/src/qemu/qemu_conf.c
> @@ -613,15 +613,18 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
>                                    &controllers) < 0)
>          goto cleanup;
>  
> -    for (i = 0; controllers != NULL && controllers[i] != NULL; i++) {
> -        int ctl;
> -        if ((ctl = virCgroupControllerTypeFromString(controllers[i])) < 0) {
> -            virReportError(VIR_ERR_CONF_SYNTAX,
> -                           _("Unknown cgroup controller '%s'"),
> -                           controllers[i]);
> -            goto cleanup;
> +    if (controllers) {
> +        cfg-> cgroupControllers = 0;
> +        for (i = 0; controllers[i] != NULL; i++) {
> +            int ctl;
> +            if ((ctl = virCgroupControllerTypeFromString(controllers[i])) < 0) {
> +                virReportError(VIR_ERR_CONF_SYNTAX,
> +                               _("Unknown cgroup controller '%s'"),
> +                               controllers[i]);
> +                goto cleanup;
> +            }
> +            cfg->cgroupControllers |= (1 << ctl);
>          }
> -        cfg->cgroupControllers |= (1 << ctl);
>      }
>  
>      if (virConfGetValueStringList(conf,  "cgroup_device_acl", false,

ACK


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]