Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp217163rdg; Thu, 12 Oct 2023 03:48:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFnvyq6vvK38tZGy8rUJNxF+YySpoRwjs/XIW5bhnH8bgxZl6XjuqCez1Aw/ITg19ZaEeYv X-Received: by 2002:a25:cbcb:0:b0:cae:d40f:5934 with SMTP id b194-20020a25cbcb000000b00caed40f5934mr24858988ybg.27.1697107720320; Thu, 12 Oct 2023 03:48:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697107720; cv=none; d=google.com; s=arc-20160816; b=qz7ryxJY0Xs+8cg5GCIyEkTQntdToTAplTMZHk5iyq82lImWpr9lOoLi94dBXCa+VV 8C5QNkaf9aOsZGt1ybL4lKJIQPAYlhwIGpCy2KHXvt4LWJG7FYOQK9E1hiZCSXRk1tVu GYv7dt1336llB88CPe8HItuAnvEjAbhMcwtjUXQgcqK+wGjDESYJTx3OM5UXRkhntI8J ARiSAX9mRUUg2gtBRk8R9TJV36qOxg1vaj/y7pqiEtDoWh4DqPZuEeyj8ccvuz0D0CaO czQpb6en9Q14kRw8QZZeI5m+8cUgnFM3aHwAavzn9gE9whBaj8+hoKLK//ZatCo5IUX+ iqIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XBhUlLUXpFNiQjcNWmFNytrRub9YUYcuDDd8SJGbp9M=; fh=Z+ku+zs9421SrxPuDm/mDpUw4oWMGYDmscivT2cc81s=; b=Ya5pCINbvcQKFzzoOumuOCSehIp8dgMVEaQ5SZHgeWtm+fkjdgIaFg1J1m43/NPtZs TKVvdQZYvqTKF59DveM2c5mS0LJkBublSXyT1nF//LW3df5qRCZvnN6vRtaaWGy4Cu8I Rg7wb290hDGl2GjwtCC0rjczRhr7AYHt3ic491CxjiqhdWWikQ1SBvMjNaODji5mT3x3 QzxavKQmmEqV50abyy1H+7JeeZqMQAER+r17XFNqvR7sp3YenV+7Ez28YzY2zdqiUoE3 7oLdqiMh5XcDYwSYCcZJVf+/P/tN8N/IpZr0DzOgPXPRQds081IM6QfpwpBxjvzrmiV+ 8+nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Lw5xjJoO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id 30-20020a17090a199e00b00278fe6b74c1si1982219pji.25.2023.10.12.03.48.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 03:48:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Lw5xjJoO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 8BD5A802A3FD; Thu, 12 Oct 2023 03:48:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377780AbjJLKs1 (ORCPT + 99 others); Thu, 12 Oct 2023 06:48:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235661AbjJLKs0 (ORCPT ); Thu, 12 Oct 2023 06:48:26 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AB8BD3; Thu, 12 Oct 2023 03:48:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=XBhUlLUXpFNiQjcNWmFNytrRub9YUYcuDDd8SJGbp9M=; b=Lw5xjJoOsrdpqAGlBpja1izi61 modJ6b3F4IEVl9yWwMiyNTdVDHS8KTsti7HMPTMM0BTIcdH5Qw1ceOJjlpH6OvOJzA8BWjz9lCO8u 0JKk5o5FvEvmIcNxOer2v/BzfJeZtIlYiYXSxYL5680TwVUpEJhu9G41pL5BJc0xFYZ0QO2SIJfO2 e50Q/LO4jvU4iHP8ilGx8/E6yAsF0RcFoNbSGTGxmwLUbYpLnPrnRbMUFs+3zXf/lg784hwvDrg2B cvew0YRQLU1UlK1xtJINQcK2tbgSIyAATDxShiiW4YeszBf/Yt081QQg19xEBA5dWRbiMr/nNJkgd D/1Lc22w==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qqtEE-00GRER-Cd; Thu, 12 Oct 2023 10:47:42 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 11CE830036C; Thu, 12 Oct 2023 12:47:42 +0200 (CEST) Date: Thu, 12 Oct 2023 12:47:41 +0200 From: Peter Zijlstra To: Sami Tolvanen Cc: Miguel Ojeda , Miguel Ojeda , Linus Torvalds , Greg Kroah-Hartman , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, patches@lists.linux.dev, Jarkko Sakkinen , Kees Cook , Alex Gaynor , Wedson Almeida Filho , David Gow , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-doc@vger.kernel.org Subject: Re: [PATCH v10 25/27] x86: enable initial Rust support Message-ID: <20231012104741.GN6307@noisy.programming.kicks-ass.net> References: <20220927131518.30000-1-ojeda@kernel.org> <20220927131518.30000-26-ojeda@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 12 Oct 2023 03:48:37 -0700 (PDT) On Fri, Oct 14, 2022 at 11:34:30AM -0700, Sami Tolvanen wrote: > On Fri, Oct 14, 2022 at 11:05 AM Miguel Ojeda > wrote: > > > > On Tue, Oct 11, 2022 at 1:16 AM Sami Tolvanen wrote: > > > > > > Rust supports IBT with -Z cf-protection=branch, but I don't see this > > > option being enabled in the kernel yet. Cross-language CFI is going to > > > require a lot more work though because the type systems are not quite > > > compatible: > > > > > > https://github.com/rust-lang/rfcs/pull/3296 > > > > I have pinged Ramon de C Valle as he is the author of the RFC above > > and implementation work too; since a month or so ago he also leads the > > Exploit Mitigations Project Group in Rust. > > Thanks, Miguel. I also talked to Ramon about KCFI earlier this week > and he expressed interest in helping with rustc support for it. In the > meanwhile, I think we can just add a depends on !CFI_CLANG to avoid > issues here. Having just read up on the thing it looks like the KCFI thing is resolved. I'm not sure I understand most of the objections in that thread through -- enabling CFI *will* break stuff, so what. Squashing the integer types seems a workable compromise I suppose. One thing that's been floated in the past is adding a 'seed' attribute to some functions in order to distinguish functions of otherwise identical signature. The Rust thing would then also need to support this attribute. Are there any concrete plans for this? It would allow, for example, to differentiate address_space_operations::swap_deactivate() from any other random function that takes only a file argument, say: locks_remove_file().