Message ID | 43b4db5c872bfaa4881cf45103b8fd3a826c1a9e.1743772053.git.maciej.wieczor-retman@intel.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A960C36010 for <linux-mm@archiver.kernel.org>; Fri, 4 Apr 2025 13:16:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F2C686B0022; Fri, 4 Apr 2025 09:16:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EDB7E6B0023; Fri, 4 Apr 2025 09:16:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D53FB6B0024; Fri, 4 Apr 2025 09:16:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id B3C746B0022 for <linux-mm@kvack.org>; Fri, 4 Apr 2025 09:16:49 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 18B8E1A0155 for <linux-mm@kvack.org>; Fri, 4 Apr 2025 13:16:51 +0000 (UTC) X-FDA: 83296411422.12.F1C9E2B Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) by imf14.hostedemail.com (Postfix) with ESMTP id DC50310000A for <linux-mm@kvack.org>; Fri, 4 Apr 2025 13:16:48 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=aRl9al2i; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf14.hostedemail.com: domain of maciej.wieczor-retman@intel.com designates 198.175.65.11 as permitted sender) smtp.mailfrom=maciej.wieczor-retman@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743772609; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=wVLQ4BnG0OXK3p1MFinu0qIASsM8XSU4urWEXhy+z2k=; b=EPCLjhLIZvpbtkC6Jf0i7uAqNbddL5aG49G9P+f33sQcrp8npBCbxS8+mDpNVLVtqv8BYM 9nMiUAoJIlfyMWVnVQ5ELu9qg4fFFXcslg7l5ss2XyD9Fa5E9lRztzbZ0hnv2Q+m2QaDZV QYyxuvKteQk7On27m/VuNPpJSMWo524= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743772609; a=rsa-sha256; cv=none; b=IfaVMiOJa9ysQT8f27JUK5UIQeYqi3jGMdHYc8xqISofvqEFv5tQ0zKZSDdo26S0DurvAh 27EqFB+iTkQ7pSN60QCQC0ttgmhuwfNb49ojzxkfNd4jtEH9ILD2vkvKJ53CFU3oiZHQr9 BZoxk9kQ1lnfftt86SS1Ai7tMaXiFns= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=aRl9al2i; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf14.hostedemail.com: domain of maciej.wieczor-retman@intel.com designates 198.175.65.11 as permitted sender) smtp.mailfrom=maciej.wieczor-retman@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1743772609; x=1775308609; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FDp9HRqNQ0oDD3Qx3RyJgwftrUUBuyFmC51wrtuHP28=; b=aRl9al2iWJ/7qlN+A7u9QuYiehNDpZdBG8h9+UeplmH1zY+MS6o1jeTX x7Cghe32icZuGiSNN/GnRB/pwIWAKw6zgZmUcACkYkJp7pBfdyVuirlPH lr1fWkWc9hfwNAOY0vm6cvedFQbswqm8bZT1fae4g+9+QD7AUfYvi3K04 /24SpDvqNrhXZlgbpWk/2s7tMDDF5tyBlZPSHrGdExv4HMfOZcUMUsyhN 2cJ+LLJYGTRMfBB72CzCfadIm2fsxDVbn3aWqaH+fr2LZCAm89Xy+VdpL yHPKmzv5bXvf4YjI4O3egdzr03WTiuQC/Tf+kSWj+q6D89urzfSYsoFob A==; X-CSE-ConnectionGUID: CFFx2j2PS4W/ty18zhM+NA== X-CSE-MsgGUID: 20u+8RtTRfieTXvTnuT/mg== X-IronPort-AV: E=McAfee;i="6700,10204,11394"; a="55401862" X-IronPort-AV: E=Sophos;i="6.15,188,1739865600"; d="scan'208";a="55401862" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2025 06:16:48 -0700 X-CSE-ConnectionGUID: KRVPdSrrQwCsFMKOJCYkCg== X-CSE-MsgGUID: BkRczVO7Rcyr+7Hf/uQO/g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,188,1739865600"; d="scan'208";a="128157245" Received: from opintica-mobl1 (HELO wieczorr-mobl1.intel.com) ([10.245.245.50]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2025 06:16:32 -0700 From: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com> To: hpa@zytor.com, hch@infradead.org, nick.desaulniers+lkml@gmail.com, kuan-ying.lee@canonical.com, masahiroy@kernel.org, samuel.holland@sifive.com, mingo@redhat.com, corbet@lwn.net, ryabinin.a.a@gmail.com, guoweikang.kernel@gmail.com, jpoimboe@kernel.org, ardb@kernel.org, vincenzo.frascino@arm.com, glider@google.com, kirill.shutemov@linux.intel.com, apopple@nvidia.com, samitolvanen@google.com, maciej.wieczor-retman@intel.com, kaleshsingh@google.com, jgross@suse.com, andreyknvl@gmail.com, scott@os.amperecomputing.com, tony.luck@intel.com, dvyukov@google.com, pasha.tatashin@soleen.com, ziy@nvidia.com, broonie@kernel.org, gatlin.newhouse@gmail.com, jackmanb@google.com, wangkefeng.wang@huawei.com, thiago.bauermann@linaro.org, tglx@linutronix.de, kees@kernel.org, akpm@linux-foundation.org, jason.andryuk@amd.com, snovitoll@gmail.com, xin@zytor.com, jan.kiszka@siemens.com, bp@alien8.de, rppt@kernel.org, peterz@infradead.org, pankaj.gupta@amd.com, thuth@redhat.com, andriy.shevchenko@linux.intel.com, joel.granados@kernel.org, kbingham@kernel.org, nicolas@fjasle.eu, mark.rutland@arm.com, surenb@google.com, catalin.marinas@arm.com, morbo@google.com, justinstitt@google.com, ubizjak@gmail.com, jhubbard@nvidia.com, urezki@gmail.com, dave.hansen@linux.intel.com, bhe@redhat.com, luto@kernel.org, baohua@kernel.org, nathan@kernel.org, will@kernel.org, brgerst@gmail.com Cc: llvm@lists.linux.dev, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, x86@kernel.org Subject: [PATCH v3 08/14] x86: LAM initialization Date: Fri, 4 Apr 2025 15:14:12 +0200 Message-ID: <43b4db5c872bfaa4881cf45103b8fd3a826c1a9e.1743772053.git.maciej.wieczor-retman@intel.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <cover.1743772053.git.maciej.wieczor-retman@intel.com> References: <cover.1743772053.git.maciej.wieczor-retman@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: DC50310000A X-Stat-Signature: cpgi8qaz7z9zswpxn3zo6z6nwxi5j3co X-Rspam-User: X-HE-Tag: 1743772608-882564 X-HE-Meta: U2FsdGVkX19dEaEy7QvqxBXHv8ocYM9tOdz0nmRyA5WiEVs2NZ/+WTf2Zb10i+MH9VOMEO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29dvT3CIYpCnW60w2KNO8nRf2G9xGlnVcDdt3rng2UkjEzgmrPVUoJNNSf2PABKMA+bTuuWbOfsZQ9tSBmpbVAGB9cr3b1 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
[v3,01/14] kasan: sw_tags: Use arithmetic shift for shadow computation
|
expand
|
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S index fefe2a25cf02..95b897b8bbd2 100644 --- a/arch/x86/kernel/head_64.S +++ b/arch/x86/kernel/head_64.S @@ -209,6 +209,9 @@ SYM_INNER_LABEL(common_startup_64, SYM_L_LOCAL) * there will be no global TLB entries after the execution." */ movl $(X86_CR4_PAE | X86_CR4_LA57), %edx +#ifdef CONFIG_ADDRESS_MASKING + orl $X86_CR4_LAM_SUP, %edx +#endif #ifdef CONFIG_X86_MCE /* * Preserve CR4.MCE if the kernel will enable #MC support. diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index bfa444a7dbb0..84cefc5dd69b 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -766,6 +766,9 @@ void __init init_mem_mapping(void) probe_page_size_mask(); setup_pcid(); + if (boot_cpu_has(X86_FEATURE_LAM) && IS_ENABLED(CONFIG_KASAN_SW_TAGS)) + cr4_set_bits_and_update_boot(X86_CR4_LAM_SUP); + #ifdef CONFIG_X86_64 end = max_pfn << PAGE_SHIFT; #else
To make use of KASAN's tag based mode on x86 Linear Address Masking (LAM) needs to be enabled. To do that the 28th bit in CR4 needs to be set. Set the bit in early memory initialization. When launching secondary CPUs the LAM bit gets lost. To avoid this it needs to get added in a mask in head_64.S. The bit mask permits some bits of CR4 to pass from the primary CPU to the secondary CPUs without being cleared. Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com> --- arch/x86/kernel/head_64.S | 3 +++ arch/x86/mm/init.c | 3 +++ 2 files changed, 6 insertions(+)