From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753417AbbINMVz (ORCPT ); Mon, 14 Sep 2015 08:21:55 -0400 Received: from terminus.zytor.com ([198.137.202.10]:34990 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750968AbbINMVx (ORCPT ); Mon, 14 Sep 2015 08:21:53 -0400 Date: Mon, 14 Sep 2015 05:20:44 -0700 From: tip-bot for Jan Beulich Message-ID: Cc: hpa@zytor.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, jbeulich@suse.com, mingo@kernel.org, tglx@linutronix.de, JBeulich@suse.com, brgerst@gmail.com, bp@alien8.de, luto@kernel.org, dvlasenk@redhat.com, david.vrabel@citrix.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, luto@amacapital.net, peterz@infradead.org Reply-To: peterz@infradead.org, luto@amacapital.net, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, david.vrabel@citrix.com, brgerst@gmail.com, luto@kernel.org, bp@alien8.de, dvlasenk@redhat.com, tglx@linutronix.de, JBeulich@suse.com, mingo@kernel.org, jbeulich@suse.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, hpa@zytor.com In-Reply-To: <55E735D6020000780009F1E6@prv-mh.provo.novell.com> References: <55E735D6020000780009F1E6@prv-mh.provo.novell.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/ldt: Fix small LDT allocation for Xen Git-Commit-ID: f454b478861325f067fd58ba7ee9f1b5c4a9d6a0 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: f454b478861325f067fd58ba7ee9f1b5c4a9d6a0 Gitweb: http://git.kernel.org/tip/f454b478861325f067fd58ba7ee9f1b5c4a9d6a0 Author: Jan Beulich AuthorDate: Wed, 2 Sep 2015 09:45:58 -0600 Committer: Ingo Molnar 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 Cc: Andy Lutomirski Cc: Andy Lutomirski Cc: Boris Ostrovsky Cc: Borislav Petkov Cc: Brian Gerst Cc: David Vrabel Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Konrad Rzeszutek Wilk Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/55E735D6020000780009F1E6@prv-mh.provo.novell.com Signed-off-by: Ingo Molnar --- 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); }