<div dir="ltr">Hi guys,<div><br></div><div>I have got a question. I need to add apparmor support for vhost-user socket files used to communicate with the vhost-user server app. Those ones defined with something like:</div><div><interface type='vhostuser'><br></div>      <mac address='02:ed:f3:5d:de:f3'/><br>      <source type='unix' path='/var/run/vrouter/uvh_vif_tapa8396c51-2a' mode='client'/><br>      <model type='virtio'/><br>      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/><br></interface><div><br></div><div>I added something like this into get_files() function in virt-aa-helper.c:</div><div><div>    for (i = 0; i < ctl->def->nnets; i++) {</div><div>        if (ctl->def->nets[i] &&</div><div>                ctl->def->nets[i]->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER &&</div><div>                ctl->def->nets[i]->data.vhostuser) {</div><div>            virDomainChrSourceDefPtr vhu = ctl->def->nets[i]->data.vhostuser;</div><div><br></div><div>            if (vah_add_file_chardev(&buf, vhu->data.nix.path, "rw",</div><div>                       vhu->type) != 0)</div><div>                goto cleanup;</div><div>        }</div><div>    }</div></div><div><br></div><div>However, there is a restriction for the socket file types in valid_path() function:</div><div><div>        switch (sb.st_mode & S_IFMT) {</div><div>            case S_IFSOCK:</div><div>                return 1;</div><div>                break;</div><div>            default:</div><div>                break;</div><div>        }</div></div><div>That prevents this from working.</div><div><br></div><div>May I ask why the socket file types are restricted? Vhost-user uses sockets so if I want to use apparmor virt-aa-helper has to be able to add the line for the socket file into /etc/apparmor.d/libvirt/libvirt-UUID.files.</div><div><br></div><div>Regards,<br>Michal </div><div><br></div></div>