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
| ||
|
Date: Wed, 2 Sep 2015 07:08:18 -0700 From: Andy Lutomirski <luto@...capital.net> To: Jan Beulich <JBeulich@...e.com> Cc: Boris Ostrovsky <boris.ostrovsky@...cle.com>, "H. Peter Anvin" <hpa@...or.com>, Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>, David Vrabel <david.vrabel@...rix.com>, "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...e.hu>, Thomas Gleixner <tglx@...utronix.de> Subject: Re: [PATCH v2] x86: fix small LDT allocation for Xen On Sep 2, 2015 5:46 AM, "Jan Beulich" <JBeulich@...e.com> wrote: > > While 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(). > > Signed-off-by: Jan Beulich <jbeulich@...e.com> > Cc: Andy Lutomirski <luto@...nel.org> > Cc: Boris Ostrovsky <boris.ostrovsky@...cle.com> > Cc: David Vrabel <david.vrabel@...rix.com> > Cc: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com> > --- > v2: Also adjust the freeing side. > --- > arch/x86/kernel/ldt.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > --- 4.2/arch/x86/kernel/ldt.c > +++ 4.2-x86-LDT-alloc/arch/x86/kernel/ldt.c > @@ -58,7 +58,7 @@ static struct ldt_struct *alloc_ldt_stru > 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_free_page(GFP_KERNEL|__GFP_ZERO); > > if (!new_ldt->entries) { > kfree(new_ldt); > @@ -95,7 +95,7 @@ static void free_ldt_struct(struct ldt_s > if (ldt->size * LDT_ENTRY_SIZE > PAGE_SIZE) > vfree(ldt->entries); > else > - kfree(ldt->entries); > + put_page(virt_to_page(ldt->entries)); FWIW, I'm not convinced this is or was correct. Using free_page looks a bit safer, and free_page does more than just put_page. Does anyone here know the right way to do this? --Andy > 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