From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 52D90C7EE31 for ; Thu, 26 Jun 2025 15:23:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E96A86B0098; Thu, 26 Jun 2025 11:23:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E6E546B0099; Thu, 26 Jun 2025 11:23:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D83C26B009C; Thu, 26 Jun 2025 11:23:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id C750F6B0098 for ; Thu, 26 Jun 2025 11:23:17 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 751641A0298 for ; Thu, 26 Jun 2025 15:23:17 +0000 (UTC) X-FDA: 83597920434.01.149980F Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) by imf09.hostedemail.com (Postfix) with ESMTP id 6C4B9140010 for ; Thu, 26 Jun 2025 15:23:15 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=alien8.de header.s=alien8 header.b="BKoLX4+/"; spf=pass (imf09.hostedemail.com: domain of bp@alien8.de designates 65.109.113.108 as permitted sender) smtp.mailfrom=bp@alien8.de; dmarc=pass (policy=none) header.from=alien8.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1750951395; a=rsa-sha256; cv=none; b=NVSkxrouhu7JtlBeBd3jSyHLxhE6G6NjbJWe49ML883sP5incXTfWb1cG/ShRCEumcc8Yf Y1FdpNyX9xAXjFTNRgeR5eD4NEUKAx1cYvFbJve3KFGI3CCeQoCIdsczBCAGSEg1+wJiZM HiDN6eglSozYRsjZ+hwl+HVYcYqRBEU= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=alien8.de header.s=alien8 header.b="BKoLX4+/"; spf=pass (imf09.hostedemail.com: domain of bp@alien8.de designates 65.109.113.108 as permitted sender) smtp.mailfrom=bp@alien8.de; dmarc=pass (policy=none) header.from=alien8.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1750951395; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=A7hao13YYOHGpLHDV+xaJPrzcOSgKVbDGnSsEtxU0hA=; b=RfieSYpoh0BCdBPtkXfHbuEKWMQasxoIyJnINoCKQvHVGn95DPu7jvWvIxv7ZfJjS4L9ue It97sfgMAlhgedoyGSyzRL8N4alIEYBs9ez5UB679ehLYvJ4wt64X62BUM8OnwpUHCMRnH hbpd6JEeA/No+7TtgCGcOl8D2fMUsfw= Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id E637840E00CE; Thu, 26 Jun 2025 15:23:12 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 3T_HP8Mpcpq7; Thu, 26 Jun 2025 15:23:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1750951386; bh=A7hao13YYOHGpLHDV+xaJPrzcOSgKVbDGnSsEtxU0hA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BKoLX4+/fxMkEUVDSfj5OUUjdINqhyteEYa5Os8ve0ZB3p8J+l7hJ1Ws/zoLLJkiN rYA/ARGVja21Kkv37IzLbx4h60cQaOUwbtJZyjMHSl87kyPhbvwKd03qQSFD4tois7 oqy4bRxbP3qpXNkFhC+ZepnFDZid0d2U9LS0DCiG2MvYqzq+i3ybzQ89WYNMd/sm7E 7Y5rJYgCm5rqLufKCfaNThotZWNbAzII+HZc1FeAUL/Ifc71h4kaTEYG8tKHeJMQ4o Lce4z9I6lFNAquQWddl3pcX0nwc1L8oRUrs9L88LdaENKemne/ZCUY+6g43KBVWIE3 6XyIDj3ur19YNByGBUx4JjtLODwjdYybJZaNYNsbGCltX5yN5CEM8lgLnQx2svvkUx cxCrxFY18jAXDX2UFUelN5gtWiH5+Rds8tR5boM1eaLIhx9aY82oF4ftwnq7Fc5eAQ hlDlxwe7fMmuNOmSxU/Pt8ZV+poTMbeZGldBPB7NVenlXGSj5VyfqZ9+66V1gKwyfL pKJKim6Cdu4x+47daJTsWMGhx19pqyfyDBpjVZCgOt1ULwde/7Czi+bnYR5AFrlrEy PMxTIvt3zN/xrn8Uyp4r6CL/65ELuZWaHoq3pVb0967dC4Q2bINRoeZ1xCiffyzp2E SxKNnDTGBGD5mkT9i9hpKQSw= Received: from zn.tnic (p57969c58.dip0.t-ipconnect.de [87.150.156.88]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 95EA440E015E; Thu, 26 Jun 2025 15:22:14 +0000 (UTC) Date: Thu, 26 Jun 2025 17:22:13 +0200 From: Borislav Petkov To: "Kirill A. Shutemov" Cc: Andy Lutomirski , Thomas Gleixner , Ingo Molnar , 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 , 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 Subject: Re: [PATCHv7 01/16] x86/cpu: Enumerate the LASS feature bits Message-ID: <20250626152213.GCaF1lpfzIcrKsOwRr@fat_crate.local> References: <20250625125112.3943745-1-kirill.shutemov@linux.intel.com> <20250625125112.3943745-2-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20250625125112.3943745-2-kirill.shutemov@linux.intel.com> X-Stat-Signature: 61gbth5g8gke4rh7kznbsyhsnqckot94 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 6C4B9140010 X-Rspam-User: X-HE-Tag: 1750951395-363220 X-HE-Meta: U2FsdGVkX1/snOc9bXllxV5N6QWvVllzZIo4U8YEL6eEi+5AWfZMHOYW8TaZ0Llu68LuZSopZbEWhqIYBt6fngqZEK1MD0+0I885qK4rqOoXz+0lhwCq8BY0UpCWZmbJ7kIK7g2dmovSXABAFA1xwj7/nb2+9zdXubUHDwBEV4j2ePPh4AVmbq78iksBhihmzDB+ZMpFgAogqO2OnbtfbeYnlptr501HycedjqCWRcdaRLm5QckIGuPZym6ewZk6JFtWrfEf0iTYlJEAB3Cd9uCFMUxF5J8fCxVCXKx4ND/0EeRW4KkexLwcO+1w9/BoB+vX0knAZA4tcslYYrGy1Vf0iF6L8kIKjlv3G29FAYnOqzMLQD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=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Jun 25, 2025 at 03:50:53PM +0300, Kirill A. Shutemov wrote: > From: Sohil Mehta > > Linear Address Space Separation (LASS) is a security feature that > intends to prevent malicious virtual address space accesses across > user/kernel mode. > > Such mode based access protection already exists today with paging and > features such as SMEP and SMAP. However, to enforce these protections, > the processor must traverse the paging structures in memory. Malicious > software can use timing information resulting from this traversal to > determine details about the paging structures, and these details may > also be used to determine the layout of the kernel memory. > > The LASS mechanism provides the same mode-based protections as paging > but without traversing the paging structures. Because the protections > enforced by LASS are applied before paging, software will not be able to > derive paging-based timing information from the various caching > structures such as the TLBs, mid-level caches, page walker, data caches, > etc. > > LASS enforcement relies on the typical kernel implementation to divide > the 64-bit virtual address space into two halves: > Addr[63]=0 -> User address space > Addr[63]=1 -> Kernel address space > > Any data access or code execution across address spaces typically > results in a #GP fault. > > The LASS enforcement for kernel data access is dependent on CR4.SMAP > being set. The enforcement can be disabled by toggling the RFLAGS.AC bit > similar to SMAP. > > Define the CPU feature bits to enumerate this feature and include > feature dependencies to reflect the same. > > LASS provides protection against a class of speculative attacks, such as > SLAM[1]. Add the "lass" flag to /proc/cpuinfo to indicate that the feature > is supported by hardware and enabled by the kernel. This allows userspace > to determine if the setup is secure against such attacks. > > [1] https://download.vusec.net/papers/slam_sp24.pdf > > Co-developed-by: Yian Chen > Signed-off-by: Yian Chen > Signed-off-by: Sohil Mehta > Signed-off-by: Alexander Shishkin > Signed-off-by: Kirill A. Shutemov > --- > arch/x86/Kconfig.cpufeatures | 4 ++++ > arch/x86/include/asm/cpufeatures.h | 1 + > arch/x86/include/uapi/asm/processor-flags.h | 2 ++ > arch/x86/kernel/cpu/cpuid-deps.c | 1 + > tools/arch/x86/include/asm/cpufeatures.h | 1 + > 5 files changed, 9 insertions(+) Reviewed-by: Borislav Petkov (AMD) -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette