public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Jens Axboe <jens.axboe@oracle.com>, Tejun Heo <htejun@gmail.com>,
	Arjan van de Ven <arjan@infradead.org>,
	Hugh Dickins <hugh@veritas.com>,
	linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: [PATCH] xen: fix scrub_page()
Date: Mon, 17 Nov 2008 19:14:22 +0100	[thread overview]
Message-ID: <20081117181422.GA8321@elte.hu> (raw)
In-Reply-To: <4921AB44.4090706@goop.org>


* Jeremy Fitzhardinge <jeremy@goop.org> wrote:

>> Secondly, we actually have a function called "clear_highpage()" 
>> that does this, except it uses kmap_atomic(page, KM_USER0). Which 
>> is _probably better anyway, but I didn't check if there is some 
>> magical reason why it wouldn't work.
>
> OK.

applied it with the changelog below to tip/x86/urgent, thanks guys! 

AFAICS CONFIG_XEN_SCRUB_PAGES=y could not possibly have worked before 
(kunmapping the wrong address is a crasher), so there's little 
practical risk from using an atomic kmap here.

	Ingo

-------------->
>From 26a3e99160cfb06a0a33e25b9fb0d516e2cc680d Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy@goop.org>
Date: Mon, 17 Nov 2008 09:35:00 -0800
Subject: [PATCH] xen: fix scrub_page()

Impact: fix guest kernel crash with CONFIG_XEN_SCRUB_PAGES=y

Jens noticed that scrub_page() has a buggy unmap of the wrong
thing. (virtual address instead of page)

Linus pointed out that the whole scrub_page() code is an unnecessary
reimplementation of clear_highpage() to begin with.

Just use clear_highpage() rather than reimplementing it poorly.

Reported-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 drivers/xen/balloon.c |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index a0fb5ea..526c191 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -122,14 +122,7 @@ static struct timer_list balloon_timer;
 static void scrub_page(struct page *page)
 {
 #ifdef CONFIG_XEN_SCRUB_PAGES
-	if (PageHighMem(page)) {
-		void *v = kmap(page);
-		clear_page(v);
-		kunmap(v);
-	} else {
-		void *v = page_address(page);
-		clear_page(v);
-	}
+	clear_highpage(page);
 #endif
 }
 


  reply	other threads:[~2008-11-17 18:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-15 19:27 [PATCH] Fix kunmap() argument in sg_miter_stop Arjan van de Ven
2008-11-15 20:15 ` Hugh Dickins
2008-11-15 20:27   ` Arjan van de Ven
2008-11-15 20:39   ` Arjan van de Ven
2008-11-16  5:16     ` Tejun Heo
2008-11-17  8:11       ` Jens Axboe
2008-11-17  8:22         ` Ingo Molnar
2008-11-17  8:30           ` Jens Axboe
2008-11-17  8:50             ` Ingo Molnar
2008-11-17  8:58               ` Jens Axboe
2008-11-17  9:34                 ` Jens Axboe
2008-11-17  9:41                   ` Ingo Molnar
2008-11-17  9:45                     ` Jens Axboe
2008-11-17 11:13                       ` Jens Axboe
2008-11-17 17:08                         ` Jeremy Fitzhardinge
2008-11-17 17:10                           ` Ingo Molnar
2008-11-17 17:15                             ` Jeremy Fitzhardinge
2008-11-17 17:25                               ` Linus Torvalds
2008-11-17 17:35                                 ` Jeremy Fitzhardinge
2008-11-17 18:14                                   ` Ingo Molnar [this message]
2008-11-17 18:07                                 ` Jens Axboe
2008-11-17 18:16                                   ` Linus Torvalds
2008-11-17 18:26                                     ` Jens Axboe
2008-11-18  8:27                                       ` Ingo Molnar

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=20081117181422.GA8321@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=htejun@gmail.com \
    --cc=hugh@veritas.com \
    --cc=jens.axboe@oracle.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox