Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp16001imu; Thu, 8 Nov 2018 13:59:20 -0800 (PST) X-Google-Smtp-Source: AJdET5c/FtKLrkGzDsIumS7cGJpT0ph1ti9mxSemiaIGEK1K5i4ONopqdp6cpkj58esIsELiCjrr X-Received: by 2002:a63:200e:: with SMTP id g14mr3105617pgg.235.1541714360785; Thu, 08 Nov 2018 13:59:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541714360; cv=none; d=google.com; s=arc-20160816; b=hBMwaw+OBA5rpjo2koP3o9bn/CDOZ6JtM6IMz1zImz+o77S6KvKOlh+ZOKn/guSGpg msjs4ZJPzGJH4RykW4GHx+O4t2DR05T/VTUrQWwrJ50E0S2QChzFr7Qbjuz3A2NPyPXr lYNjz9Vfo/1/t4hQNTDSNAFWDZJH05a/JwQZe0PJGjQDJYKmNAZUcwwronVshlFdqbF9 EKMv8G3QI7zxiH25EzRsHGKkn+QgEyu79vMLEPS9DDHotWN+T28jnBtfDZzTWakf1Uar OlSu/J9S0tyyT2IrTS5dfR4NNDezTtAoI/PjfdX324VRrwZQ9BS4ijp7doZnZ8I+fDmK IYog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0SBDqPCRYNL5To/UpkIO0ZebMLMCrtNLCFyjk100XoQ=; b=uKQ1W2Oc28oLMo2tYavnnJFtO2+O2E7hN+9/JfAr9P1rDahhFRcpiszHURuLNu7rcX mXMD3DqwzaWZOT+lgkuHqGbsPhPk8O9adkSiJggi0cnEUeoDr4AZZ1sq9HOVZ+rTvk/C na836c/sf9RtsyiYJ/GZc/uzeBzv4BwGBM1+MIge9Se/cKEVD8gidQY5FylnaaGTYeFL clQ7m25gw1qGbsYY33Av5xVIw/qk01m/N8jcNSd2MqMMwPAXbIuEf+OmRHyslUD/Rc17 4mClP1SngbcJpTHln63qVxRELaJ0eQmcp7l5QFObjnuf2c21mcfEGuSGT6u3MRtZRxrB 9G3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FgJ37fdw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f126-v6si2361006pfa.1.2018.11.08.13.59.05; Thu, 08 Nov 2018 13:59:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FgJ37fdw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729247AbeKIHeC (ORCPT + 99 others); Fri, 9 Nov 2018 02:34:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:50418 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728103AbeKIHeB (ORCPT ); Fri, 9 Nov 2018 02:34:01 -0500 Received: from localhost (unknown [208.72.13.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0707221104; Thu, 8 Nov 2018 21:56:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714194; bh=Xiir64usdaUv84kM1vP2AR6koDe2+w5g6wAyQtEzN64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FgJ37fdwqN/mkjW51fg70Y/YcQQDgpk0pHQQsTS3YzspRh5TnMqRypOc0jkrDf0Hb nJSKCz3HbbUUj918MQ9xp2dx7TmHqFGK3m4RKZu+72XVPL//SJcW4tMTL7czZgYAZA 5HIXnuyhfK8tH8JtnLbaHnTYACs69+h3WTs7qFLA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Beulich , Andy Lutomirski , Andy Lutomirski , Boris Ostrovsky , Borislav Petkov , Brian Gerst , David Vrabel , Denys Vlasenko , "H. Peter Anvin" , Konrad Rzeszutek Wilk , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Sasha Levin Subject: [PATCH 3.18 115/144] x86/ldt: Fix small LDT allocation for Xen Date: Thu, 8 Nov 2018 13:51:26 -0800 Message-Id: <20181108215106.300920029@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215054.826084593@linuxfoundation.org> References: <20181108215054.826084593@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit f454b478861325f067fd58ba7ee9f1b5c4a9d6a0 ] 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 Signed-off-by: Sasha Levin --- 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 2bcc0525f1c1..6acc9dd91f36 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); } -- 2.17.1