Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1947755ima; Thu, 25 Oct 2018 07:25:32 -0700 (PDT) X-Google-Smtp-Source: AJdET5cI8QE+sE1xgdkuPiORqb4PS7rWFIb07Qz6T+QEzjfASm20mf72UOEgLtmpa3pJpFMKvqyP X-Received: by 2002:a62:104b:: with SMTP id y72-v6mr1784930pfi.113.1540477532929; Thu, 25 Oct 2018 07:25:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540477532; cv=none; d=google.com; s=arc-20160816; b=09Hy9s6ttMTVCv2aqgenwP9yatnky6oTHvobnZ9SP+GZZYZUBCkwuSKyl6ET7Kfr/4 ubVbh/FBS0lNwY5H6rZgZ1N6oqFfKdJqsTabE8juzyc7QcRq1N8TMSEVscLqgVCvpkwL RZQidlew/Mu+snuMnizCCfTbFsozi86oHmkbgYKUOaiJzwFWeQ6gO5e/zbcwg4zJiz2g mGU2qNnj+TxdvPmVId5D60JVLYdc6kDdGumHa5aub03H+d0ZWXlQVpDvJqJgrHVl4Svh +9efD08Od7aVKJzDgebuqRtGVoxDwGRq4Zvw3OJGu55LlRcrGTmuNKRA6pHjHePRgX5G 1qhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=OnY3EodPGN4J/Z7uc8SlkHGWDEuO0xuauABQPcdaO4o=; b=AoeQ9dkuzVzsMmp9du+LHpP2bMPP+bKUkdOEHHV2KHr+o6grwQuV/TiLdk7VHm8CLg THYVcAmHZWmVg/mAtvSaed/KIlUp/GmlBukoy1Wdx82BPE+nfwViz/xEmQY5JiCMOkkl 05qcoDILBBIJGa/M3WhsJEVY9JCJGxism5Hv+Hg0mPYvleX+0O5vrnl+U7eXTrt4m3Q4 Inw4Qo4/ILDGTZUuSbauetU/w13W+K5DuPdKIYbhhYrdJHgxkR1HxTZUVM6XwYhorJtL HHiCrk4Nz71jawE35Nd50tx9XqGS6V2CQKZpHAaf08wdMCuSsPHKtcEHIlfxH7RMJu78 o+uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M5CXe9iv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2-v6si808685pfa.160.2018.10.25.07.24.48; Thu, 25 Oct 2018 07:25:32 -0700 (PDT) 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=M5CXe9iv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731390AbeJYWyJ (ORCPT + 99 others); Thu, 25 Oct 2018 18:54:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:36960 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731324AbeJYWyI (ORCPT ); Thu, 25 Oct 2018 18:54:08 -0400 Received: from sasha-vm.mshome.net (unknown [167.98.65.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 61FAE214ED; Thu, 25 Oct 2018 14:21:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540477270; bh=ShUGdPE98f4v+zYVXpVXH5PMveT2TiNhHAcylM4Z3w0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M5CXe9ivBgEo8tTHbriHXtjJKmtfuftRQ7n7PNoRnbFbgl4Ynha2SC6mRrmSk1Bjl H/l2WAp1AVATYJH6OqWh6ZDdhHqyiVDX4PvFaSL6SUPmxq9G8xAOFvQ2MqA3vMHgkq qORweJdPdIWeWA/fkRhGns9oGnD5+dx/fNhitRhE= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jan Beulich , 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 AUTOSEL 3.18 87/98] x86/ldt: Fix small LDT allocation for Xen Date: Thu, 25 Oct 2018 10:18:42 -0400 Message-Id: <20181025141853.214051-87-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025141853.214051-1-sashal@kernel.org> References: <20181025141853.214051-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jan Beulich [ 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