From patchwork Thu Jul 4 15:07:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alice Ryhl X-Patchwork-Id: 13723882 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 15964C30653 for ; Thu, 4 Jul 2024 15:09:16 +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:Content-Type:Cc:To:From: Subject:Message-ID:References:Mime-Version:In-Reply-To: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=SAGA5ww7PBaqsKtz9jWie7SRiEUO1154T36qXbEcKNY=; b=mMKAewCTBD88dU5CDQnfDqC2Ar pMSTyMq5NO6vHcI3+51Kq2HyVh6nlBVDNNsR0P4rTz8jnh3aYY0rVEX+8PbwUrBbOB+Yx6cyH6YVo 3O1Z+wYcSteOhoMdnmM1LdmxaCIdDIpkY+seqNlmfu37Z1WzFHB2tm1MH1FLDzw6kyqO8HQep1EWD zrbod/djSDrTCfLMO3KNSwKTuoaXwsDwyTu4on5Dk8cizF0igaQGx9klyTQcNWV0sVa3Jvy8kR0bx atC7SCuj/7MSfcfgTOF9XqRxq3pnc7nj+wq/MPG5WXWb5VlgPSLpioY7VoFsK8o7lxTPYbpqLfCXs xjejllyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPO54-0000000DdBd-1PFg; Thu, 04 Jul 2024 15:09:06 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPO4f-0000000Dd4a-3qdH for linux-arm-kernel@lists.infradead.org; Thu, 04 Jul 2024 15:08:43 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-64a5503e253so11568707b3.0 for ; Thu, 04 Jul 2024 08:08:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1720105720; x=1720710520; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=SAGA5ww7PBaqsKtz9jWie7SRiEUO1154T36qXbEcKNY=; b=jXrTp2Yf3me5cN2rngrBkhOMcttC1j0qWFtWw/C1DrymF4l3V6YLFmg42PschDy/A8 Si1tX4S17gmzbz/c9J12RYP66cIBsnFOpIJvT1t6IASHhCxqNVgW5gw0Mx+1l93z0hrY sChtqPXXfn3DnY6UOYrSlC+Cp8ykwjwS/r84v5YErrshGkNPe0J2cpLMIJ78QfzkAjBZ 8c16xgYKCPW7iifh/ARiULt3kTWYEK8zoNJ4BHVeIAOTO6oTHRXDk/nfzrvd4iFhzhpW qRkUQmJys0XK19+8epf8R4cKaj/Atcd+7I0DLmoXhPPN1d58HdRgWZymEIjTPEzKR94O hhpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720105720; x=1720710520; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SAGA5ww7PBaqsKtz9jWie7SRiEUO1154T36qXbEcKNY=; b=ZIpLMZOR8rGN2ccrOtsNxftTOs7FGAyg6vZhuyYQDjHk7XU8ZeFsszKpz79s9bwkWz QOlBmsWJS1dcPWcRaZWFurhA4Dc7PFiwrgFXMEpFKyNkK42jazFfbFZ3FttaB50qCojr 6ffgBDofmMQ/hGLkLFQwCecIe7qOad8Te5fV1McXt3T9IULHUUrkVC7IXX+rqOONExVu LgOVWy4hRO4O9vmPrQQjqFweS9CzRndhlnxJTxQMMxOjGZ82XCZoSlU5E/Jhom5vscA4 NxscMR9ZVYIcEawfIFslxO7hzwpi+PzbzGFhGrtvV1WQ9KbPHV5MCjkyNn49M8vxxNYr b7eQ== X-Forwarded-Encrypted: i=1; AJvYcCUShdHADPBuqSGQJRhQa4oUmdinG4xXZF8FCPuRs1quUrEMrkc+mrjC8pDWe6g82gjkMkHFBtcefgbduG0Y5lviLMxGMc7NqGLz9wHSdoBlrnDMgHw= X-Gm-Message-State: AOJu0YyXIo3b05U3IG2bSwG2brXD++CCCbHEbW8ixcdsUV+zVhb2P0Hp 7khqC2ulLlks/5exW9EUB5PB+DWQ3nlVET9/57jmasf6tK8bCjLZhKgSmoB5pZC+DejS7yFXR22 Yj3gl2Yh8hyUedA== X-Google-Smtp-Source: AGHT+IH9VR4RffY5ScSTYKGpVKwBEYexOCB2n8xGn6gRVku1k17axUw8NVFzJcK+jQWO+R5Xkyy9mMm5f3/pfeo= X-Received: from aliceryhl2.c.googlers.com ([fda3:e722:ac3:cc00:68:949d:c0a8:572]) (user=aliceryhl job=sendgmr) by 2002:a05:690c:6ac1:b0:62f:1f63:ae4f with SMTP id 00721157ae682-652d52257fdmr189047b3.1.1720105719836; Thu, 04 Jul 2024 08:08:39 -0700 (PDT) Date: Thu, 04 Jul 2024 15:07:57 +0000 In-Reply-To: <20240704-shadow-call-stack-v3-0-d11c7a6ebe30@google.com> Mime-Version: 1.0 References: <20240704-shadow-call-stack-v3-0-d11c7a6ebe30@google.com> X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=1257; i=aliceryhl@google.com; h=from:subject:message-id; bh=QPeVUrgaEZ8qmuC1e4Q7Ja32koHMoz2tK0lcoaVyWDQ=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBmhrrwg1l3+ZOI9jUnEe2Ion3jAzyudZf+KalrV Er782CNi0+JAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCZoa68AAKCRAEWL7uWMY5 RuMYD/44sZG6ccdUiVJPsf3WNFs8QZDVkyvHrlDdZvFrnjTE+0I+ej6cAW8aEFxmQoaZqxeeXpx SDRqfb2Sz1Uj2ib1iSeVDyCwjoWh3E5+1Lm4upvweGFhYBYthF+y+CWYDs6CyGgNeZ5Dy3422dw GGz52J6La0cXE4+6QWpi2Zq3TViMm78qa+5CbpWhBVC2DBosxiS8R8cnOLRPBCPlEQHf9nQuztI K6dGHGRWsgz6rDq3i698LIG3yDdfIfJkB0cHAP6PvVi2MAFk/iA9XT9Keeuybof6jGr+s0/52UB o0WYgva8Rjn906xSBQGzKXw7MUiYKfsXHhNGUEaYr37nQpsjsIZz8OC7/gd9V+DqSuZw1PD7ygK MM7KZd4Xsog/XkFbddNNOIFhTCDBFRXT+oi+hnAHgZahBSOms2QKjLMXEkGP6HT9kkV8yeyQVm8 JJnLJPKLU7exs/BQS+F8CpwV/Yq9PCpWoPeHS0Kw7mHx3tyrRdYjY1qOFgYRXYo7TrLD1EPilIk 2qGi0OpfdvxyMVB2TerIT9qB4HmCsVUOoJ5t8JLxYQYVWHKlxpLDe915CBgx6jbkV5XWZEArDex LoxSzqQgKQeaHG5yS3FUOagePEZONfPqAFgK7i4ixwbAkDT871Ax5JVgV7phRM+l/2NeBgkZlu4 9RLIicJGiY7+IIA== X-Mailer: b4 0.13-dev-26615 Message-ID: <20240704-shadow-call-stack-v3-1-d11c7a6ebe30@google.com> Subject: [PATCH v3 1/2] rust: SHADOW_CALL_STACK is incompatible with Rust From: Alice Ryhl To: Catalin Marinas , Will Deacon , Jamie Cunliffe , Sami Tolvanen Cc: 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 , " =?utf-8?q?Bj=C3=B6rn_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, Alice Ryhl , stable@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240704_080841_983237_1FDC7229 X-CRM114-Status: GOOD ( 12.49 ) 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 When using the shadow call stack sanitizer, all code must be compiled with the -ffixed-x18 flag, but this flag is not currently being passed to Rust. This results in crashes that are extremely difficult to debug. To ensure that nobody else has to go through the same debugging session that I had to, prevent configurations that enable both SHADOW_CALL_STACK and RUST. It is rather common for people to backport 724a75ac9542 ("arm64: rust: Enable Rust support for AArch64"), so I recommend applying this fix all the way back to 6.1. Cc: # 6.1 and later Fixes: 724a75ac9542 ("arm64: rust: Enable Rust support for AArch64") Signed-off-by: Alice Ryhl --- arch/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/Kconfig b/arch/Kconfig index 975dd22a2dbd..238448a9cb71 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -690,6 +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 || !FUNCTION_GRAPH_TRACER + depends on !RUST depends on MMU help This option enables the compiler's Shadow Call Stack, which