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 E1898C5475B for ; Wed, 6 Mar 2024 19:16:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To: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=lqjaDq5wkVqg7AUTIzbhsOcmN1Is4yG0q2/kLtqTSRY=; b=H8fDMEhnafrDB6 hgIoFlKZl0fEtUL6ecijqsvp6xQWUxFKVZ3njJWfEBRKY7y9hqacZDxLP0T1T40Ekw+0iiZ/e1kxW AJtiiyaN19krmjiMSdXewxjuVekpcDLF30XqLyBoptuunv7GxAgdEv20zTWG1MnzhckuSYXfUxZeT Mnj89Ni98OHRVfoBRagkAaxdLR1aHDIqFkpH2Dd1Gu2WOkAsR/EI38oEf5BFhlBMARmFTwKwfjSlh 9gTeA7voSD4AcpkoUa1ckZZQyxXIS6V+DNH7gJ9dakO/ijupTgJU77TdYPfHYpKpIzH2HXJF4Cznm lOZihFYz9ddjhq/l4tog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rhwk3-00000001b7K-2LK1; Wed, 06 Mar 2024 19:15:51 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rhwjx-00000001b5Y-184j for linux-arm-kernel@lists.infradead.org; Wed, 06 Mar 2024 19:15:49 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1dba177c596so904125ad.0 for ; Wed, 06 Mar 2024 11:15:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709752538; x=1710357338; darn=lists.infradead.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=jVzv+SoRW1+I9CQGe/RRjiGpq2ikkVRYKb843GfHzio=; b=oOa0AUrsjuYW0b8NV3PkjTv8L0JdK1PaqksOb6NEH1yefwPaxpAQqGzLfDyTRRcCEK 0pVC91uI2gj1gJzoW0MGTVJQTNGljWVXJakKIgUGr6yT20ox5Nxc/7XDuEAoLywozTWS AiPalhwCsz8P+Few4XWRjAP+WtdZ3PVHk2egkxxbxRexVHP8o8ysrGxi2FmBw3tJDowZ ZCGWN7suJjH6zRrrewsddr7lDB23v++bmMjr1XpGJ85rMH+X1d+37RWDPoaLSkDwaeW7 BmB8AEG0R1kgoHI8INisyUt3aaaJo1ov8O6ylXPCCFl+2ZaxpSX+8OjHvnndmEwGtAR5 O7Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709752538; x=1710357338; 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=jVzv+SoRW1+I9CQGe/RRjiGpq2ikkVRYKb843GfHzio=; b=N44r6wSQPjHUleJieyFBnKLXZaL+XcQmHWltq/7qFqF00Rqrto4WL3YT0jzQYuq3Kz 5lx65mMWbZ0EfR1pZhkcp4RF4lY+Wz9lTZwCTnNU7wpxkgc5/uJCyzLR17bOoo73GIfu qCZdv8gXm607vGcj28WWduKokxZhPMmAOS4FlAlGt0xJn+Y6Cdoz8SUvnNpyB8dHDrgJ 8U2Fjl1WYzcQEUnCByYnivjymYZFIiiwCd5tB84uU5F1tjzTkX2PRjqBulYX7w9sM/jd /wFG/2CTLi46oM0rU3y/uOfKDocuCSBXY5Yjim62fTOULypzeBrGeIEmRvl5EX32c12i eBNw== X-Forwarded-Encrypted: i=1; AJvYcCXtSfTgPjGfJ8HWQf3xdKcfmdn0MdeFN69p7z4EQB3XCJ/Bfoluomr811cqoVjMMEpqncIX0/jSVUhU4vFCKUbTiBc44g8bQxNoYGs4RAfBo7AeKOo= X-Gm-Message-State: AOJu0YyMCNUhJxlHiB0kfZcYQFjhnv4yjJli71iWwGq/0WB3WEcEFrTw Pdyg+FGNuGRst+cQwdJ8IptmAdmKNT7kucU87ghNsEORQxabp6QDcFZzFO3d6A== X-Google-Smtp-Source: AGHT+IGuYdCp1Cb41tMReB+PFmMHU4FwyH+nvlsqKqWQhCiftNEMDk5tCFfJIakTDZEyeAYTvDWXzg== X-Received: by 2002:a17:902:e5cb:b0:1dc:b64:13cd with SMTP id u11-20020a170902e5cb00b001dc0b6413cdmr1355783plf.27.1709752537788; Wed, 06 Mar 2024 11:15:37 -0800 (PST) Received: from google.com ([2620:0:1000:2510:8e30:f1a9:3b07:78c9]) by smtp.gmail.com with ESMTPSA id h15-20020a170902680f00b001dd090a7c00sm7520343plk.292.2024.03.06.11.15.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 11:15:37 -0800 (PST) Date: Wed, 6 Mar 2024 11:15:31 -0800 From: Sami Tolvanen To: Alice Ryhl Cc: Catalin Marinas , Will Deacon , Jamie Cunliffe , 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 v2] rust: add flags for shadow call stack sanitizer Message-ID: <20240306191531.GA454514@google.com> References: <20240305-shadow-call-stack-v2-1-c7b4a3f4d616@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240305-shadow-call-stack-v2-1-c7b4a3f4d616@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240306_111547_780333_0DE9289D X-CRM114-Status: GOOD ( 27.76 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Mar 05, 2024 at 11:58:45AM +0000, Alice Ryhl wrote: > Add flags to support the shadow call stack sanitizer, both in the > dynamic and non-dynamic modes. > > Right now, the compiler will emit the warning "unknown feature specified > for `-Ctarget-feature`: `reserve-x18`". However, the compiler still > passes it to the codegen backend, so the flag will work just fine. Once > rustc starts recognizing the flag (or provides another way to enable the > feature), it will stop emitting this warning. See [1] for the relevant > issue. > > Currently, the compiler thinks that the aarch64-unknown-none target > doesn't support -Zsanitizer=shadow-call-stack, so the build will fail if > you enable shadow call stack in non-dynamic mode. However, I still think > it is reasonable to add the flag now, as it will at least fail the build > when using an invalid configuration, until the Rust compiler is fixed to > list -Zsanitizer=shadow-call-stack as supported for the target. See [2] > for the feature request to add this. > > I have tested this change with Rust Binder on an Android device using > CONFIG_DYNAMIC_SCS. Without the -Ctarget-feature=+reserve-x18 flag, the > phone crashes immediately on boot, and with the flag, the phone appears > to work normally. > > This contains a TODO to add the -Zuse-sync-unwind=n flag. The flag > defaults to n, so it isn't a problem today, but the flag is unstable, so > the default could change in a future compiler release. > > Link: https://github.com/rust-lang/rust/issues/121970 [1] > Link: https://github.com/rust-lang/rust/issues/121972 [2] > Signed-off-by: Alice Ryhl > --- > This patch raises the question of whether we should change the Rust > aarch64 support to use a custom target.json specification. If we do > that, then we can fix both the warning for dynamic SCS and the > build-failure for non-dynamic SCS without waiting for a new version of > rustc with the mentioned issues fixed. > --- > Changes in v2: > - Add -Cforce-unwind-tables flag. > - Link to v1: https://lore.kernel.org/r/20240304-shadow-call-stack-v1-1-f055eaf40a2c@google.com Reviewed-by: Sami Tolvanen Sami _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel