Re: [PATCH 3/4] virt-aa-helper: generate rules for passthrough input devices

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

 





On Tue, Mar 20, 2018 at 10:00 PM, Jamie Strandboge <jamie@xxxxxxxxxxxxx> wrote:
On Tue, 2018-03-20 at 13:08 +0100, Christian Ehrhardt wrote:
> Input devices can passthrough an event device. This currently works
> only via
> hotplug where the AppArmor label is created via the domain label
> callbacks.
>
> This adds the virt-aa-helper support for passthrough input devices to
> generate
> rules for the needed paths from the initial guest definition as well.
>
> Example in domain xml:
>   <input type='passthrough' bus='virtio'>
>           <source evdev='/dev/input/event0' />
>   </input>
> Works to start now and creates:
>   "/dev/input/event0" rw,
>
> Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1757085
>
> Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> ---
>  src/security/virt-aa-helper.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-
> helper.c
> index 456cfce..1fc482d 100644
> --- a/src/security/virt-aa-helper.c
> +++ b/src/security/virt-aa-helper.c
> @@ -1157,6 +1157,13 @@ get_files(vahControl * ctl)
>          }
>      }
>
> +    for (i = 0; i < ctl->def->ninputs; i++) {
> +        if (ctl->def->inputs[i]->type ==
> VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH) {

'if (ctl->def->inputs[i] && ctl->def->inputs[i]->type ==
VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH)', no?

Yes, checking the pointer to be valid is certainly better
Will be in a V2 of the series.
 
> +            if (vah_add_file(&buf, ctl->def->inputs[i]-
> >source.evdev, "rw") != 0)
> +                goto cleanup;
> +        }
> +    }
> +
>      for (i = 0; i < ctl->def->nnets; i++) {
>          if (ctl->def->nets[i] &&
>                  ctl->def->nets[i]->type ==
> VIR_DOMAIN_NET_TYPE_VHOSTUSER &&

Adding test cases for this would be good.

Yes, I agree - will be in a V2
 
--
Jamie Strandboge             | http://www.canonical.com



--
Christian Ehrhardt
Software Engineer, Ubuntu Server
Canonical Ltd
--
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]

  Powered by Linux