Message ID | 20230609183632.48706-13-alexander.shishkin@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1127622vqr; Fri, 9 Jun 2023 12:14:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7D9N0IEwS5Yq7RXFsjpGM6a61W2FgGxksHsfBfd/QJLsU0kf/aghXHQxW/iNKdNfrvpVrl X-Received: by 2002:a05:6a21:3986:b0:111:52a4:7f7e with SMTP id ad6-20020a056a21398600b0011152a47f7emr1717818pzc.28.1686338046266; Fri, 09 Jun 2023 12:14:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686338046; cv=none; d=google.com; s=arc-20160816; b=kn/czLABZcqMIyC8JJaH1tUjJm6tUTB2vmVgdr4xRR7wzoXhw4nOCtVunElBoBsyT7 sbsbyA3qWaEmccOfBhFs7DqesqELFNzgpjdFlNO23nCv8ULV2KOBgGrXcte4uFth1eX1 infe6XeyUVkd2PE/RAuaPaf/pSX2P1ncpihyV28bDqgBX8nIgRm5bw0dheOe/iaORmlF S2IrykUIiRdgCNlHfQURj/kqgZYrBmeqL2cDWzYUxPK8+XhdtjVZ4dT+NQejcQkcIcXR vOxoG8F6iPHYvMYX9Ybus4Hq1o7gSzQQj0GBZKIJ5vqglNwpG0o3fmX6vcPhAXmpIXox RozA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=agA/R6YJ09xEkXuFJiqBe5iyCKaloRW5so3VO4hyIUY=; b=VF9se04rz+8RHpXw3vmD+YvqZ4SC03IvuB/4dfy0Zlvl30aelMbisBg+BDFMTZ+QZT wWEGclDcCl4JRX3ZgwOXkJqD3JYRARWbL2ofJctHGyHDwIS7TU7iQDvrBPbuTOJWGuMf jRwNF1YOyqjVsmMRtfQy8GO8ez5wTq9S2ud4eYzAuF76mF4JaGPoXlISIR3xt+HMZd8P +u2NthSus8FWbEPL66Oq9iamJAqwpVa/CMfyjrPT8oEvoRSaYYHABJbFyzUg4BFwepUn pBX5ZiHaUL3r1LsWLyHx5TEI2My4ykHUnD8MNtQbanruO2Xx5licrRJHTB64nTzY/8wN PS+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="RRK7GH/x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k28-20020aa7999c000000b0065f91c28592si2895960pfh.10.2023.06.09.12.13.28; Fri, 09 Jun 2023 12:14:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="RRK7GH/x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231302AbjFISir (ORCPT <rfc822;liningstudo@gmail.com> + 99 others); Fri, 9 Jun 2023 14:38:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231938AbjFIShz (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 9 Jun 2023 14:37:55 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4E583AB2 for <linux-kernel@vger.kernel.org>; Fri, 9 Jun 2023 11:37:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686335851; x=1717871851; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cSHO1BH7WnTgrrvVGbc7GV85jY3NXc9iqn2mc1vIguw=; b=RRK7GH/x94E81wUK/rhlA+HweDkoCEaS8Eo5/mTas+aKSqcnuat1YC8D fqXRGsWKyNdrRbMJec4yMpeib+rtWRlr3GgJ1VU944dZlqgyhZt1S0dPm Egn/XhyUp/B+zuiXlFeyzIYdVtgUx/kNWtPKb6pvFkf7FZlsxDOjFrKab 4Oe7B1MFQxuaF1L9m2MxQuj1jkbcmkl96lI7xUI5RK5o8+el2o0VY8fT5 hfh+1+3jWskUiJXm4UoTGOMub6e95SZDPdPfxcZH7p/cyirRPZ7isDZFs wL+Ph8BUIAPujjkqKJOwvFKSP/1IMmVEWUl0e/q5guTginc5TVVfX6MTs g==; X-IronPort-AV: E=McAfee;i="6600,9927,10736"; a="338022230" X-IronPort-AV: E=Sophos;i="6.00,230,1681196400"; d="scan'208";a="338022230" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2023 11:37:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10736"; a="710444135" X-IronPort-AV: E=Sophos;i="6.00,230,1681196400"; d="scan'208";a="710444135" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 09 Jun 2023 11:37:22 -0700 From: Alexander Shishkin <alexander.shishkin@linux.intel.com> To: linux-kernel@vger.kernel.org, x86@kernel.org, Andy Lutomirski <luto@kernel.org>, Dave Hansen <dave.hansen@linux.intel.com>, Ravi Shankar <ravi.v.shankar@intel.com>, Tony Luck <tony.luck@intel.com>, Sohil Mehta <sohil.mehta@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Subject: [RFC v3 12/12] x86/efi: Disable LASS enforcement when switching to EFI MM Date: Fri, 9 Jun 2023 21:36:32 +0300 Message-Id: <20230609183632.48706-13-alexander.shishkin@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230609183632.48706-1-alexander.shishkin@linux.intel.com> References: <20230609183632.48706-1-alexander.shishkin@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768253603091842135?= X-GMAIL-MSGID: =?utf-8?q?1768253603091842135?= |
Series |
Enable Linear Address Space Separation support
|
|
Commit Message
Alexander Shishkin
June 9, 2023, 6:36 p.m. UTC
From: Sohil Mehta <sohil.mehta@intel.com> [Code is experimental and not yet ready to be merged upstream] PeterZ suggested that EFI memory can be mapped in user virtual address space which would trigger LASS violation upon access. It isn't exactly clear how and when these user address mapping happen. It may be possible this is related to EFI mixed mode. Link:https://lore.kernel.org/lkml/Y73S56t%2FwDIGEPlK@hirez.programming.kicks-ass.net/ stac()/clac() calls in the EFI MM enter and exit functions trigger objtool warnings due to switch_mm() not being classified as func_uaccess_safe. Refer Objtool warnings section #9 in the document tools/objtool/Documentation/objtool.txt. This would need to be resolved before even considering merging. Signed-off-by: Sohil Mehta <sohil.mehta@intel.com> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> --- arch/x86/platform/efi/efi_64.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index 232acf418cfb..20966efcd87a 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c @@ -473,9 +473,14 @@ void __init efi_dump_pagetable(void) * while the EFI-mm is borrowed. mmgrab()/mmdrop() is not used because the mm * can not change under us. * It should be ensured that there are no concurrent calls to this function. + * + * Disable LASS enforcement temporarily when switching to EFI MM since it could + * be mapped into the low 64-bit virtual address space with address bit 63 set + * to 0. */ void efi_enter_mm(void) { + stac(); efi_prev_mm = current->active_mm; current->active_mm = &efi_mm; switch_mm(efi_prev_mm, &efi_mm, NULL); @@ -485,6 +490,7 @@ void efi_leave_mm(void) { current->active_mm = efi_prev_mm; switch_mm(&efi_mm, efi_prev_mm, NULL); + clac(); } static DEFINE_SPINLOCK(efi_runtime_lock);