Received: by 2002:ac8:1418:0:b0:3ab:920c:4c8b with SMTP id k24csp436228qtj; Thu, 19 Jan 2023 08:08:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXu4hYnevGKXksE9RYFZk2CM7bJ+q5GTb4K7bOBquRNMV0uTz8yk9KY2hyU96evnX56Qh+oP X-Received: by 2002:a05:6a00:44cc:b0:58a:fdc8:92bf with SMTP id cv12-20020a056a0044cc00b0058afdc892bfmr11720162pfb.2.1674144511353; Thu, 19 Jan 2023 08:08:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674144511; cv=none; d=google.com; s=arc-20160816; b=v+7Nw+f+aD/A32DVeayIdtrCPX1pBMwkw18M1cS/wF5cePuaVhVpGTt+zsdYsyv3F8 YCSOQ2JSjN9OPLkh/qw7mTi2CnlFotAQ6chVEe3hFrcr6ZVYsuRJojFYOpbrIyN2ZeYQ uqudkY+O3Xpj7D9byxRHdvleZQMbsBHYzZpLlXcDdXyhllk8/CRCpe8/y/dxWNMicccX vf6JXsILXx+N5XSFh4BuFZa2hqQeFrflXuzA03oGwUdztJPr81ZVenLrWy26dQgxhgK/ 7Y8mjQsd41ck0aQNApQOpaPDladd7ts5X+bGP8CrLNRFN4AXhkeL1ou5VtnJ3aVLYXlO MDHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=blyh4F6YIPd83bc9ZsTz1gC1AOEbrks+HSyE4iFGx9k=; b=t57N/7HJYIEvxCgDn5y8NrObi6PJ76oPzlXAttMU8FgPzGUjqqyQm8F6lni/d+LzGg cmCu4Mt7Atr5Jm7kCoYrd8qER5VuYmAFVpKjgofrDREJjTIPBOCTG9lqeFo2JGVlWgmm 30z60Mmof+qtq8PPrq8lb8balIZOpzQCTh5nZ73eegRa7SLaluFnbX1JX64aadT/JXA8 hS8dI5izQq75L27Krag5p2hc9F6Y/pjioa5CKBP5vchwlXGYpWU80C1Zf034EHEq1Nwa XLXKZ5bW72j0jSUw6YByQ2J/tpgFDVSP4E4XD+OjG3ySWxC2upGFwsm4XCoEvBBcGf+P 3+4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=MP2LDF3y; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=BwEy8wu9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y19-20020aa79af3000000b0058b89eb32c7si25008160pfp.122.2023.01.19.08.08.25; Thu, 19 Jan 2023 08:08:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=MP2LDF3y; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=BwEy8wu9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230379AbjASPTL (ORCPT + 45 others); Thu, 19 Jan 2023 10:19:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229958AbjASPTD (ORCPT ); Thu, 19 Jan 2023 10:19:03 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B69228102C; Thu, 19 Jan 2023 07:19:01 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 159C13FBA6; Thu, 19 Jan 2023 15:19:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1674141540; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=blyh4F6YIPd83bc9ZsTz1gC1AOEbrks+HSyE4iFGx9k=; b=MP2LDF3yx8TEIh3fADMhFa+a/auaOINU/0J1rlhw3mzqPqwt3QK6fI7Ucmcs3y9B/UJKXB eMp5Z7mxxODX6k2cUmcH/sxC3RMT7trXy2YVADUDk7T1eBXqjhB2y6F48r9HWG7FuG8sHZ Edlma/sE8KtTqSuBov5qRz/dpMR53RM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1674141540; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=blyh4F6YIPd83bc9ZsTz1gC1AOEbrks+HSyE4iFGx9k=; b=BwEy8wu90TO0wfPnVi88AKZO2d3X2n2DpfGeZufKFrGknIf0EVn8zMTjxhFHsxeLLbabqj Q0//Yl8rqHyrGCAA== Received: from kitsune.suse.cz (kitsune.suse.cz [10.100.12.127]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id CD2442C141; Thu, 19 Jan 2023 15:18:58 +0000 (UTC) Date: Thu, 19 Jan 2023 16:18:57 +0100 From: Michal =?iso-8859-1?Q?Such=E1nek?= To: Gary Guo Cc: Lucas De Marchi , Kees Cook , Masahiro Yamada , linux-kbuild@vger.kernel.org, Wedson Almeida Filho , Joel Stanley , Alex Gaynor , Miguel Ojeda , Wedson Almeida Filho , Nicolas Schier , rust-for-linux@vger.kernel.org, Guo Zhengkui , Boqun Feng , Nicholas Piggin , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Nathan Chancellor , Nick Desaulniers , linux-kernel@vger.kernel.org, Julia Lawall , Luis Chamberlain , linuxppc-dev@lists.ozlabs.org, linux-modules@vger.kernel.org Subject: Re: [PATCH] modpost: support arbitrary symbol length in modversion Message-ID: <20230119151857.GQ16547@kitsune.suse.cz> References: <20230111161155.1349375-1-gary@garyguo.net> <20230112214059.o4vq474c47edjup6@ldmartin-desk2> <20230113181841.4d378a24.gary@garyguo.net> <20230117175144.GI16547@kitsune.suse.cz> <20230117192059.z5v5lfc2bzxk4ad2@ldmartin-desk2.lan> <20230119150936.30811312.gary@garyguo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230119150936.30811312.gary@garyguo.net> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 19, 2023 at 03:09:36PM +0000, Gary Guo wrote: > On Tue, 17 Jan 2023 11:22:45 -0800 > Lucas De Marchi wrote: > > > On Tue, Jan 17, 2023 at 06:51:44PM +0100, Michal Such?nek wrote: > > >Hello, > > > > > >On Fri, Jan 13, 2023 at 06:18:41PM +0000, Gary Guo wrote: > > >> On Thu, 12 Jan 2023 14:40:59 -0700 > > >> Lucas De Marchi wrote: > > >> > > >> > On Wed, Jan 11, 2023 at 04:11:51PM +0000, Gary Guo wrote: > > >> > > > > >> > > struct modversion_info { > > >> > >- unsigned long crc; > > >> > >- char name[MODULE_NAME_LEN]; > > >> > >+ /* Offset of the next modversion entry in relation to this one. */ > > >> > >+ u32 next; > > >> > >+ u32 crc; > > >> > >+ char name[0]; > > >> > > > >> > although not really exported as uapi, this will break userspace as this is > > >> > used in the elf file generated for the modules. I think > > >> > this change must be made in a backward compatible way and kmod updated > > >> > to deal with the variable name length: > > >> > > > >> > kmod $ git grep "\[64" > > >> > libkmod/libkmod-elf.c: char name[64 - sizeof(uint32_t)]; > > >> > libkmod/libkmod-elf.c: char name[64 - sizeof(uint64_t)]; > > >> > > > >> > in kmod we have both 32 and 64 because a 64-bit kmod can read both 32 > > >> > and 64 bit module, and vice versa. > > >> > > > >> > > >> Hi Lucas, > > >> > > >> Thanks for the information. > > >> > > >> The change can't be "truly" backward compatible, in a sense that > > >> regardless of the new format we choose, kmod would not be able to decode > > >> symbols longer than "64 - sizeof(long)" bytes. So the list it retrieves > > >> is going to be incomplete, isn't it? > > >> > > >> What kind of backward compatibility should be expected? It could be: > > >> * short symbols can still be found by old versions of kmod, but not > > >> long symbols; > > > > > >That sounds good. Not everyone is using rust, and with this option > > >people who do will need to upgrade tooling, and people who don't care > > >don't need to do anything. > > > > that could be it indeed. My main worry here is: > > > > "After the support is added in kmod, kmod needs to be able to output the > > correct information regardless if the module is from before/after the > > change in the kernel and also without relying on kernel version." > > Just changing the struct modversion_info doesn't make that possible. > > > > Maybe adding the long symbols in another section? > > Yeah, that's what I imagined how it could be implemented when I said > "short symbols can still be found by old versions of kmod, but not long > symbols". > > > Or ble just increase to 512 and add the size to a > > "__versions_hdr" section. If we then output a max size per module, > > this would offset a little bit the additional size gained for the > > modules using rust. > > That format isn't really elegant IMO. And symbol length can vary a lot, > having all symbols dictated by the longest symbol doesn't sound a good > approach. > > > And the additional 0's should compress well > > so I'm not sure the additional size is that much relevant here. > > I am not sure why compression is mentioned here. I don't think section > in .ko files are compressed. There is the option to compress the whole .ko files, and it's commonly used. Thanks Michal