From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 852C3C432C0 for ; Fri, 22 Nov 2019 11:10:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 591F22070E for ; Fri, 22 Nov 2019 11:10:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574421030; bh=LD0zpAPXOabySlgSce1XhF2cp8ezbUfqKJ+jwcNMh1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sFw5MyJm0gZB4oLH6Z6G5fYTVuJ5r47Qdd0uCqJp3qZBpxNLqsOXgKewuOzXjfaVp SnQ6VoYIbLx0yOgvJwA8Uww0lsDmQumqXBFvubZ8byH/lyGOz4Iyvub5ow55J0552d 59q0oQbU4oRdkXu0Tls9qgx0pxfJOkWWpsflnUWM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730633AbfKVLK3 (ORCPT ); Fri, 22 Nov 2019 06:10:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:55482 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730833AbfKVLCJ (ORCPT ); Fri, 22 Nov 2019 06:02:09 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 E11AC20748; Fri, 22 Nov 2019 11:02:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574420528; bh=LD0zpAPXOabySlgSce1XhF2cp8ezbUfqKJ+jwcNMh1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SP2xYrzCezxsmxOJ7h/eA1FpDI/9t99fg4ICk8pUKeipgu3IIFxVzxH8dD8GcRmBv Z5fUe1m7rJdZy8UjzF36TqE3fdmvVeSBmgk1LlaZvYAys7odTf5EUfJS27eXSBC1h4 QMk+PmUUKAsnTFIQH42zOTeLWJ3qL33bw/Jk419E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lianbo Jiang , Borislav Petkov , Tom Lendacky , kexec@lists.infradead.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, akpm@linux-foundation.org, dan.j.williams@intel.com, bhelgaas@google.com, baiyaowei@cmss.chinamobile.com, tiwai@suse.de, brijesh.singh@amd.com, dyoung@redhat.com, bhe@redhat.com, jroedel@suse.de, Sasha Levin Subject: [PATCH 4.19 138/220] kexec: Allocate decrypted control pages for kdump if SME is enabled Date: Fri, 22 Nov 2019 11:28:23 +0100 Message-Id: <20191122100922.727399494@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100912.732983531@linuxfoundation.org> References: <20191122100912.732983531@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Lianbo Jiang [ Upstream commit 9cf38d5559e813cccdba8b44c82cc46ba48d0896 ] When SME is enabled in the first kernel, it needs to allocate decrypted pages for kdump because when the kdump kernel boots, these pages need to be accessed decrypted in the initial boot stage, before SME is enabled. [ bp: clean up text. ] Signed-off-by: Lianbo Jiang Signed-off-by: Borislav Petkov Reviewed-by: Tom Lendacky Cc: kexec@lists.infradead.org Cc: tglx@linutronix.de Cc: mingo@redhat.com Cc: hpa@zytor.com Cc: akpm@linux-foundation.org Cc: dan.j.williams@intel.com Cc: bhelgaas@google.com Cc: baiyaowei@cmss.chinamobile.com Cc: tiwai@suse.de Cc: brijesh.singh@amd.com Cc: dyoung@redhat.com Cc: bhe@redhat.com Cc: jroedel@suse.de Link: https://lkml.kernel.org/r/20180930031033.22110-3-lijiang@redhat.com Signed-off-by: Sasha Levin --- kernel/kexec_core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c index f50b90d0d1c28..faeec8255e7e0 100644 --- a/kernel/kexec_core.c +++ b/kernel/kexec_core.c @@ -473,6 +473,10 @@ static struct page *kimage_alloc_crash_control_pages(struct kimage *image, } } + /* Ensure that these pages are decrypted if SME is enabled. */ + if (pages) + arch_kexec_post_alloc_pages(page_address(pages), 1 << order, 0); + return pages; } @@ -869,6 +873,7 @@ static int kimage_load_crash_segment(struct kimage *image, result = -ENOMEM; goto out; } + arch_kexec_post_alloc_pages(page_address(page), 1, 0); ptr = kmap(page); ptr += maddr & ~PAGE_MASK; mchunk = min_t(size_t, mbytes, @@ -886,6 +891,7 @@ static int kimage_load_crash_segment(struct kimage *image, result = copy_from_user(ptr, buf, uchunk); kexec_flush_icache_page(page); kunmap(page); + arch_kexec_pre_free_pages(page_address(page), 1); if (result) { result = -EFAULT; goto out; -- 2.20.1