From patchwork Wed Jul 10 16:06:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shishkin X-Patchwork-Id: 811910 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (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 6A48D1946AD; Wed, 10 Jul 2024 16:11:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720627874; cv=none; b=Me+auVtunSX7T9jsZUuiN5OE+0coQSy/03edEtf531QMRwc+io/QaBDH0jwM04N5WbS+w2/GYYb7nK6eHimtLlTYG2ohSONqmxv/Gx6IFfTHCXQMBfMd4dfVD2I7ixBw59AHII3gkszyIOsTDI3rWvxU+dLRpDpNU3SQ/CEseSo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720627874; c=relaxed/simple; bh=indbEBEnKodo/Nz5z4LUGohOp6TPYInM6siLMopB+W4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JjoiZz+3tt/xjMGcQxQv7UXd9U8AAHFT8VIRcFRHQ+38JqciXuXDoO+YVOht0i8IuPmOfNpqzveW9FNMHzG5t4Rvgz0/Myf389G/9NUJhILyHmffCuj86ahUOZp6+xBer4SEVSt6qGAT3LL2DK2cEQZp0HKWIpVcNppHDHfeJlk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=T/JgGCxi; arc=none smtp.client-ip=198.175.65.16 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.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="T/JgGCxi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1720627873; x=1752163873; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=indbEBEnKodo/Nz5z4LUGohOp6TPYInM6siLMopB+W4=; b=T/JgGCxiyyYQrgI2GWXHp2jWAjM0Ha6JajgXQMgyC1fRJvQSvaHI5WEA G2+v5lJnhjjObDkLmDvkiixoCDbFjrNm3qtVVYdbgLhFJndc/UwjyRqOS hHgUxNdYAC1GG84JQJqZyKQi52hWb2ST0N9rMK6bO6AS4LIDRXHqwpsqf WskHw13bOmoLdA7PBOMDN+eKCkqaTtYdmkE+ELJQ+3f4c1OsVqB8h/W/2 JQ2Lbq7FMLpQs1ySilXqDlvmRlzvlFtRqgvPbQReEUqP7d51aiFE2WxBx Z3k8MckWprlvvkoSIIWO3kiM1m7+APHSJD/L26CD/Bzc8dQM23Ve1R8Qr A==; X-CSE-ConnectionGUID: Lst0Tr+IQoyeLLL9SQoczg== X-CSE-MsgGUID: X0U1G2sYTrybbsjei8mOpg== X-IronPort-AV: E=McAfee;i="6700,10204,11129"; a="18103457" X-IronPort-AV: E=Sophos;i="6.09,198,1716274800"; d="scan'208";a="18103457" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2024 09:11:12 -0700 X-CSE-ConnectionGUID: QrRL1MwuSx21HKSOzfhClg== X-CSE-MsgGUID: frbnj4/5SM+1Iz+TA64q9A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,198,1716274800"; d="scan'208";a="53085604" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by orviesa003.jf.intel.com with ESMTP; 10 Jul 2024 09:11:00 -0700 From: Alexander Shishkin 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 , "Kirill A. Shutemov" , Alexey Kardashevskiy Cc: Jonathan Corbet , Alexander Shishkin , Sohil Mehta , Ingo Molnar , Pawan Gupta , Daniel Sneddon , Kai Huang , Sandipan Das , Breno Leitao , Rick Edgecombe , Yian Chen , 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 Subject: [PATCH v4 13/16] x86/cpu: Set LASS CR4 bit as pinning sensitive Date: Wed, 10 Jul 2024 19:06:49 +0300 Message-ID: <20240710160655.3402786-14-alexander.shishkin@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240710160655.3402786-1-alexander.shishkin@linux.intel.com> References: <20240710160655.3402786-1-alexander.shishkin@linux.intel.com> Precedence: bulk X-Mailing-List: linux-efi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Yian Chen Security features such as LASS are not expected to be disabled once initialized. Add LASS to the CR4 pinned mask. Signed-off-by: Yian Chen Signed-off-by: Alexander Shishkin Reviewed-by: Tony Luck --- arch/x86/kernel/cpu/common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index c93c59a27dfa..3dc443c349f0 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -407,7 +407,8 @@ static __always_inline void setup_lass(struct cpuinfo_x86 *c) /* These bits should not change their value after CPU init is finished. */ static const unsigned long cr4_pinned_mask = X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_UMIP | - X86_CR4_FSGSBASE | X86_CR4_CET | X86_CR4_FRED; + X86_CR4_FSGSBASE | X86_CR4_CET | X86_CR4_FRED | + X86_CR4_LASS; static DEFINE_STATIC_KEY_FALSE_RO(cr_pinning); static unsigned long cr4_pinned_bits __ro_after_init;