Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2677009rdb; Wed, 15 Nov 2023 07:37:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZY9YRvVStxUzsmVJGnA40RuBEFXeypUxtz+cQqW6BqZtVguEkzZXKPk5GekCZNt8wc1Hr X-Received: by 2002:a05:6a20:e108:b0:187:962d:746b with SMTP id kr8-20020a056a20e10800b00187962d746bmr591045pzb.9.1700062623591; Wed, 15 Nov 2023 07:37:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700062623; cv=none; d=google.com; s=arc-20160816; b=QSBYeiBHteT5ZrpC2DF1nsMhe9scPoutl7iCz0Bb5SHfX9YrAGezDWAk84GXxDBK/H KhlUA1SzjXygr+I/7ntvlCh8J7uVNRnop9BvxG2DhUBlgxCHjWAyDM9rwJKVOPmPk3Oe I+1NzFNyiW//FKgSjjctxKsxZG9DTkM9yjLu2gsUL+Ncc078JLQ948ojFtUPNO0oQ+n8 TK8k/0Kq4hwEICco3aX4PeZnA7kF0MF1IW5twwMslOGbz4hgNtlCuPkZDijobn18eHKq WgPI53dEDAPt/zKEEu2cUddoCsyCND5NsOg/0N2hlpJ13Wi45qsLY5H7gniEmWBpWKzX mdSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=R0JQketASqzwgW5yh7NMNjvO1ZuRMUYpVqc6VBhHaxI=; fh=aGJ+n4EoPeSwyJT0bLC5i9cURyszvGcvJbGRaORUQ5M=; b=okKQWhRtN2pRyI6uyGRkEvtGAlQFOxduVza+O5HUYP73n4YJWyB5QYbOA8zjdfrx2i Q0Q4MimTo45UfaxtgQufY1wHVGBX7euiH5ygyt1cYN3YtdsZtAyIhu4c4HVYFRUDbQtK gbZ60Vbvc/aQ0QaXkv+KhyGorPRP/Vv5RotsZR1eSWA7eHZk2gXInh6G6AkR0A9WqsiA aBjQGQmXTgvA3ggrdECx/oTZCitIYss6hoqDsoIZ/nhzz6+APilJ6UX5ZgXLjwkOsFoN 9Xnv5n4SnKoxj9+dmUyHNgAuK4KmHuGgGGdAFExx+eQTeCEryPVTmE2ki5o2dyF6JXpW K+1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=FPVrVlhl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id f1-20020a6547c1000000b005be1f24c815si10112236pgs.502.2023.11.15.07.36.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 07:37:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=FPVrVlhl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 9149A80FCCA4; Wed, 15 Nov 2023 07:36:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230045AbjKOPgX (ORCPT + 99 others); Wed, 15 Nov 2023 10:36:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjKOPgT (ORCPT ); Wed, 15 Nov 2023 10:36:19 -0500 Received: from mail-oa1-x30.google.com (mail-oa1-x30.google.com [IPv6:2001:4860:4864:20::30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3820D1A1 for ; Wed, 15 Nov 2023 07:36:15 -0800 (PST) Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-1f48ad1700aso483284fac.1 for ; Wed, 15 Nov 2023 07:36:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1700062574; x=1700667374; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=R0JQketASqzwgW5yh7NMNjvO1ZuRMUYpVqc6VBhHaxI=; b=FPVrVlhl8YkzgE7Cwmy0jGTKvIEEvSWrlZF4nEjA2vZGJSxmasgx4As00PUvzEcXQH Ex2ZK91C49Ag7+uneUtIyDvJDnlts/0VTj03IWTIQBlG+haV3XDIxgq9F/RU73st2dNh uptZigAMx98kL/cu7r7TX9q+GiZsb+Lw1IG+k8D/XRhVQz3N4RZ5/D5zVwlup74FkD/u P+6BqJiDUmXfzMYgPUoEYKmq7AQzCAT+p2keJId4dj/8XIRrV+DFBvrqadiA+CrDuJgO WvGE25Xr8m90MG+qX0Ig0jn07Go0fi44aUJ9rxp2TmL/FDsuZ7tj3XVAVOeJ2IsxqCKH LwWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700062574; x=1700667374; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=R0JQketASqzwgW5yh7NMNjvO1ZuRMUYpVqc6VBhHaxI=; b=GAkCIOUDm1zO3XEPmU/WDcossBYAIXxbFEG9RMiPFnu819o4+pny4CqrUl6KabrMtE tehQ4TDGdOrH9oa8oeyeoHO/4+eGRRETS44A7dvtFcG81rPmk7GuP1nToMziG+Lku7rC vKH8Zh53hU2OldUsPf/2tiS2lnbIz6dwuvpcMAceJTzPkJRyI1j98GVkrPk5DEgidVDZ vykrG4ZEQtWhvXGZwheiCFVpfTlX0oneHIHXHOw0Lec754IQ/R9aWDY5Yjds/x+faXmd 2NEC8ABzkGmmBgymXmytMgma2wP+tx+BBhpPkQlZmEBFqWbc9upNN+4B3dDI4QhnDZan yxLQ== X-Gm-Message-State: AOJu0Ywaim3ioNmFhxl+Dj+eybAp4rCDtDieaWQZ8r6X65wBOJnVhShn IdHrlF5d8hsRfUQ2RJMqd3IZ2A== X-Received: by 2002:a05:6870:4301:b0:1e9:b50e:26dc with SMTP id w1-20020a056870430100b001e9b50e26dcmr3138752oah.12.1700062574434; Wed, 15 Nov 2023 07:36:14 -0800 (PST) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id o187-20020a4a44c4000000b00581daa5c5fdsm721783ooa.29.2023.11.15.07.36.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 07:36:13 -0800 (PST) Date: Wed, 15 Nov 2023 07:36:10 -0800 From: Deepak Gupta To: Mark Brown Cc: "Rick P. Edgecombe" , Szabolcs Nagy , "H.J. Lu" , Florian Weimer , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Christian Brauner , Shuah Khan , linux-kernel@vger.kernel.org, Catalin Marinas , Will Deacon , Kees Cook , jannh@google.com, linux-kselftest@vger.kernel.org, linux-api@vger.kernel.org, David Hildenbrand Subject: Re: [PATCH RFC RFT v2 1/5] mm: Introduce ARCH_HAS_USER_SHADOW_STACK Message-ID: References: <20231114-clone3-shadow-stack-v2-0-b613f8681155@kernel.org> <20231114-clone3-shadow-stack-v2-1-b613f8681155@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20231114-clone3-shadow-stack-v2-1-b613f8681155@kernel.org> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 15 Nov 2023 07:36:47 -0800 (PST) On Tue, Nov 14, 2023 at 08:05:54PM +0000, Mark Brown wrote: >Since multiple architectures have support for shadow stacks and we need to >select support for this feature in several places in the generic code >provide a generic config option that the architectures can select. > >Suggested-by: David Hildenbrand >Signed-off-by: Mark Brown >--- > arch/x86/Kconfig | 1 + > fs/proc/task_mmu.c | 2 +- > include/linux/mm.h | 2 +- > mm/Kconfig | 6 ++++++ > 4 files changed, 9 insertions(+), 2 deletions(-) > >diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig >index 3762f41bb092..14b7703a9a2b 100644 >--- a/arch/x86/Kconfig >+++ b/arch/x86/Kconfig >@@ -1952,6 +1952,7 @@ config X86_USER_SHADOW_STACK > depends on AS_WRUSS > depends on X86_64 > select ARCH_USES_HIGH_VMA_FLAGS >+ select ARCH_HAS_USER_SHADOW_STACK > select X86_CET > help > Shadow stack protection is a hardware feature that detects function >diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c >index ef2eb12906da..f0a904aeee8e 100644 >--- a/fs/proc/task_mmu.c >+++ b/fs/proc/task_mmu.c >@@ -699,7 +699,7 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma) > #ifdef CONFIG_HAVE_ARCH_USERFAULTFD_MINOR > [ilog2(VM_UFFD_MINOR)] = "ui", > #endif /* CONFIG_HAVE_ARCH_USERFAULTFD_MINOR */ >-#ifdef CONFIG_X86_USER_SHADOW_STACK >+#ifdef CONFIG_ARCH_HAS_USER_SHADOW_STACK > [ilog2(VM_SHADOW_STACK)] = "ss", > #endif > }; >diff --git a/include/linux/mm.h b/include/linux/mm.h >index 418d26608ece..10462f354614 100644 >--- a/include/linux/mm.h >+++ b/include/linux/mm.h >@@ -341,7 +341,7 @@ extern unsigned int kobjsize(const void *objp); > #endif > #endif /* CONFIG_ARCH_HAS_PKEYS */ > >-#ifdef CONFIG_X86_USER_SHADOW_STACK >+#ifdef CONFIG_ARCH_HAS_USER_SHADOW_STACK > /* > * VM_SHADOW_STACK should not be set with VM_SHARED because of lack of > * support core mm. >diff --git a/mm/Kconfig b/mm/Kconfig >index 89971a894b60..b8638da636e1 100644 >--- a/mm/Kconfig >+++ b/mm/Kconfig >@@ -1270,6 +1270,12 @@ config LOCK_MM_AND_FIND_VMA > bool > depends on !STACK_GROWSUP > >+config ARCH_HAS_USER_SHADOW_STACK >+ bool >+ help >+ The architecture has hardware support for userspace shadow call >+ stacks (eg, x86 CET, arm64 GCS, RISC-V Zisslpcfi). Minor correction for future version.RISC-V choose to split extension [1, 2]. It's now: Zicfiss - CFI using shadow stack Zicfilp - CFI using landing pad So for shadow stack purposes, we can start saying "RISC-V Zicfiss" [1] - https://lists.riscv.org/g/tech-ss-lp-cfi/message/55 [2] - https://github.com/riscv/riscv-cfi/pull/126 >+ > source "mm/damon/Kconfig" > > endmenu > >-- >2.30.2 >