From nobody Wed Oct 8 08:31:34 2025 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 82DA22701D9; Tue, 1 Jul 2025 09:59:35 +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=1751363977; cv=none; b=mD4t+gKbcuttmoR1MpLiE4Pk3lYyROLYdoR+WkLIQsZOrXE00DdWQ6jyhQuME6p6WQ2PD9Fwq037ccIwq9g80eLlWxQhiXcHMbNDSWnpUREUF1AONndebAAes82JLUuPX8uMYnZ1nMx3goLV2g9ii929/Git3jchFplR/PMyTlY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751363977; c=relaxed/simple; bh=OjJNhJk2T736RflVUZxtae35YdvRzXSJjxBWWJGThLU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oSqAXxI8r0lRVnFYW38S07T6OcU10h7fSbabwg4j1+FCnfSe7dWe3lio7gBIRhtbUxvxE6y+Kah9NrSwl82+jd8GWLcQ/WkO99r1j08n1uwKX/N4IyYJuU13IYMXk9vA5tCvrlJwzUhb5R9drP1cxskmH4KyQTspvqcGGki13eM= 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=YP/DMTij; 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="YP/DMTij" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1751363976; x=1782899976; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OjJNhJk2T736RflVUZxtae35YdvRzXSJjxBWWJGThLU=; b=YP/DMTijQqpMtGIMzsPTvzIDrMnKZGHi02km6MRFFDk64YfrpWHJIyYv x0GGEdjlcvWiWVODmyDkT3AGH5voTsMTK5joT1tawgVlJwmnIvNmIa45t gw4aPgObBjgfJUKrALzpc0ZW95SW2vALY7vq1YSLTDKCYB8Et1YvPjK4I TBnY+8sV3hgbeWWMrglYmjQkm4lBsbtbr9YVD30xgNNjJBh7ZYnfe/8NK +12ecyr0vLBc1p0V2WdyVUE/25wMEWK6CcuzlTZ2rOuQ+OnSCsdZNtRvZ f40irAaT07Vzp0IKNAPSKH39auRPWv9texeWUK5De7NqygA5dNtB0VGVY g==; X-CSE-ConnectionGUID: OaEi3tHTT7CmW2iPncda9Q== X-CSE-MsgGUID: eG0Y97r4TbCA9smnaRNWHg== X-IronPort-AV: E=McAfee;i="6800,10657,11480"; a="57428212" X-IronPort-AV: E=Sophos;i="6.16,279,1744095600"; d="scan'208";a="57428212" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2025 02:59:15 -0700 X-CSE-ConnectionGUID: wkESWtlpRQ+HNh/NQSpitw== X-CSE-MsgGUID: ldjqWFxdSzaadhor3s4cTA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,279,1744095600"; d="scan'208";a="154216196" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa008.jf.intel.com with ESMTP; 01 Jul 2025 02:59:03 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 03531928; Tue, 01 Jul 2025 12:58:50 +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: [PATCHv8 16/17] x86/cpu: Enable LASS during CPU initialization Date: Tue, 1 Jul 2025 12:58:45 +0300 Message-ID: <20250701095849.2360685-17-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250701095849.2360685-1-kirill.shutemov@linux.intel.com> References: <20250701095849.2360685-1-kirill.shutemov@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Sohil Mehta Being a security feature, enable LASS by default if the platform supports it. While at it, get rid of the comment above the SMAP/SMEP/UMIP/LASS setup instead of updating it to mention LASS as well, as the whole sequence is quite self-explanatory. Signed-off-by: Sohil Mehta Signed-off-by: Alexander Shishkin Signed-off-by: Kirill A. Shutemov --- arch/x86/kernel/cpu/common.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 1552c7510380..97a228f917a9 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -401,6 +401,12 @@ static __always_inline void setup_umip(struct cpuinfo_= x86 *c) cr4_clear_bits(X86_CR4_UMIP); } =20 +static __always_inline void setup_lass(struct cpuinfo_x86 *c) +{ + if (cpu_feature_enabled(X86_FEATURE_LASS)) + cr4_set_bits(X86_CR4_LASS); +} + /* These bits should not change their value after CPU init is finished. */ static const unsigned long cr4_pinned_mask =3D X86_CR4_SMEP | X86_CR4_SMAP= | X86_CR4_UMIP | X86_CR4_FSGSBASE | X86_CR4_CET | X86_CR4_FRED | @@ -1975,10 +1981,10 @@ static void identify_cpu(struct cpuinfo_x86 *c) /* Disable the PN if appropriate */ squash_the_stupid_serial_number(c); =20 - /* Set up SMEP/SMAP/UMIP */ setup_smep(c); setup_smap(c); setup_umip(c); + setup_lass(c); =20 /* Enable FSGSBASE instructions if available. */ if (cpu_has(c, X86_FEATURE_FSGSBASE)) { --=20 2.47.2