From: Minchan Kim <minchan@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
Konstantin Khlebnikov <koct9i@gmail.com>,
Rafael Aquini <aquini@redhat.com>,
Minchan Kim <minchan@kernel.org>,
stable@vger.kernel.org
Subject: [PATCH 1/2] virtio_balloon: fix race by fill and leak
Date: Mon, 28 Dec 2015 08:35:12 +0900 [thread overview]
Message-ID: <1451259313-26353-1-git-send-email-minchan@kernel.org> (raw)
During my compaction-related stuff, I encountered a bug
with ballooning.
With repeated inflating and deflating cycle, guest memory(
ie, cat /proc/meminfo | grep MemTotal) is decreased and
couldn't be recovered.
The reason is balloon_lock doesn't cover release_pages_balloon
so struct virtio_balloon fields could be overwritten by race
of fill_balloon(e,g, vb->*pfns could be critical).
This patch fixes it in my test.
Cc: <stable@vger.kernel.org>
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
drivers/virtio/virtio_balloon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 7efc32945810..7d3e5d0e9aa4 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -209,8 +209,8 @@ static unsigned leak_balloon(struct virtio_balloon *vb, size_t num)
*/
if (vb->num_pfns != 0)
tell_host(vb, vb->deflate_vq);
- mutex_unlock(&vb->balloon_lock);
release_pages_balloon(vb);
+ mutex_unlock(&vb->balloon_lock);
return num_freed_pages;
}
--
1.9.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Minchan Kim <minchan@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
Konstantin Khlebnikov <koct9i@gmail.com>,
Rafael Aquini <aquini@redhat.com>,
Minchan Kim <minchan@kernel.org>, <stable@vger.kernel.org>
Subject: [PATCH 1/2] virtio_balloon: fix race by fill and leak
Date: Mon, 28 Dec 2015 08:35:12 +0900 [thread overview]
Message-ID: <1451259313-26353-1-git-send-email-minchan@kernel.org> (raw)
During my compaction-related stuff, I encountered a bug
with ballooning.
With repeated inflating and deflating cycle, guest memory(
ie, cat /proc/meminfo | grep MemTotal) is decreased and
couldn't be recovered.
The reason is balloon_lock doesn't cover release_pages_balloon
so struct virtio_balloon fields could be overwritten by race
of fill_balloon(e,g, vb->*pfns could be critical).
This patch fixes it in my test.
Cc: <stable@vger.kernel.org>
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
drivers/virtio/virtio_balloon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 7efc32945810..7d3e5d0e9aa4 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -209,8 +209,8 @@ static unsigned leak_balloon(struct virtio_balloon *vb, size_t num)
*/
if (vb->num_pfns != 0)
tell_host(vb, vb->deflate_vq);
- mutex_unlock(&vb->balloon_lock);
release_pages_balloon(vb);
+ mutex_unlock(&vb->balloon_lock);
return num_freed_pages;
}
--
1.9.1
WARNING: multiple messages have this Message-ID (diff)
From: Minchan Kim <minchan@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
Konstantin Khlebnikov <koct9i@gmail.com>,
Rafael Aquini <aquini@redhat.com>,
Minchan Kim <minchan@kernel.org>, <stable@vger.kernel.org>
Subject: [PATCH 1/2] virtio_balloon: fix race by fill and leak
Date: Mon, 28 Dec 2015 08:35:12 +0900 [thread overview]
Message-ID: <1451259313-26353-1-git-send-email-minchan@kernel.org> (raw)
During my compaction-related stuff, I encountered a bug
with ballooning.
With repeated inflating and deflating cycle, guest memory(
ie, cat /proc/meminfo | grep MemTotal) is decreased and
couldn't be recovered.
The reason is balloon_lock doesn't cover release_pages_balloon
so struct virtio_balloon fields could be overwritten by race
of fill_balloon(e,g, vb->*pfns could be critical).
This patch fixes it in my test.
Cc: <stable@vger.kernel.org>
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
drivers/virtio/virtio_balloon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 7efc32945810..7d3e5d0e9aa4 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -209,8 +209,8 @@ static unsigned leak_balloon(struct virtio_balloon *vb, size_t num)
*/
if (vb->num_pfns != 0)
tell_host(vb, vb->deflate_vq);
- mutex_unlock(&vb->balloon_lock);
release_pages_balloon(vb);
+ mutex_unlock(&vb->balloon_lock);
return num_freed_pages;
}
--
1.9.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2015-12-27 23:34 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-27 23:35 Minchan Kim [this message]
2015-12-27 23:35 ` [PATCH 1/2] virtio_balloon: fix race by fill and leak Minchan Kim
2015-12-27 23:35 ` Minchan Kim
2015-12-27 23:35 ` [PATCH 2/2] virtio_balloon: fix race between migration and ballooning Minchan Kim
2015-12-27 23:35 ` Minchan Kim
2015-12-27 23:35 ` Minchan Kim
2015-12-27 23:36 ` Rafael Aquini
2015-12-27 23:36 ` Rafael Aquini
2015-12-27 23:36 ` Rafael Aquini
2016-01-01 9:36 ` Michael S. Tsirkin
2016-01-01 9:36 ` Michael S. Tsirkin
2016-01-01 9:36 ` Michael S. Tsirkin
2016-01-04 0:27 ` Minchan Kim
2016-01-04 0:27 ` Minchan Kim
2016-01-04 0:27 ` Minchan Kim
2016-01-10 21:40 ` Michael S. Tsirkin
2016-01-10 21:40 ` Michael S. Tsirkin
2016-01-10 23:54 ` Minchan Kim
2016-01-10 23:54 ` Minchan Kim
2016-01-10 23:54 ` Minchan Kim
2016-01-10 21:40 ` Michael S. Tsirkin
2016-01-08 19:56 ` Rafael Aquini
2016-01-08 19:56 ` Rafael Aquini
2016-01-08 19:56 ` Rafael Aquini
2016-01-08 23:43 ` Minchan Kim
2016-01-08 23:43 ` Minchan Kim
2016-01-08 23:43 ` Minchan Kim
2016-01-09 21:43 ` Michael S. Tsirkin
2016-01-09 21:43 ` Michael S. Tsirkin
2016-01-09 21:43 ` Michael S. Tsirkin
2016-01-09 23:03 ` Rafael Aquini
2016-01-09 23:03 ` Rafael Aquini
2016-01-09 23:03 ` Rafael Aquini
2015-12-27 23:35 ` Minchan Kim
2015-12-27 23:36 ` [PATCH 1/2] virtio_balloon: fix race by fill and leak Rafael Aquini
2015-12-27 23:36 ` Rafael Aquini
2015-12-27 23:36 ` Rafael Aquini
2016-01-01 8:26 ` Michael S. Tsirkin
2016-01-01 8:26 ` Michael S. Tsirkin
2016-01-01 8:26 ` Michael S. Tsirkin
-- strict thread matches above, loose matches on Subject: below --
2015-12-27 23:35 Minchan Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1451259313-26353-1-git-send-email-minchan@kernel.org \
--to=minchan@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=aquini@redhat.com \
--cc=koct9i@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mst@redhat.com \
--cc=stable@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.