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 1C00AC30653 for ; Thu, 4 Jul 2024 17:17:37 +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-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=afG4S3ekYzY2YcpNdweNFOk2T+1eCBbPOMMh4SzqOfk=; b=F9uhaPZxI74pXtqaEcNtEYsx6T 1UbsL2e6ExkVrt5EIv1wcUg5zqmXfvYKQ5mu/yFEO06YPyIi/tHIy4KhNEgGUTPbjKB7M+isZ7pso ffz7ebyJ+DQS8az85OO2r6j8v/wXaBloZ2yI8z+9PZOYCCTkHrJNCisF/RAGWLo0zNt26rwSgx0s+ ZhEPP2cB6yie1q5/P9jBRGvJfc2XW/j5DuOUvRyU2rGNJ6DIzbjeWV7IkbPngeNbGSFa+e912t85w sWHRv+yKE7K3aax2ZEmqM/K1NEiOadO2eRtSkRg50CXZLh4rRDsw8/bmEp8s5utz8tt5nEcmBXowd +DfBHQRw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPQ5H-0000000Dxjl-2fQv; Thu, 04 Jul 2024 17:17:27 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPQ4y-0000000Dxbx-0ELi for linux-arm-kernel@lists.infradead.org; Thu, 04 Jul 2024 17:17:14 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id D25E3CE328F; Thu, 4 Jul 2024 17:17:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26F33C3277B; Thu, 4 Jul 2024 17:16:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720113425; bh=6KBZ6d3b2y4heC9NhfRu6FvZmJNP5IgVVL6D6CaLHHY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=E/IJ5KxPMbOiZFO8Yr3ndkeiBUqJM/u94mYyMeSZp3KhKpSf4jXJtz3sGcDCAzOxp JCvfpuwAr6ywDGpeSMJxsTkqYzV0A7vxBgDjpqlK9n8qKT3bsG/bNIlQRfhIkrRUpJ aAV9Vct6jstAVQR5uba29phm+3ylyzkhwuQPT2fQFksz1iaeA+nS3WHY9OYpMWVLK2 46XXkV7zHaECXBLFtS+6NOoclLfZvw8LqnoZP2uiYtp6B1VD06R1zhYVazDmYakJTK XHLjJS7YQR2D8E0/EbjKVAdcYTSRK76TtyYxGDfmA5TSDcHzU4gaF30SONys7SenJN wzzyNDgCrDu8g== Date: Thu, 4 Jul 2024 18:16:58 +0100 From: Conor Dooley To: Alice Ryhl Cc: Catalin Marinas , Will Deacon , Jamie Cunliffe , Sami Tolvanen , Masahiro Yamada , Nathan Chancellor , Nicolas Schier , Ard Biesheuvel , Marc Zyngier , Mark Rutland , Mark Brown , Nick Desaulniers , Kees Cook , 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 Subject: Re: [PATCH v3 2/2] rust: add flags for shadow call stack sanitizer Message-ID: <20240704-unless-cache-8a971c244348@spud> References: <20240704-shadow-call-stack-v3-0-d11c7a6ebe30@google.com> <20240704-shadow-call-stack-v3-2-d11c7a6ebe30@google.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pilQx93eD8hL4hZr" Content-Disposition: inline In-Reply-To: <20240704-shadow-call-stack-v3-2-d11c7a6ebe30@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240704_101708_475182_31FC0BC2 X-CRM114-Status: GOOD ( 26.43 ) 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 --pilQx93eD8hL4hZr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 04, 2024 at 03:07:58PM +0000, Alice Ryhl wrote: > As of rustc 1.80.0, the Rust compiler supports the -Zfixed-x18 flag, so > we can now use Rust with the shadow call stack sanitizer. >=20 > On older versions of Rust, it is possible to use shadow call stack by > passing -Ctarget-feature=3D+reserve-x18 instead of -Zfixed-x18. However, > this flag emits a warning, so this patch does not add support for that. >=20 > Currently, the compiler thinks that the aarch64-unknown-none target > doesn't support -Zsanitizer=3Dshadow-call-stack, so the build will fail if > you enable shadow call stack in non-dynamic mode. See [2] for the > feature request to add this. Kconfig is not configured to reject this > configuration because that leads to cyclic Kconfig rules. >=20 > Link: https://github.com/rust-lang/rust/issues/121972 [1] > Signed-off-by: Alice Ryhl > --- > Makefile | 1 + > arch/Kconfig | 2 +- > arch/arm64/Makefile | 3 +++ > 3 files changed, 5 insertions(+), 1 deletion(-) >=20 > diff --git a/Makefile b/Makefile > index c11a10c8e710..4ae741601a1c 100644 > --- a/Makefile > +++ b/Makefile > @@ -945,6 +945,7 @@ ifdef CONFIG_SHADOW_CALL_STACK > ifndef CONFIG_DYNAMIC_SCS > CC_FLAGS_SCS :=3D -fsanitize=3Dshadow-call-stack > KBUILD_CFLAGS +=3D $(CC_FLAGS_SCS) > +KBUILD_RUSTFLAGS +=3D -Zsanitizer=3Dshadow-call-stack > endif > export CC_FLAGS_SCS > endif > diff --git a/arch/Kconfig b/arch/Kconfig > index 238448a9cb71..5a6e296df5e6 100644 > --- a/arch/Kconfig > +++ b/arch/Kconfig > @@ -690,7 +690,7 @@ config SHADOW_CALL_STACK > bool "Shadow Call Stack" > depends on ARCH_SUPPORTS_SHADOW_CALL_STACK > depends on DYNAMIC_FTRACE_WITH_ARGS || DYNAMIC_FTRACE_WITH_REGS || !FUN= CTION_GRAPH_TRACER > - depends on !RUST > + depends on !RUST || RUSTC_VERSION >=3D 108000 > depends on MMU > help > This option enables the compiler's Shadow Call Stack, which For these security related options, like CFI_CLANG or RANDSTRUCT, I'm inclined to say that RUST is actually what should grow the depends on. That way it'll be RUST that gets silently disabled in configs when patch 1 gets backported (where it is mostly useless anyway) rather than SCS nor will it disable SCS when someone enables RUST in their config, instead it'd be a conscious choice. Cheers, Conor. --pilQx93eD8hL4hZr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZobZCQAKCRB4tDGHoIJi 0op3AQDGn+hWppfWYDd7g/Ck3at4aD+SwbMd/jUQuQ9pL+qLpgD+MahETrfZpXoA f/6oMzXX33g7xHjyqSsL73pnqhMoBQU= =7i1H -----END PGP SIGNATURE----- --pilQx93eD8hL4hZr--