From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9419C29346F; Mon, 7 Jul 2025 08:03:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751875426; cv=none; b=Gz1aCjM2RKRqistEYyhDi+JQeZ3sD5DY8su/p7ZiZhwMAS6/8Dsm6t5NMgNhgbAHdAFqrI81gbh/XtblDMV+N/fyYMPrybdq2/BK7HY4VnyFpSO0AiemwNKUgT04P2ULVvyzumhI6ODmBM3lbkY8KzLfx3hFKlV4sV4FdpHfNDg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751875426; c=relaxed/simple; bh=zmJ0SsTgrIsGwH/KhdgcrCgX4qTp57IuWr6AQEqkrvM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gXRcjzLAdMpLnUaCJ+2b2oB+/qPxXCvQRmCQWqjUUQYQAK4GG8Ua8SgnztAUwse/IRVIEYqfWe25/1d4tpofQuW8SSWbB1GD2m2w6xcW6Z5w3kEsnb82u7hRsS+KIyaL6azRDz+SpMEqFBuW6+abMQkZhffcc+IuBgCx6xXbSMg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.helo=mgamail.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=R9JeVgnF; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.helo=mgamail.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="R9JeVgnF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1751875425; x=1783411425; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zmJ0SsTgrIsGwH/KhdgcrCgX4qTp57IuWr6AQEqkrvM=; b=R9JeVgnF33ux6dCFjWbHNtmVyF+ePU3No+J2GfIHLYxO8DOE2uf6GMM2 w7iYzPtzbAXRcQ36ZAj0Dg2saiEYod8rBgL6U25s7kg4jAnnxyVNIKtM/ kB+V/8ZK/BldukDsYoqjMOOVr/hYykz1o+YsinBfNcV3rNJcvyM1Ib+Th pjjpI2DRSxaiV1KvPx2FpczOT/hx1cgy0nWL3qZc4IXhknmx81z0uYE5w QEUBtJfKxmmrwep8TL9VJidAW1awA2NuOEv9+2hSPmbdkz9ClFwEb1H3R TtOeSpyrx9gzX8yD4DcfCwRvD/deBRceH8otFx9cOjxk+BpVZNWPkLzC7 Q==; X-CSE-ConnectionGUID: jGf0D+X+Tn6S3Lda1D+/Hw== X-CSE-MsgGUID: OuNsnhRdTna6X2RmOVyZ6Q== X-IronPort-AV: E=McAfee;i="6800,10657,11486"; a="57891170" X-IronPort-AV: E=Sophos;i="6.16,293,1744095600"; d="scan'208";a="57891170" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2025 01:03:43 -0700 X-CSE-ConnectionGUID: 2AH2cPTGSACdcl2bkvyuZQ== X-CSE-MsgGUID: rhjMIjipQl++rGKx2/3w4w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,293,1744095600"; d="scan'208";a="186171990" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa002.jf.intel.com with ESMTP; 07 Jul 2025 01:03:31 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 6D8F4BC2; Mon, 07 Jul 2025 11:03:18 +0300 (EEST) From: "Kirill A. Shutemov" To: Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Peter Zijlstra , Ard Biesheuvel , "Paul E. McKenney" , Josh Poimboeuf , Xiongwei Song , Xin Li , "Mike Rapoport (IBM)" , Brijesh Singh , Michael Roth , Tony Luck , Alexey Kardashevskiy , Alexander Shishkin Cc: Jonathan Corbet , Sohil Mehta , Ingo Molnar , Pawan Gupta , Daniel Sneddon , Kai Huang , Sandipan Das , Breno Leitao , Rick Edgecombe , Alexei Starovoitov , Hou Tao , Juergen Gross , Vegard Nossum , Kees Cook , Eric Biggers , Jason Gunthorpe , "Masami Hiramatsu (Google)" , Andrew Morton , Luis Chamberlain , Yuntao Wang , Rasmus Villemoes , Christophe Leroy , Tejun Heo , Changbin Du , Huang Shijie , Geert Uytterhoeven , Namhyung Kim , Arnaldo Carvalho de Melo , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, linux-mm@kvack.org, "Kirill A. Shutemov" Subject: [PATCHv9 16/16] x86: Re-enable Linear Address Masking Date: Mon, 7 Jul 2025 11:03:16 +0300 Message-ID: <20250707080317.3791624-17-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250707080317.3791624-1-kirill.shutemov@linux.intel.com> References: <20250707080317.3791624-1-kirill.shutemov@linux.intel.com> Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This reverts commit 3267cb6d3a174ff83d6287dcd5b0047bbd912452. LASS mitigates the Spectre based on LAM (SLAM) [1] and the previous commit made LAM depend on LASS, so we no longer need to disable LAM at compile time, so revert the commit that disables LAM. Adjust USER_PTR_MAX if LAM enabled, allowing tag bits to be set for userspace pointers. The value for the constant is defined in a way to avoid overflow compiler warning on 32-bit config. [1] https://download.vusec.net/papers/slam_sp24.pdf Signed-off-by: Kirill A. Shutemov Cc: Pawan Gupta --- arch/x86/Kconfig | 1 - arch/x86/kernel/cpu/common.c | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 71019b3b54ea..2b48e916b754 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2181,7 +2181,6 @@ config RANDOMIZE_MEMORY_PHYSICAL_PADDING config ADDRESS_MASKING bool "Linear Address Masking support" depends on X86_64 - depends on COMPILE_TEST || !CPU_MITIGATIONS # wait for LASS help Linear Address Masking (LAM) modifies the checking that is applied to 64-bit linear addresses, allowing software to use of the diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 382b687ce7e2..7ae757498a6f 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -2553,11 +2553,8 @@ void __init arch_cpu_finalize_init(void) if (IS_ENABLED(CONFIG_X86_64)) { unsigned long USER_PTR_MAX = TASK_SIZE_MAX; - /* - * Enable this when LAM is gated on LASS support if (cpu_feature_enabled(X86_FEATURE_LAM)) - USER_PTR_MAX = (1ul << 63) - PAGE_SIZE; - */ + USER_PTR_MAX = (-1UL >> 1) & PAGE_MASK; runtime_const_init(ptr, USER_PTR_MAX); /* -- 2.47.2