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] [day] [month] [year] [list]
Message-ID: <20191119043648-mutt-send-email-mst@kernel.org>
Date:   Tue, 19 Nov 2019 04:37:39 -0500
From:   "Michael S. Tsirkin" <mst@...hat.com>
To:     Wei Wang <wei.w.wang@...el.com>
Cc:     Khazhismel Kumykov <khazhy@...gle.com>, jasowang@...hat.com,
        linux-kernel@...r.kernel.org,
        virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH 1/2] virtio_balloon: fix pages_to_free calculation

On Tue, Nov 19, 2019 at 01:38:44PM +0800, Wei Wang wrote:
> On 11/19/2019 07:08 AM, Michael S. Tsirkin wrote:
> > So I really think we should do something like the below instead.
> > Limit playing with balloon pages so we can gradually limit it to legacy.
> > Testing, review would be appreciated.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@...hat.com>
> > 
> > 
> > diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> > index 226fbb995fb0..7cee05cdf3fb 100644
> > --- a/drivers/virtio/virtio_balloon.c
> > +++ b/drivers/virtio/virtio_balloon.c
> > @@ -772,6 +772,13 @@ static unsigned long shrink_free_pages(struct virtio_balloon *vb,
> >   	return blocks_freed << VIRTIO_BALLOON_FREE_PAGE_ORDER;
> >   }
> > +static unsigned long leak_balloon_pages(struct virtio_balloon *vb,
> > +                                          unsigned long pages_to_free)
> > +{
> > +	return leak_balloon(vb, pages_to_free * VIRTIO_BALLOON_PAGES_PER_PAGE) /
> > +		VIRTIO_BALLOON_PAGES_PER_PAGE;
> > +}
> > +
> 
> Looks good to me, too. (just a reminder that the returning type of
> leak_balloon is "unsigned int",

Yea that use of 32 bit integers is another problem with the existing interfaces.

> we may want them to be consistent).
> 
> Reviewed-by: Wei Wang <wei.w.wang@...el.com>
> 
> Best,
> Wei

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ