Received: by 2002:a05:7412:e79e:b0:f3:1519:9f41 with SMTP id o30csp193005rdd; Wed, 22 Nov 2023 13:04:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IH5iGLYXj5Id2wmNC0zV8PxrUFVFS5MCFNkXlefkM82Fs8HSZouxbQKSEvnILZwUeeFy0kF X-Received: by 2002:a17:902:64c8:b0:1cf:54e1:8c8c with SMTP id y8-20020a17090264c800b001cf54e18c8cmr3636759pli.63.1700687079826; Wed, 22 Nov 2023 13:04:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700687079; cv=none; d=google.com; s=arc-20160816; b=HRvyAspM9zfRZhBswEcs368tBr/sPIyW0XAleJlC2Enn4t6tayaxWmV4p/aDUZvuWc uax0NWXVg7unMNpKoC7QFwFt6YMy/kV9Rgn5q2azToAk9kryrEqXuRjdh4ez/YPD7NJi FI5pPujPstmNjpqAqhEwWo9ZlsPuwsMvp2D9R/WZaK5IJikkzcJBAJHtWY/G0perPsAN epxs+lueUvI2kjK/7dCpj35TA5XAUlPYs40qx7vo/f1co90nQSG4MbZkBuepJrMpZlnP BofLbClpQyo7rb7lTsfRWsPrfh5OdaX7CeZReMs0V3Ndlg7H2fPP8Mj5rOYD7rCvpW0j twbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=mINXLXrq9/oLpdA6Yk/sy1UPcvyskcwNgTwzkZ9kBzs=; fh=hsecGrkJBnsiTpXfqxRvp3X3DzKHRBn/HPS/jXhIG+k=; b=PEypMxbj656WbunO2Ni4R90gWMyIBJiatF+Y0qBhw2AbRj8GqR2XAMYoGPr6jt74ug sZRlE3sPaW8T1RNrNWx3fQGRVmhc7MrN7ZJl9dndn4GhT61UUL4ETp5AX/npH9lpBKWK LwL7NAXTjHKfHZaSg0OC7fvB+pTDEBzkWhOsNBjOktfKOqEhj/zqnU06Wqobke+r4lyT dUA8EapUskdisHJ2iv5DESRqAs9CPJoSJ+hM8VtI1VS79UdfpuGABeu4s6mD7aKUkRDe 6lkg499oJML5vpcbs1SYrqFqGej1pFHSQv7M7HJt3bQWSq+SyRINCMYHQeoeAFa1MuTi 4mtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=J+TAF2Qv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id x3-20020a170902ec8300b001ce64a095c2si230719plg.361.2023.11.22.13.04.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 13:04:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=J+TAF2Qv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 84FA3815CDA3; Wed, 22 Nov 2023 13:04:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232185AbjKVVE1 (ORCPT + 99 others); Wed, 22 Nov 2023 16:04:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230377AbjKVVE0 (ORCPT ); Wed, 22 Nov 2023 16:04:26 -0500 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA15898 for ; Wed, 22 Nov 2023 13:04:22 -0800 (PST) Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-548db776f6cso510a12.1 for ; Wed, 22 Nov 2023 13:04:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1700687061; x=1701291861; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=mINXLXrq9/oLpdA6Yk/sy1UPcvyskcwNgTwzkZ9kBzs=; b=J+TAF2QvDW3tT3S/KbM5WIA5UU9ZgLW5iQGHLxF4J5F1x6f754B9ezoqHNp/Fly6/n 6hGqdg+URMLDZMEaL6u3ogItVvNfbxQIrF4diW/kUN9+n5xBBBQ9ru9n3K5PVL6xtGwa OkyvjSNxvG9AcrcADjJrS7gZK52BJz2aDG3hnBz0f6dafGIVIipgOSbkqJTID015QBzM 1YPQKEAhqYl4F0OaBukGlGjeUArlneb0HAJLKBNUNnLjtpMxeMRnj7S3A6O7Lx7ZiUcl Gux2U7WCJjhEdv5etZDzgmBFL2BdfuEkshalGei3QH+R5WCPiWbL5VfqOhifYuJJxbs+ 9Aeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700687061; x=1701291861; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mINXLXrq9/oLpdA6Yk/sy1UPcvyskcwNgTwzkZ9kBzs=; b=WfIW8iR4U0h5RXML3R8VTOrWNqIMp/aVemNf9nCNVTw7+TIya4ZMN82vreudlJECmO sVU8M9kRoWvi4Yooez4dy+gHv5iR7JRRWf52wuTjegOGYHUrrkWmlrlXMzLnbr/AO6PY slF7mz6n9WeYntlnEioQ9pmlSPiW5nPKwZQKg3PoH21mKdI9VO0c+ow/uQT5+poi5M43 fiRNzODZUQIrB+R6kgzaq7aMUfHVloC4KdhkudTpSJkSv2r/WHt1BkFyN5zRNeIw8uwl vsDGni+rFHMsJDO/Kl00LRnOieP2wWhn7Uasu3LLwkofQO0NKM74gYSZW1j/Av4EFVp0 bEPw== X-Gm-Message-State: AOJu0YxEy/QHAEP6ciqLkYsYYIiXVRdzN9XGk0TPhXh7Il7b/rXlUFun 3NVWsjelV4zJm95ZD+c4SnjikOik3Rdpt5x00HPSKQ== X-Received: by 2002:a05:6402:d67:b0:548:c1b1:96b2 with SMTP id ec39-20020a0564020d6700b00548c1b196b2mr225540edb.6.1700687061263; Wed, 22 Nov 2023 13:04:21 -0800 (PST) MIME-Version: 1.0 References: <20231118025748.2778044-1-mmaurer@google.com> In-Reply-To: From: Matthew Maurer Date: Wed, 22 Nov 2023 13:04:09 -0800 Message-ID: Subject: Re: [PATCH v2 0/5] MODVERSIONS + RUST Redux To: Masahiro Yamada Cc: 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" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Wed, 22 Nov 2023 13:04:37 -0800 (PST) > 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. If we want to err on the other side (modversions passes, so we're pretty sure it will work), I could add to the last patch support for using .rmeta files as the CRC source for Rust symbols. This would essentially say that the interface for the entire compilation unit has to stay the same rather than just that one function. We could potentially loosen this requirement in the future. 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. 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. 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?