[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-f454b478861325f067fd58ba7ee9f1b5c4a9d6a0@git.kernel.org>
Date: Mon, 14 Sep 2015 05:20:44 -0700
From: tip-bot for Jan Beulich <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: hpa@...or.com, boris.ostrovsky@...cle.com, konrad.wilk@...cle.com,
jbeulich@...e.com, mingo@...nel.org, tglx@...utronix.de,
JBeulich@...e.com, brgerst@...il.com, bp@...en8.de,
luto@...nel.org, dvlasenk@...hat.com, david.vrabel@...rix.com,
linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
luto@...capital.net, peterz@...radead.org
Subject: [tip:x86/urgent] x86/ldt: Fix small LDT allocation for Xen
Commit-ID: f454b478861325f067fd58ba7ee9f1b5c4a9d6a0
Gitweb: http://git.kernel.org/tip/f454b478861325f067fd58ba7ee9f1b5c4a9d6a0
Author: Jan Beulich <JBeulich@...e.com>
AuthorDate: Wed, 2 Sep 2015 09:45:58 -0600
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Mon, 14 Sep 2015 12:10:50 +0200
x86/ldt: Fix small LDT allocation for Xen
While the following commit:
37868fe113 ("x86/ldt: Make modify_ldt synchronous")
added a nice comment explaining that Xen needs page-aligned
whole page chunks for guest descriptor tables, it then
nevertheless used kzalloc() on the small size path.
As I'm unaware of guarantees for kmalloc(PAGE_SIZE, ) to return
page-aligned memory blocks, I believe this needs to be switched
back to __get_free_page() (or better get_zeroed_page()).
Signed-off-by: Jan Beulich <jbeulich@...e.com>
Cc: Andy Lutomirski <luto@...capital.net>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Boris Ostrovsky <boris.ostrovsky@...cle.com>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Brian Gerst <brgerst@...il.com>
Cc: David Vrabel <david.vrabel@...rix.com>
Cc: Denys Vlasenko <dvlasenk@...hat.com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Link: http://lkml.kernel.org/r/55E735D6020000780009F1E6@prv-mh.provo.novell.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
arch/x86/kernel/ldt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c
index 2bcc052..6acc9dd 100644
--- a/arch/x86/kernel/ldt.c
+++ b/arch/x86/kernel/ldt.c
@@ -58,7 +58,7 @@ static struct ldt_struct *alloc_ldt_struct(int size)
if (alloc_size > PAGE_SIZE)
new_ldt->entries = vzalloc(alloc_size);
else
- new_ldt->entries = kzalloc(PAGE_SIZE, GFP_KERNEL);
+ new_ldt->entries = (void *)get_zeroed_page(GFP_KERNEL);
if (!new_ldt->entries) {
kfree(new_ldt);
@@ -95,7 +95,7 @@ static void free_ldt_struct(struct ldt_struct *ldt)
if (ldt->size * LDT_ENTRY_SIZE > PAGE_SIZE)
vfree(ldt->entries);
else
- kfree(ldt->entries);
+ free_page((unsigned long)ldt->entries);
kfree(ldt);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists