Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp199239rdh; Thu, 23 Nov 2023 01:06:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFSgKBmn4TibiwmmI/XTdBLugaEKYQzD2eELWcxY7osLhkKbCbg95MTf8cKXk9Kp20Ycqr8 X-Received: by 2002:a17:903:2310:b0:1cc:4e9f:d27 with SMTP id d16-20020a170903231000b001cc4e9f0d27mr5187104plh.1.1700730376234; Thu, 23 Nov 2023 01:06:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700730376; cv=none; d=google.com; s=arc-20160816; b=jvzIH09aNYO6nBv9gTXjx1W50JGtlXMldBPq+iKuaZmNDSboYlaGlcuixmnDn6Hm+/ Ad3KowUHn7aDK2MdL4AcRfVWaToYPZ7DFtWFLxj26x0SC93hOfwkDrAfDkE6ssvHrFw0 XiurHa7VpZzeEGwjMvuXfDuVEJsukd0UWR2HjwLihSMMoJjHHNWGyqSoMSXkhv7rBYEG 4JSYt9M5H1zVeTxxntKhXHStz+xbmVz3ACTRcL1cm40wDL9yuu8fAIDAlIk5MAi81xc4 2oRUSvZgv9WBosLrI8Eyz7+kz3Qx4CS15fEz4bH35Gkt/XyXXJUzpkGhEurCokHbEvCI Jlqw== 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=OZCCAjX8qNJ9E6gcSQY5n2fAIOCsnLemSUL+dpxz3NM=; fh=gLSCYh25+6tf6lS23bFbt3c3muyZSV2UE9IIKXay2Rc=; b=DPowuLBizU+mLWzTYXkpw49DZLe+ex/Hw8gR9GZ/9K4jZKRsey/7SjOSen46lNnjaN Kl/cR+idQm1bhcsA4J9bxZVjHOYecDMc0U3qR0LVkcfue0uHVCHYf+SIzIWYFti/RgS4 sT4rrNNOXfYjUacIf7ZZfMtTTKW//5FnpzZaNy13zfefcyZpR+2ymfQJKakjqA2ibmDo HwRIFBRPYmK8uJ10vSF2EKGY3hP0YsqExIi7JP+UNmSYo56sh+QxODQMmFx5JgrpsT+J D8pQ9zs0I8OFS9OJk43x8JiSEtN7htf3PLK3hwq4LLTrR/22p5BLKr2GvW5HcviIjrU2 Ehdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gZxE875+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id m11-20020a1709026bcb00b001c9ad94f614si737411plt.244.2023.11.23.01.06.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 01:06:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gZxE875+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 171DA8079ADB; Thu, 23 Nov 2023 01:06:08 -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 S230346AbjKWJFw (ORCPT + 99 others); Thu, 23 Nov 2023 04:05:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbjKWJFt (ORCPT ); Thu, 23 Nov 2023 04:05:49 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34FA8101 for ; Thu, 23 Nov 2023 01:05:56 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C291C433C8; Thu, 23 Nov 2023 09:05:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1700730355; bh=Lcd150vAerjkaRvtY0bS83Rte9WRMhTnKhCGePr/mKY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gZxE875+pb5Kx5SdnUy+1qJggwnPSULnHJZNmnyyWU1tZnEKd6+k+CLcxMCdL2SZI dNU/1oTl+LESlR5MxF2sNxJ8zA+4gVVwUx3CVe6jBu7kI5fW4yMj35sj4acE7tqxMN KaG2fJSM6oZZxOlC9JU9HsL7YAfrbLxHWJYBYuJ4= Date: Thu, 23 Nov 2023 09:05:52 +0000 From: Greg KH To: Matthew Maurer Cc: Masahiro Yamada , 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 Subject: Re: [PATCH v2 0/5] MODVERSIONS + RUST Redux Message-ID: <2023112314-tubby-eligibly-007a@gregkh> References: <20231118025748.2778044-1-mmaurer@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,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 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 01:06:08 -0800 (PST) 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 MODVERSIONS > checking. The check would effectively be a no-op for now, as you have correctly > 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 want to > teach genksyms to open it up and split out the pieces for specific functions. > 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 ability 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 .rmeta be > sufficient for you to consider this useful? If not, can you help me understand > 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. thanks, greg k-h