Message ID | 20230705100430.61927-1-maxime.coquelin@redhat.com (mailing list archive) |
---|---|
Headers | show |
Series | vduse: add support for networking devices | expand |
On Wed, Jul 05, 2023 at 12:04:27PM +0200, Maxime Coquelin wrote: > This small series enables virtio-net device type in VDUSE. > With it, basic operation have been tested, both with > virtio-vdpa and vhost-vdpa using DPDK Vhost library series > adding VDUSE support using split rings layout (merged in > DPDK v23.07-rc1). > > Control queue support (and so multiqueue) has also been > tested, but requires a Kernel series from Jason Wang > relaxing control queue polling [1] to function reliably, > so while Jason rework is done, a patch is added to disable > CVQ and features that depend on it (tested also with DPDK > v23.07-rc1). So I can put this in next, the issue I think is that of security: currently selinux can if necessary block access to creating virtio block devices. But if we have more than one type we need a way for selinux to block specific types. Can be a patch on top but pls work to address. Another question is that with this userspace can inject packets directly into net stack. Should we check CAP_NET_ADMIN or such? > [1]: https://lore.kernel.org/lkml/CACGkMEtgrxN3PPwsDo4oOsnsSLJfEmBEZ0WvjGRr3whU+QasUg@mail.gmail.com/T/ > > v2 -> v3 changes: > ================= > - Use allow list instead of deny list (Michael) > > v1 -> v2 changes: > ================= > - Add a patch to disable CVQ (Michael) > > RFC -> v1 changes: > ================== > - Fail device init if it does not support VERSION_1 (Jason) > > Maxime Coquelin (3): > vduse: validate block features only with block devices > vduse: enable Virtio-net device type > vduse: Temporarily disable control queue features > > drivers/vdpa/vdpa_user/vduse_dev.c | 51 +++++++++++++++++++++++++++--- > 1 file changed, 47 insertions(+), 4 deletions(-) > > -- > 2.41.0
On Thu, 10 Aug 2023 15:04:27 -0400 Michael S. Tsirkin wrote: > Another question is that with this userspace can inject > packets directly into net stack. Should we check CAP_NET_ADMIN > or such? Directly into the stack? I thought VDUSE is vDPA in user space, meaning to get to the kernel the packet has to first go thru a virtio-net instance. Or you mean directly into the network?
On Thu, Aug 10, 2023 at 02:29:49PM -0700, Jakub Kicinski wrote: > On Thu, 10 Aug 2023 15:04:27 -0400 Michael S. Tsirkin wrote: > > Another question is that with this userspace can inject > > packets directly into net stack. Should we check CAP_NET_ADMIN > > or such? > > Directly into the stack? I thought VDUSE is vDPA in user space, > meaning to get to the kernel the packet has to first go thru > a virtio-net instance. yes. is that a sufficient filter in your opinion? > Or you mean directly into the network?
On Thu, 10 Aug 2023 17:42:11 -0400 Michael S. Tsirkin wrote: > > Directly into the stack? I thought VDUSE is vDPA in user space, > > meaning to get to the kernel the packet has to first go thru > > a virtio-net instance. > > yes. is that a sufficient filter in your opinion? Yes, the ability to create the device feels stronger than CAP_NET_RAW, and a bit tangential to CAP_NET_ADMIN. But I don't have much practical experience with virt so no strong opinion, perhaps it does make sense for someone's deployment? Dunno..
On 8/11/23 00:00, Jakub Kicinski wrote: > On Thu, 10 Aug 2023 17:42:11 -0400 Michael S. Tsirkin wrote: >>> Directly into the stack? I thought VDUSE is vDPA in user space, >>> meaning to get to the kernel the packet has to first go thru >>> a virtio-net instance. >> >> yes. is that a sufficient filter in your opinion? > > Yes, the ability to create the device feels stronger than CAP_NET_RAW, > and a bit tangential to CAP_NET_ADMIN. But I don't have much practical > experience with virt so no strong opinion, perhaps it does make sense > for someone's deployment? Dunno.. > I'm not sure CAP_NET_ADMIN should be required for creating the VDUSE devices, as the device could be attached to vhost-vDPA and so not visible to the Kernel networking stack. However, CAP_NET_ADMIN should be required to attach the VDUSE device to virtio-vdpa/virtio-net. Does that make sense? Maxime
On Tue, Aug 29, 2023 at 03:34:06PM +0200, Maxime Coquelin wrote: > > > On 8/11/23 00:00, Jakub Kicinski wrote: > > On Thu, 10 Aug 2023 17:42:11 -0400 Michael S. Tsirkin wrote: > > > > Directly into the stack? I thought VDUSE is vDPA in user space, > > > > meaning to get to the kernel the packet has to first go thru > > > > a virtio-net instance. > > > > > > yes. is that a sufficient filter in your opinion? > > > > Yes, the ability to create the device feels stronger than CAP_NET_RAW, > > and a bit tangential to CAP_NET_ADMIN. But I don't have much practical > > experience with virt so no strong opinion, perhaps it does make sense > > for someone's deployment? Dunno.. > > > > I'm not sure CAP_NET_ADMIN should be required for creating the VDUSE > devices, as the device could be attached to vhost-vDPA and so not > visible to the Kernel networking stack. > > However, CAP_NET_ADMIN should be required to attach the VDUSE device to > virtio-vdpa/virtio-net. > > Does that make sense? > > Maxime OK. How are we going to enforce it? Also, we need a way for selinux to enable/disable some of these things but not others.
On 8/29/23 19:05, Michael S. Tsirkin wrote: > On Tue, Aug 29, 2023 at 03:34:06PM +0200, Maxime Coquelin wrote: >> >> >> On 8/11/23 00:00, Jakub Kicinski wrote: >>> On Thu, 10 Aug 2023 17:42:11 -0400 Michael S. Tsirkin wrote: >>>>> Directly into the stack? I thought VDUSE is vDPA in user space, >>>>> meaning to get to the kernel the packet has to first go thru >>>>> a virtio-net instance. >>>> >>>> yes. is that a sufficient filter in your opinion? >>> >>> Yes, the ability to create the device feels stronger than CAP_NET_RAW, >>> and a bit tangential to CAP_NET_ADMIN. But I don't have much practical >>> experience with virt so no strong opinion, perhaps it does make sense >>> for someone's deployment? Dunno.. >>> >> >> I'm not sure CAP_NET_ADMIN should be required for creating the VDUSE >> devices, as the device could be attached to vhost-vDPA and so not >> visible to the Kernel networking stack. >> >> However, CAP_NET_ADMIN should be required to attach the VDUSE device to >> virtio-vdpa/virtio-net. >> >> Does that make sense? >> >> Maxime > > OK. How are we going to enforce it? Actually, it seems already enforced for all VDPA devices types. Indeed, the VDPA_CMD_DEV_NEW Netlink command used to add the device to the VDPA bus has the GENL_ADMIN_PERM flag set, and so require CAT_NET_ADMIN. > Also, we need a way for selinux to enable/disable some of these things > but not others. Ok, I can do it in a patch on top. Do you have a pointer where it is done for Virtio Block devices? Maxime
On Wed, Aug 30, 2023 at 01:27:18PM +0200, Maxime Coquelin wrote: > > > On 8/29/23 19:05, Michael S. Tsirkin wrote: > > On Tue, Aug 29, 2023 at 03:34:06PM +0200, Maxime Coquelin wrote: > > > > > > > > > On 8/11/23 00:00, Jakub Kicinski wrote: > > > > On Thu, 10 Aug 2023 17:42:11 -0400 Michael S. Tsirkin wrote: > > > > > > Directly into the stack? I thought VDUSE is vDPA in user space, > > > > > > meaning to get to the kernel the packet has to first go thru > > > > > > a virtio-net instance. > > > > > > > > > > yes. is that a sufficient filter in your opinion? > > > > > > > > Yes, the ability to create the device feels stronger than CAP_NET_RAW, > > > > and a bit tangential to CAP_NET_ADMIN. But I don't have much practical > > > > experience with virt so no strong opinion, perhaps it does make sense > > > > for someone's deployment? Dunno.. > > > > > > > > > > I'm not sure CAP_NET_ADMIN should be required for creating the VDUSE > > > devices, as the device could be attached to vhost-vDPA and so not > > > visible to the Kernel networking stack. > > > > > > However, CAP_NET_ADMIN should be required to attach the VDUSE device to > > > virtio-vdpa/virtio-net. > > > > > > Does that make sense? > > > > > > Maxime > > > > OK. How are we going to enforce it? > > Actually, it seems already enforced for all VDPA devices types. > Indeed, the VDPA_CMD_DEV_NEW Netlink command used to add the device to > the VDPA bus has the GENL_ADMIN_PERM flag set, and so require > CAT_NET_ADMIN. Hmm good point. Pity I didn't notice earlier. Oh well there's always the next release. > > Also, we need a way for selinux to enable/disable some of these things > > but not others. > > Ok, I can do it in a patch on top. > Do you have a pointer where it is done for Virtio Block devices? > > Maxime It's not done yet - at the moment vduse device is always block so we didn't need the distinction.