Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1767558rdb; Thu, 25 Jan 2024 05:46:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IGp7LnzLV99+c50RUZWS8YM5+T1RCyTMuG++QpXP38S+q1FeTyz9JhJHIGDsyzhQCFHgyGy X-Received: by 2002:ac8:5993:0:b0:42a:64ed:f0dd with SMTP id e19-20020ac85993000000b0042a64edf0ddmr830369qte.101.1706190384681; Thu, 25 Jan 2024 05:46:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706190384; cv=pass; d=google.com; s=arc-20160816; b=ifjvse5OWtOF3/cDt/FGKGBWL2ocI9rxGMwFo9m3Fz+KD3y4JTTiu+8VZyp583LBtS aevcm/70JsWZ+IrT6341M8F2yrYhp6gE64kKpTtAmtMtE/i8uBzJgfBUDmqvEMrwDIqB AQ/LHDfWam5WCau6VZNh7EzbqR6kFVEkX7yZuE5427kDpR92yU1jZWP06fUydb86NU+Z Em1pxzu+5JlaHKb0iSWxc536BL3pDC8Be5MF7y9YCr6/WX6k53Z5MKn+N+nfD1V7Fgkr KLtGPvzRhii6zkiGFYyJtsfp/sEfLp165XKMJ5LSEua07ozgEq8Gvoh09Cd8HX0jvAob ny2A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=QkGYH2ypWOTDiq5BbVC5hKUniLV64BDsYDuZSL4c+Ek=; fh=FYKMJ1qfkafouHkcHwNPQPP7bmtNVfTb49rPFZ30ZtE=; b=qWh6A65vJpHaKxerDWQ5ntDsoM1vmHyINkEdk90bixt2PqSDvHDarVX3TM5BHcFS2u OPGD5TJ/WlcKPEgOhLDh8CcJG3D2efuO2nv+2rF80qCU2/iWM3cYT48ftEZAd6gvt+PV 76o+HqiNMbW94QiqObhODuw0aTZaZZJTm+lzkXvdzjUbcSmcOzn+2+G1/Oe6DvtapF6H mFgUYVq+SHtL1go7ackrHT/SD6Eq65Pzp1yqXs9Y9+RVyqGDXjZ4VHKSFEcfEhvcfE62 kQrMbFdo0VHwQqR4TS244yBFfK3J/SlPbvUoifx1DZ0WMqgGFvf7AwAoEnpsKYtuygkz coSg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=orCz+Hii; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-38678-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38678-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=microchip.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v17-20020a05622a131100b0042a3a9bd687si10159635qtk.738.2024.01.25.05.46.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 05:46:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38678-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=orCz+Hii; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-38678-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38678-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=microchip.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 626491C212DD for ; Thu, 25 Jan 2024 13:46:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F7215812A; Thu, 25 Jan 2024 13:46:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="orCz+Hii" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 935B05732D; Thu, 25 Jan 2024 13:46:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706190374; cv=none; b=QruronxoZwnKVfJBGxUqs7Ap5qDstYM4SU1PX9KivyyeBOy5DxIxW/jnL9HO68CuGI3wzTxgC/G6IqTtMbnWE2Ko4xz0a2MpTApp7OBGUZVqdJtY2CcoAperIgcj7SAqtaXVJupSGrSdNDZTlgvOwbrS8APhrRQ26nvH0DM68MI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706190374; c=relaxed/simple; bh=QkGYH2ypWOTDiq5BbVC5hKUniLV64BDsYDuZSL4c+Ek=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rGLisyoPUfamuPJjbJTEwZFFCw5KJpb7jYOe0AA3xpDxstqPAr9PdVLaXvv/X1/tBZd5CkvYJEYLdHohl7jwiuf1i3gxkA/YQ4mmHbt61fgVURTORPhSZgHpJ5ZS7ElnUNY2GFeKfeKh541Dloeuk/6lqR+vQy1nkVeXvFVdx8A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=orCz+Hii; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1706190372; x=1737726372; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=QkGYH2ypWOTDiq5BbVC5hKUniLV64BDsYDuZSL4c+Ek=; b=orCz+HiiQp/tfRwDA4AgKVTsDixe37pm18Tgv+OkbKj4Qjx+P+qRnR6E 5IjfilFA1gC+KYrluSL1jfrl+/eGEmB5dUBxVPi8xGkzFMCTbsLSoYZxk 0uL4J2sfY5dk9YinvaKvNNSst4HKUcVPgVR4I0cYw3mPLTz77VonnQIIl q/XTfd7UYmHSO//K1mrjW2QGjndEEgaLPsHucwOl10YM7XokQF5qtYEDb kyCdnZZNfskbAWfgc1VrExY5n60fFNym0pmjb+2UfA++5KXHeCCU5p/hI OEecHE8gON0ShOAbHzoYtQreFvSZOEyPZOQCwxTTjpMfNpNXYslPiE2fQ A==; X-CSE-ConnectionGUID: m+PhERqEQH65VJ/qKW5gkQ== X-CSE-MsgGUID: fy6M6828T9yyNgsJcQ4UyQ== X-IronPort-AV: E=Sophos;i="6.05,216,1701154800"; d="asc'?scan'208";a="15287685" X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 25 Jan 2024 06:46:11 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 25 Jan 2024 06:45:46 -0700 Received: from wendy (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Thu, 25 Jan 2024 06:45:42 -0700 Date: Thu, 25 Jan 2024 13:45:05 +0000 From: Conor Dooley To: Miguel Ojeda CC: Conor Dooley , , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Nathan Chancellor , Nick Desaulniers , Tom Rix , , , , , Matthew Maurer , Ramon de C Valle , Sami Tolvanen Subject: Re: [PATCH v1 0/2] RISC-V: enable rust Message-ID: <20240125-lazy-thrower-744aacc6632a@wendy> References: <20230307102441.94417-1-conor.dooley@microchip.com> <20230608-dispatch-sneer-aa09bd7b2eb8@wendy> <20230608-spiritism-gonad-5f5aff4c3a24@wendy> <20240117-swiftly-parasail-618d62972d6e@spud> <20240118-implode-delirium-eefdd86e170e@spud> <20240125-bucked-payroll-47f82077b262@wendy> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GuHppkpX7NvgOUA9" Content-Disposition: inline In-Reply-To: --GuHppkpX7NvgOUA9 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 25, 2024 at 01:50:05PM +0100, Miguel Ojeda wrote: > On Thu, Jan 25, 2024 at 1:31=E2=80=AFPM Conor Dooley wrote: > > > Recently, there has been a thread in our Zulip and a couple people are > > > experimenting: https://rust-for-linux.zulipchat.com/#narrow/stream/28= 8089-General/topic/Bindgen.20--.20GCC.20backend.20port > > > > That link for me goes to a message on 22/01, so later than the email you > > sent. >=20 > Zulip seems to scroll to the latest message in the topic -- you should > be able to scroll a bit up, but if that doesn't work, this link should > go to the first message: > https://rust-for-linux.zulipchat.com/#narrow/stream/288089-General/topic/= Bindgen.20--.20GCC.20backend.20port/near/412609074 Ah, thanks for the direct link :) >=20 > > That said, I gave things another spin today, in a different environment, > > as a final check before sending and found an issue causing kernel > > panics. RISC-V (and x86/arm64) supports kcfi (CFI_CLANG) but enabling I mention x86 and arm64 here, because my grepping didn't see the flag being set for x86 (in tree) or arm64 (in that series) if CFI_CLANG was set or any mutual exclusion. Has noone tried CFI_CLANG + RUST there or just not run into any issues? > > sanitisers seems to be a nightly only option for rustc. The kernel I > > built today had CFI_CLANG enabled and that caused panics when the rust > > samples were loaded. > > > > The CFI_CLANG Kconfig entry has a cc-option test for whether the option > > is supported, but from a quick check I don't see a comparable test to > > use for rust. Even if a test was added, the current flag is an unstable > > one, so I am not sure if testing for it is the right call in the first > > place, given the stabilised flag would be entirely different? >=20 > Yeah, KCFI and other mitigations is WIP -- Cc'ing Ramon and Matthew > who may be able to tell us the latest status. Also CC Sami I guess, since he is the one who added the CFI_CLANG bits to the kernel, and can probably comment on the suitability of adding a check etc. > Testing for unstable flags is fine, i.e. we only support a single > compiler, so we can change the name when we do the upgrade. Actually, thinking about it for a moment - if only a single compiler version is supported (the minimum, right?) then you could just add the -Zsanitizer=3Dkcfi flag whenever CFI_CLANG and RUST are both set. I'm not sure if that is a better option though. It's a choice between CFI_CLANG being disabled if the check is not updated when the toolchain is bumped versus being enabled for C and not for RUST. I think I prefer the former though, tracking down the cause of the latter I would rather not wish on a user. I vote for having the check, even if it can only ever be true at the moment. Cheers, Conor. --GuHppkpX7NvgOUA9 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZbJl4QAKCRB4tDGHoIJi 0r2YAP9Kbj4u//RY0nIROcBBxVP3ucR5cgnfxPjsXpqrdOu6FgD/ef8EVCC207/s Jy65DzLCk1V5UGLDXdSuKcxvD/qEngw= =6p43 -----END PGP SIGNATURE----- --GuHppkpX7NvgOUA9--