Thread (73 messages) 73 messages, 4 authors, 2021-07-09

Re: [PATCH] net: tun: fix tun_xdp_one() for IFF_TUN mode

From: David Woodhouse <dwmw2@infradead.org>
Date: 2021-06-24 12:39:40

On Wed, 2021-06-23 at 11:39 +0800, Jason Wang wrote:
quoted
In the 1:1 mode, the access_ok() is all that's needed since there's no
translation.
@@ -2038,6 +2065,14 @@ static int translate_desc(struct vhost_virtqueue *vq, u64 addr, u32 len,
          u64 s = 0;
          int ret = 0;
   
+       if (vhost_has_feature(vq, VHOST_F_IDENTITY_MAPPING)) {

Using vhost_has_feature() is kind of tricky since it's used for virtio 
feature negotiation.

We probably need to use backend_features instead.

I think we should probably do more:

1) forbid the feature to be set when mem table / IOTLB has at least one 
mapping
2) forbid the mem table / IOTLB updating after the feature is set
Yes, that all makes sense. I confess I hadn't actually *implemented*
the feature at all; the only time I'd typed 'VHOST_F_IDENTITY_MAPPING'
was to show that snippet of "patch" as an example of what
translate_desc() would do. I just wanted *something* to put in the
'if()' statement as a placeholder, so I used that.

It could *even* have just been 'if (!umem)' but that might let it
happen by *accident* which probably isn't a good idea.

Attachments

  • smime.p7s [application/x-pkcs7-signature] 5174 bytes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help