lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 5 Feb 2021 11:18:36 +0800
From:   Jason Wang <jasowang@...hat.com>
To:     Stefano Garzarella <sgarzare@...hat.com>,
        virtualization@...ts.linux-foundation.org
Cc:     Xie Yongji <xieyongji@...edance.com>, kvm@...r.kernel.org,
        Laurent Vivier <lvivier@...hat.com>,
        Stefan Hajnoczi <stefanha@...hat.com>,
        Max Gurtovoy <mgurtovoy@...dia.com>,
        linux-kernel@...r.kernel.org, "Michael S. Tsirkin" <mst@...hat.com>
Subject: Re: [PATCH v3 04/13] vringh: explain more about cleaning riov and
 wiov


On 2021/2/5 上午1:22, Stefano Garzarella wrote:
> riov and wiov can be reused with subsequent calls of vringh_getdesc_*().
>
> Let's add a paragraph in the documentation of these functions to better
> explain when riov and wiov need to be cleaned up.
>
> Signed-off-by: Stefano Garzarella <sgarzare@...hat.com>
> ---
>   drivers/vhost/vringh.c | 15 ++++++++++++---
>   1 file changed, 12 insertions(+), 3 deletions(-)


Acked-by: Jason Wang <jasowang@...hat.com>


>
> diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
> index bee63d68201a..2a88e087afd8 100644
> --- a/drivers/vhost/vringh.c
> +++ b/drivers/vhost/vringh.c
> @@ -662,7 +662,10 @@ EXPORT_SYMBOL(vringh_init_user);
>    * *head will be vrh->vring.num.  You may be able to ignore an invalid
>    * descriptor, but there's not much you can do with an invalid ring.
>    *
> - * Note that you may need to clean up riov and wiov, even on error!
> + * Note that you can reuse riov and wiov with subsequent calls. Content is
> + * overwritten and memory reallocated if more space is needed.
> + * When you don't have to use riov and wiov anymore, you should clean up them
> + * calling vringh_iov_cleanup() to release the memory, even on error!
>    */
>   int vringh_getdesc_user(struct vringh *vrh,
>   			struct vringh_iov *riov,
> @@ -932,7 +935,10 @@ EXPORT_SYMBOL(vringh_init_kern);
>    * *head will be vrh->vring.num.  You may be able to ignore an invalid
>    * descriptor, but there's not much you can do with an invalid ring.
>    *
> - * Note that you may need to clean up riov and wiov, even on error!
> + * Note that you can reuse riov and wiov with subsequent calls. Content is
> + * overwritten and memory reallocated if more space is needed.
> + * When you don't have to use riov and wiov anymore, you should clean up them
> + * calling vringh_kiov_cleanup() to release the memory, even on error!
>    */
>   int vringh_getdesc_kern(struct vringh *vrh,
>   			struct vringh_kiov *riov,
> @@ -1292,7 +1298,10 @@ EXPORT_SYMBOL(vringh_set_iotlb);
>    * *head will be vrh->vring.num.  You may be able to ignore an invalid
>    * descriptor, but there's not much you can do with an invalid ring.
>    *
> - * Note that you may need to clean up riov and wiov, even on error!
> + * Note that you can reuse riov and wiov with subsequent calls. Content is
> + * overwritten and memory reallocated if more space is needed.
> + * When you don't have to use riov and wiov anymore, you should clean up them
> + * calling vringh_kiov_cleanup() to release the memory, even on error!
>    */
>   int vringh_getdesc_iotlb(struct vringh *vrh,
>   			 struct vringh_kiov *riov,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ