From patchwork Tue Oct 26 22:00:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Luck X-Patchwork-Id: 12585745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34C8EC433EF for ; Tue, 26 Oct 2021 22:02:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C8AD960F02 for ; Tue, 26 Oct 2021 22:02:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C8AD960F02 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 0BECC6B0078; Tue, 26 Oct 2021 18:02:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E81986B007E; Tue, 26 Oct 2021 18:02:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C81836B007B; Tue, 26 Oct 2021 18:02:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0241.hostedemail.com [216.40.44.241]) by kanga.kvack.org (Postfix) with ESMTP id B1D0A6B0075 for ; Tue, 26 Oct 2021 18:02:49 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 559E839B14 for ; Tue, 26 Oct 2021 22:02:49 +0000 (UTC) X-FDA: 78739964058.22.8A7778D Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by imf29.hostedemail.com (Postfix) with ESMTP id BF47E9000163 for ; Tue, 26 Oct 2021 22:02:48 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10149"; a="228777641" X-IronPort-AV: E=Sophos;i="5.87,184,1631602800"; d="scan'208";a="228777641" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2021 15:00:59 -0700 X-IronPort-AV: E=Sophos;i="5.87,184,1631602800"; d="scan'208";a="497555750" Received: from agluck-desk2.sc.intel.com ([10.3.52.146]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2021 15:00:59 -0700 From: Tony Luck To: Borislav Petkov , x86@kernel.org Cc: "Rafael J. Wysocki" , naoya.horiguchi@nec.com, Andrew Morton , Sean Christopherson , Jarkko Sakkinen , Dave Hansen , Cathy Zhang , linux-sgx@vger.kernel.org, linux-acpi@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Tony Luck Subject: [PATCH v11 0/7] Basic recovery for machine checks inside SGX Date: Tue, 26 Oct 2021 15:00:43 -0700 Message-Id: <20211026220050.697075-1-tony.luck@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018202542.584115-1-tony.luck@intel.com> References: <20211018202542.584115-1-tony.luck@intel.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: BF47E9000163 Authentication-Results: imf29.hostedemail.com; dkim=none; spf=none (imf29.hostedemail.com: domain of tony.luck@intel.com has no SPF policy when checking 192.55.52.120) smtp.mailfrom=tony.luck@intel.com; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=intel.com (policy=none) X-Stat-Signature: gtdy3m4gf4t34oyo1b85zonqnby75m3w X-Rspamd-Server: rspam06 X-HE-Tag: 1635285768-144443 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Boris, I took this series out of lkml/x86 for a few revisions, I think the last one posted to lkml was v5. So much has changed since then that it might be easier to just look at this as if it were v1 and ignore the earlier history. First four patches add infrastructure within the SGX code to track enclave pages (because these pages don't have a "struct page" as they aren't directly accessible by Linux). All have "Reviewed-by" tags from Jarkko (SGX maintainer). Patch 5 hooks into memory_failure() to invoke recovery if the physical address is in enclave space. This has a "Reviewed-by" tag from Naoya Horiguchi the maintainer for mm/memory-failure.c Patch 6 is a hook into the error injection code and addition to the error injection documentation explaining extra steps needed to inject into SGX enclave memory. Patch 7 is a hook into GHES error reporting path to recognize that SGX enclave addresses are valid and need processing. -Tony Tony Luck (7): x86/sgx: Add new sgx_epc_page flag bit to mark free pages x86/sgx: Add infrastructure to identify SGX EPC pages x86/sgx: Initial poison handling for dirty and free pages x86/sgx: Add SGX infrastructure to recover from poison x86/sgx: Hook arch_memory_failure() into mainline code x86/sgx: Add hook to error injection address validation x86/sgx: Add check for SGX pages to ghes_do_memory_failure() .../firmware-guide/acpi/apei/einj.rst | 19 +++ arch/x86/Kconfig | 1 + arch/x86/include/asm/processor.h | 8 ++ arch/x86/include/asm/set_memory.h | 4 + arch/x86/kernel/cpu/sgx/main.c | 113 +++++++++++++++++- arch/x86/kernel/cpu/sgx/sgx.h | 7 +- drivers/acpi/apei/einj.c | 3 +- drivers/acpi/apei/ghes.c | 2 +- include/linux/mm.h | 13 ++ mm/memory-failure.c | 19 ++- 10 files changed, 179 insertions(+), 10 deletions(-) base-commit: 3906fe9bb7f1a2c8667ae54e967dc8690824f4ea