Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp268857rdh; Thu, 23 Nov 2023 03:39:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IFyj2vehEYGJCZiJ81uG2edOm8L9gIDLmJgl3F/qv0E1IM9tlfOmJBJBhzlMjSIM9/9wBM2 X-Received: by 2002:a05:6a21:7885:b0:18b:9428:cd1f with SMTP id bf5-20020a056a21788500b0018b9428cd1fmr2343059pzc.21.1700739593063; Thu, 23 Nov 2023 03:39:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700739593; cv=none; d=google.com; s=arc-20160816; b=iH5OtUsp92llW/EkRFmicePq4iA5sOP0g0unLYu534lWKWs7UfR2yNhGbeIcpJZYDg N/+Z4RoP8SwkxGMLFM6/XkLFwhFT7HA1AoTzjnQFvkumzL3ccqc9HEIYbOgkPmRUXHn5 /d04s53weytNwwL4AZojVOTCagm6x0UMMZj3RaGdKs+QlKgFWra7z2Y4UpJQgJoht7DQ f38sUrioKI4dNTE7AsbJUbn2dhcG2/rviZqldndtW1l/GAGZwhKYuenYWOJgTEj6d5/9 P61YNyo6843mgLhuZVpxjcmQtzbHqGuifiulr2cSR4RyTKb8XzPfXj+cPWFJzmYKD5VI Qb3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=iO9xrMKpmT4/tCCwuRMMviYOxZaBEq0VLh1Rtaestcg=; fh=2uu3RbBqtDPUjeKlm5z43T/bLzL2SBuz5m/X5haOmDw=; b=L5PziMKyn2oRRODdOo2GS+EvbgauZsFkBn+ykbc+/eYMtCNgjYF69n1K7ud2wMb6zl tl8k6RpjIKa+aknwezG1pq0y4RlVsu6nd/H3DUBPDxmlHwYRr91fA7+bis/yHilxfEFf pEaTZ5LY2GIjvTHeQ4tENvhS4CGI0s0ivaIy0BKA0l9RxacNgJ37c8ljoS40TSMLi+bJ b+p6GhGudX/ke4KlNGsj6/CFtEPnEM7106RuN6dDwxqBV4MSHNuSr0RXwnh3g4ctAW7Z VetLUOFvsWRmDhxhemGg+A7MFBMB7jaHYle/4pdkk+kj4GYnfzd/qZKDbqc/AT7ocIQo KemA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Gj/UEVwP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id v15-20020a056a00148f00b006cb6b7aa192si1118865pfu.331.2023.11.23.03.39.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 03:39:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Gj/UEVwP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id AA87380843DB; Thu, 23 Nov 2023 03:39:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345198AbjKWLje (ORCPT + 99 others); Thu, 23 Nov 2023 06:39:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345152AbjKWLjV (ORCPT ); Thu, 23 Nov 2023 06:39:21 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FF0810EC for ; Thu, 23 Nov 2023 03:39:23 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CC4AC433C7; Thu, 23 Nov 2023 11:39:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700739563; bh=QllpA71/m3DBpJ/yfnnpubGoAGIk5DmgA+EnjTDr7ng=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Gj/UEVwPr5PLINBZ3FBaWtVfaDSZso5fypwqc04eYMrLDYsFZWvQowjPtuvTBgpPR bjVQiIUvospkT8g/gT0QkkBq4j9lv8dibDyu8qUe0A7a/1og4h57QvdaaW6f+FIh7Y C7QiP4B+kzMfEffkZHraU5ZrIxeHIyGp3mOZ0h2AejevXJMGZTU5g5+ty3fGqNHyS8 lo/XFix2EKwzdHlj81v3QLNdDf58oRxGvfo7YSZQcqLrJeSGWXg5zf1OZ3qLiBn8Tj /T8JTrl0icYDjLmvUOFPZHF97u7M6WjcdjElNCIQjb/0vbSwPeH5aa3NccW1AmKjzu MJCavJlMdb3mQ== Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-586a516755aso840359eaf.0; Thu, 23 Nov 2023 03:39:23 -0800 (PST) X-Gm-Message-State: AOJu0YzbBGGrLzmVC8p19Xka3MREZ9hL2OUU3JKTUGlXWwdydCOVASNn lndiYRRBhIevjYASMrwylhatiwv8o2K/yYHxh9Q= X-Received: by 2002:a05:6870:aa99:b0:1e9:f0c5:4496 with SMTP id gr25-20020a056870aa9900b001e9f0c54496mr1181250oab.1.1700739562527; Thu, 23 Nov 2023 03:39:22 -0800 (PST) MIME-Version: 1.0 References: <20231118025748.2778044-1-mmaurer@google.com> <2023112314-tubby-eligibly-007a@gregkh> In-Reply-To: <2023112314-tubby-eligibly-007a@gregkh> From: Masahiro Yamada Date: Thu, 23 Nov 2023 20:38:45 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 0/5] MODVERSIONS + RUST Redux To: Greg KH Cc: Matthew Maurer , Nick Desaulniers , Miguel Ojeda , Gary Guo , Luis Chamberlain , Nathan Chancellor , Nicolas Schier , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, linux-kbuild@vger.kernel.org, rust-for-linux@vger.kernel.org, Laura Abbott Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Thu, 23 Nov 2023 03:39:50 -0800 (PST) On Thu, Nov 23, 2023 at 6:05=E2=80=AFPM Greg KH wrote: > > On Wed, Nov 22, 2023 at 01:04:09PM -0800, Matthew Maurer wrote: > > > So, even if you enable CONFIG_MODVERSIONS, > > > nothing is checked for Rust. > > > Genksyms computes a CRC from "int foo", and > > > the module subsystem confirms it is a "int" > > > variable. > > > > > > We know this check always succeeds. > > > > > > Why is this useful? > > The reason this is immediately useful is that it allows us to have Rust > > in use with a kernel where C modules are able to benefit from MODVERSIO= NS > > checking. The check would effectively be a no-op for now, as you have c= orrectly > > determined, but we could refine it to make it more restrictive later. > > Since the > > existing C approach errs on the side of "it could work" rather than "it= will > > work", I thought being more permissive was the correct initial solution= . > > But it's just providing "fake" information to the CRC checker, which > means that the guarantee of a ABI check is not true at all. > > So the ask for the user of "ensure that the ABI checking is correct" is > being circumvented here, and any change in the rust side can not be > detected at all. > > The kernel is a "whole", either an option works for it, or it doesn't, > and you are splitting that guarantee here by saying "modversions will > only work for a portion of the kernel, not the whole thing" which is > going to cause problems for when people expect it to actually work > properly. > > So, I'd strongly recommend fixing this for the rust code if you wish to > allow modversions to be enabled at all. > > > With regards to future directions that likely won't work for loosening = it: > > Unfortunately, the .rmeta format itself is not stable, so I wouldn't wa= nt to > > teach genksyms to open it up and split out the pieces for specific func= tions. > > Extending genksyms to parse Rust would also not solve the situation - > > layouts are allowed to differ across compiler versions or even (in rare > > cases) seemingly unrelated code changes. > > What do you mean by "layout" here? Yes, the crcs can be different > across compiler versions and seemingly unrelated code changes (genksyms > is VERY fragile) but that's ok, that's not what you are checking here. > You want to know if the rust function signature changes or not from the > last time you built the code, with the same compiler and options, that's > all you are verifying. > > > Future directions that might work for loosening it: > > * Generating crcs from debuginfo + compiler + flags > > * Adding a feature to the rust compiler to dump this information. This > > is likely to > > get pushback because Rust's current stance is that there is no abilit= y to load > > object code built against a different library. > > Why not parse the function signature like we do for C? > > > Would setting up Rust symbols so that they have a crc built out of .rme= ta be > > sufficient for you to consider this useful? If not, can you help me und= erstand > > what level of precision would be required? > > What exactly does .rmeta have to do with the function signature? That's > all you care about here. rmeta is generated per crate. CRC is computed per symbol. They have different granularity. It is weird to refuse a module for incompatibility of a symbol that it is not using at all. > thanks, > > greg k-h -- Best Regards Masahiro Yamada