<div dir="ltr">Thanks Jamie for the explanation.<div><br></div><div>Regards,</div><div>Michal</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 16 June 2015 at 17:15, Jamie Strandboge <span dir="ltr"><<a href="mailto:jamie@canonical.com" target="_blank">jamie@canonical.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 06/16/2015 08:40 AM, Michał Dubiel wrote:<br>
> Hi all,<br>
><br>
> May I kindly ask someone for some advice on this topic?<br>
><br>
> Regards,<br>
> Michal<br>
><br>
> On 21 May 2015 at 20:23, Michał Dubiel <<a href="mailto:md@semihalf.com">md@semihalf.com</a><br>
</span><div><div class="h5">> <mailto:<a href="mailto:md@semihalf.com">md@semihalf.com</a>>> wrote:<br>
><br>
>     Hi guys,<br>
><br>
>     I have got a question. I need to add apparmor support for vhost-user socket<br>
>     files used to communicate with the vhost-user server app. Those ones defined<br>
>     with something like:<br>
>     <interface type='vhostuser'><br>
>           <mac address='02:ed:f3:5d:de:f3'/><br>
>           <source type='unix' path='/var/run/vrouter/uvh_vif_tapa8396c51-2a'<br>
>     mode='client'/><br>
>           <model type='virtio'/><br>
>           <address type='pci' domain='0x0000' bus='0x00' slot='0x03'<br>
>     function='0x0'/><br>
>     </interface><br>
><br>
>     I added something like this into get_files() function in virt-aa-helper.c:<br>
>         for (i = 0; i < ctl->def->nnets; i++) {<br>
>             if (ctl->def->nets[i] &&<br>
>                     ctl->def->nets[i]->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER &&<br>
>                     ctl->def->nets[i]->data.vhostuser) {<br>
>                 virDomainChrSourceDefPtr vhu = ctl->def->nets[i]->data.vhostuser;<br>
><br>
>                 if (vah_add_file_chardev(&buf, vhu->data.nix.path, "rw",<br>
>                            vhu->type) != 0)<br>
>                     goto cleanup;<br>
>             }<br>
>         }<br>
><br>
>     However, there is a restriction for the socket file types in valid_path()<br>
>     function:<br>
>             switch (sb.st_mode & S_IFMT) {<br>
>                 case S_IFSOCK:<br>
>                     return 1;<br>
>                     break;<br>
>                 default:<br>
>                     break;<br>
>             }<br>
>     That prevents this from working.<br>
><br>
>     May I ask why the socket file types are restricted? Vhost-user uses sockets<br>
>     so if I want to use apparmor virt-aa-helper has to be able to add the line<br>
>     for the socket file into /etc/apparmor.d/libvirt/libvirt-UUID.files.<br>
><br>
<br>
</div></div>They are restricted only because at the time virt-aa-helper.c was written there<br>
wasn't a valid use for them. There were more checks in this part of the code but<br>
over the years as more valid types were added to libvirt, they've been removed<br>
and now we are left with just this one. Since there is now a valid usecase for<br>
S_IFSOCK, it seems this can simply be removed.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Jamie Strandboge                 <a href="http://www.ubuntu.com/" rel="noreferrer" target="_blank">http://www.ubuntu.com/</a><br>
<br>
</font></span><br>--<br>
libvir-list mailing list<br>
<a href="mailto:libvir-list@redhat.com">libvir-list@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/libvir-list" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/libvir-list</a><br></blockquote></div><br></div>