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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A6483C52D7C for ; Fri, 23 Aug 2024 13:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ybuxDSzaEzUOXSZ2dvbeD6Jz2vfJXWXCmLqzeDlSO3g=; b=KQDj3IebaSMASJbCpnpQlI/etz oICsH6eWh5sMJ66+KFe2dQbUc/QEJfHziWayGmE1EVfdRvSURmiE6/ixbENx8i5sO5g/l69gNxBui nsi2dDUwaf6EUspeD2iy6EazUL5NotkXr4HXT+y7cDBnLCZCeeyx01MVG6z88yS8NndoE9XJ6jU9t a0M+A6AwIEApwieyHLYFl6Hc0FnqHcwJBXrwUqioCUj+HQGyDhMFPzkjWe01QNynJ0mTMq8prNBmc T763X4kLSXbBG4w8E9gNUkRg4NKv6ZQtHga/4LIv4h2lipYTDuyXjljhKOA6R65DSa1sQKblMtdUN 12RVUvPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shTuq-0000000GnIO-1rBk; Fri, 23 Aug 2024 13:01:20 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shTrQ-0000000GmcS-2Yek for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2024 12:57:50 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 2A47CA41172; Fri, 23 Aug 2024 12:57:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E18ADC32786; Fri, 23 Aug 2024 12:57:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724417867; bh=OY6bHJnU223oOGs7StLRb/15d3cmv1bT3z4OTLXYa7U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OoI164sRioS+ZRkcaa32xMRuXmoD8VikBeqQOHtPE+5ZDIqx571cIOip9lJQsGp0u HU38wy81WLF1JdoqPmM7bAL/5s4Z9ik1KUN9URWLi7mAP4v2TT2/mCnsbJaMMZFrXe 3WS35laSVr9FYllsjupy1oNtjgM1vU3d9uNeZs2AzmnhZUBAtbxyqmEOpgBWWnjGzD UWYrdmQjLY4kDRL3ks1Xb2/gMWi1bbGcgRbe/f2gxnIK32oAjoIZKTqs6iy7/gP1zU 8Q4Aa717QW14pTghtY26G2ZIIBsrVZyNkvB0kKdJ1W4HJUaDxI7tbiIBgrqH8o8zkN 2NJX12Ki6DzGg== Date: Fri, 23 Aug 2024 13:57:39 +0100 From: Will Deacon To: Alice Ryhl Cc: Catalin Marinas , Jamie Cunliffe , Sami Tolvanen , Nathan Chancellor , Conor Dooley , Masahiro Yamada , Nicolas Schier , Ard Biesheuvel , Marc Zyngier , Mark Rutland , Mark Brown , Nick Desaulniers , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Valentin Obst , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, rust-for-linux@vger.kernel.org, Kees Cook Subject: Re: [PATCH v5] rust: support for shadow call stack sanitizer Message-ID: <20240823125739.GA32156@willie-the-truck> References: <20240806-shadow-call-stack-v5-1-26dccb829154@google.com> <20240820143503.GD28338@willie-the-truck> <20240823122423.GB32110@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_055748_966102_E635F5A9 X-CRM114-Status: GOOD ( 35.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Aug 23, 2024 at 02:38:20PM +0200, Alice Ryhl wrote: > On Fri, Aug 23, 2024 at 2:24 PM Will Deacon wrote: > > > > On Tue, Aug 20, 2024 at 05:13:58PM +0200, Alice Ryhl wrote: > > > On Tue, Aug 20, 2024 at 4:35 PM Will Deacon wrote: > > > > On Tue, Aug 06, 2024 at 10:01:44AM +0000, Alice Ryhl wrote: > > > > > diff --git a/init/Kconfig b/init/Kconfig > > > > > index fe76c5d0a72e..d857f6f90885 100644 > > > > > --- a/init/Kconfig > > > > > +++ b/init/Kconfig > > > > > @@ -1909,7 +1909,7 @@ config RUST > > > > > depends on !MODVERSIONS > > > > > depends on !GCC_PLUGINS > > > > > depends on !RANDSTRUCT > > > > > - depends on !SHADOW_CALL_STACK > > > > > + depends on !SHADOW_CALL_STACK || RUSTC_VERSION >= 108000 && UNWIND_PATCH_PAC_INTO_SCS > > > > > > > > Sorry, I didn't spot this in v4, but since UNWIND_PATCH_PAC_INTO_SCS is > > > > specific to arm64 and the only other architecture selecting > > > > ARCH_SUPPORTS_SHADOW_CALL_STACK is riscv, I can't help but feel it would > > > > be cleaner to move this logic into the arch code selecting HAVE_RUST. > > > > > > > > That is, it's up to the architecture to make sure that it has whatever > > > > it needs for SCS to work with Rust if it claims to support Rust. > > > > > > > > What do you think? > > > > > > The `select RUST if ...` is going to get really complicated if we > > > apply that rule in general. Having options here allows us to split > > > them across several `depends on` clauses. I'm not sure it will even > > > work, I had issues with cyclic Kconfig errors previously. I also don't > > > think it's unreasonable for the architecture to say it supports both > > > options when it really does support both; they are just mutually > > > exclusive. I also think there is value in having all of the options > > > that Rust doesn't work with in one place. > > > > I'm not sure I follow why this will get really complicated. Isn't it as > > straightforward as the diff below, or did I miss something? > > Hmm. I tried this but I wasn't able to enable Rust with this setup. > Even though the deps of RUSTC_SUPPORTS_ARM64 are ok, it doesn't seem > to be enabled and I can't find it in menuconfig. I think we need to > have a `select RUSTC_SUPPORTS_ARM64` somewhere. Sorry, yes, my diff was a little half-arsed: > > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > > index a2f8ff354ca6..2f5702cb9dac 100644 > > --- a/arch/arm64/Kconfig > > +++ b/arch/arm64/Kconfig > > @@ -231,7 +231,7 @@ config ARM64 > > select HAVE_FUNCTION_ARG_ACCESS_API > > select MMU_GATHER_RCU_TABLE_FREE > > select HAVE_RSEQ > > - select HAVE_RUST if CPU_LITTLE_ENDIAN > > + select HAVE_RUST if RUSTC_SUPPORTS_ARM64 > > select HAVE_STACKPROTECTOR > > select HAVE_SYSCALL_TRACEPOINTS > > select HAVE_KPROBES > > @@ -265,6 +265,11 @@ config ARM64 > > help > > ARM 64-bit (AArch64) Linux support. > > > > +config RUSTC_SUPPORTS_ARM64 > > + bool This line ^^^ should be 'def_bool y'. Will