Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1182727rwb; Thu, 19 Jan 2023 07:34:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXufNX0HEUtqNx25t7dmL7tSI+jMq+DoSCIEUHzlIQ+RNqfTzUAg2+ZU6Vw5njvv+Ml7u04P X-Received: by 2002:a17:90b:918:b0:229:7728:6d65 with SMTP id bo24-20020a17090b091800b0022977286d65mr12835076pjb.34.1674142442465; Thu, 19 Jan 2023 07:34:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674142442; cv=pass; d=google.com; s=arc-20160816; b=m2prrLCOXNoMOrzMW9e2uPm3FEJuB11EcsLRRpUSeV3TfYONvoZPJeKgbVHNLm9Ykh V3mkfgzwksBeLw27B01kq/ODHXeL1gwNOQvqJj64ntvTlX6fjzOfhoNke2hUA41psHjv NO18LsZv02u2cYHZxPekKtQjtW6yN8vYjYEJh0xODuwAlEOYicOoA8jgO80yJkI0S1/J wSscljvkE/GnuQlNi09sy2Zsh1Xj6YErU3pqP3U3GthXItCuYtZsxrvP5LsIqoIXMQZP RXFy1s6tN3cQBvewYwUeRbvnKl6Ua+7HvZoDKpKTufKMJU9eX1f4w6Kk3H7zT3mT7BKI ZC6A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=3VOX2/R4y8I8BSBGEGaJUDozJAEVirCrmPNZL89BRJ4=; b=QQx9Yk0CT/cKiPT6x5p1TB9MrVRKxHxzyoiVwXL1ipvrRb7/30qO9PZRzPShKAIOzg HQUpq33KxzrcqOzuJIl+BqdcS8k5pntjmBgo4oDrGb9jgaV9IUhPDlZP+n8nQOtukSq0 oo1FguSIJO3hPObQ9xHCF1L8Wfu0KF0I4Z6A5vy+/CQ6+jKTyyEupQGDLROTen4zkwOp 0oLW4dwVTfuQ4Bw+C9M8sJM9X0Hi64FMNizkWnHrttJQ8H9AgG6pLR4GM47OP3iiO14S DTBBUhyuN27UUsaJeq7wtdvfyUXgMxNwXPqASTDxYcb4TfFxesc96c0/aMuiaFW57gdC E25Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@garyguo.net header.s=selector1 header.b=o+CX5sP+; arc=pass (i=1 spf=pass spfdomain=garyguo.net dkim=pass dkdomain=garyguo.net dmarc=pass fromdomain=garyguo.net); 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h3-20020a17090ac38300b0022939a02263si5153881pjt.45.2023.01.19.07.33.55; Thu, 19 Jan 2023 07:34:02 -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=@garyguo.net header.s=selector1 header.b=o+CX5sP+; arc=pass (i=1 spf=pass spfdomain=garyguo.net dkim=pass dkdomain=garyguo.net dmarc=pass fromdomain=garyguo.net); 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230108AbjASPJs (ORCPT + 47 others); Thu, 19 Jan 2023 10:09:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230188AbjASPJq (ORCPT ); Thu, 19 Jan 2023 10:09:46 -0500 Received: from GBR01-LO2-obe.outbound.protection.outlook.com (mail-lo2gbr01on2123.outbound.protection.outlook.com [40.107.10.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B99D69239; Thu, 19 Jan 2023 07:09:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IUGwiuhL7/ESn/i/WUDFkpMbBWIjTQ/XFHZWam/2VkgjpEw1OXo5XuM7jos1J+apU9r4gsbGlgLFxMV6qOdWhQny1WZpYwf72AkjnjMsCAAybqsVyR+g1k5wZzPz58Qoe1gZiMjs0sQcOUNh9M4ekZOctu1R3riohWHFEVbwtWiyJJb5vuSjVVq7t3A4AZnZ62HbetIiOAK8t+ARQlCkrZbNEzwQZRAg0SNaviXtZNBJNDpy0YiqhyQSRB9r/JSO7nL4q2vyktDCDkrv/bBoXP+nbvmiXlg4xiThqgXtA8qhy11xArvKrByF16sO3r7MC57xOgMFzQFMUOK6gun8Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3VOX2/R4y8I8BSBGEGaJUDozJAEVirCrmPNZL89BRJ4=; b=Vs2d4Uc4aPJ637BiSTNhbDXFLA4xgo7YcOql6OZxRCemVWYtFh4ou78TjwlSdVtMwyQt4VB4dzfSmNvrBQmmeU2gWWCb9j8mIk7lWk5cUKv/R28fjXHsKvWslLbacTNJ8lAuqO/cMHdo3b4g7NE5B0+s+O/KUdQMAzBe/RQkU1PQtv335SxkpIVXitZPUfKIdcV+FmMDBiGRqkGn8dt53PFZysXkXsyyQmjaHzAwlxtf4VVq5GC4Xy91CYPtxUvWf8gwUMXLoLxhtSnvl96ThO2i97uvC94ti7LlniaoXw7KvebPnnpaXn5mU6fB2WjkKsLigDyePYu+p0Tjwr0www== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=garyguo.net; dmarc=pass action=none header.from=garyguo.net; dkim=pass header.d=garyguo.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garyguo.net; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3VOX2/R4y8I8BSBGEGaJUDozJAEVirCrmPNZL89BRJ4=; b=o+CX5sP+prnN/TQP5nd0xdAMRDswTGI0eGYhJdLLbjM9qx75TQXe4iLTq83UVDZoInxisegVpV9h5QzJJaMkaSyUXUFNpyqhUaI1c8zUV7upVFrWH4CmBjZbWx/x/hZVSgo2aeGOu+LvXUnjhnuHKY8rLjlGED45HCYwrVgernc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=garyguo.net; Received: from LO2P265MB5183.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:253::10) by LO0P265MB6947.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ec::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13; Thu, 19 Jan 2023 15:09:39 +0000 Received: from LO2P265MB5183.GBRP265.PROD.OUTLOOK.COM ([fe80::2f24:8099:5588:8ba8]) by LO2P265MB5183.GBRP265.PROD.OUTLOOK.COM ([fe80::2f24:8099:5588:8ba8%8]) with mapi id 15.20.6002.025; Thu, 19 Jan 2023 15:09:39 +0000 Date: Thu, 19 Jan 2023 15:09:36 +0000 From: Gary Guo To: Lucas De Marchi Cc: Michal =?UTF-8?B?U3VjaMOhbmVr?= , Kees Cook , "Masahiro Yamada" , , "Wedson Almeida Filho" , Joel Stanley , Alex Gaynor , Miguel Ojeda , "Wedson Almeida Filho" , Nicolas Schier , , Guo Zhengkui , "Boqun Feng" , Nicholas Piggin , =?UTF-8?B?QmrDtnJu?= Roy Baron , Nathan Chancellor , Nick Desaulniers , , Julia Lawall , "Luis Chamberlain" , , Subject: Re: [PATCH] modpost: support arbitrary symbol length in modversion Message-ID: <20230119150936.30811312.gary@garyguo.net> In-Reply-To: <20230117192059.z5v5lfc2bzxk4ad2@ldmartin-desk2.lan> 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> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: LO4P123CA0333.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18c::14) To LO2P265MB5183.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:253::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LO2P265MB5183:EE_|LO0P265MB6947:EE_ X-MS-Office365-Filtering-Correlation-Id: 64797cba-7dbb-4055-ae9e-08dafa2f2f40 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jiGj5b4+B+Wfii/chtfcoxAa+EZ5dHOz/Jn7tqqLsaUnYJXiiQBa1CowwanfOjt7XI7QmkYFUHYOtIFNEDRVYLvqkmE7CUONuxCl+cEkBkZ0GDbXzi4cMl7UAeiPJUDIqnq+L8lYWYyRWJO1BQ8a/vPdNToER/OUb7+2UoDhjg/P2yFXoshZwM37VVkOHDrpp5Kh1iHDULkVf1jmP2ay3GhcN+HqdkYEtU971ktE0OFNwL2SVereEsmqaOdw3VsrCL5CJyJmBEmhYo8pZ07g4WwOoU5nAgyYCKHWDUSb2cwIUzHYAV7XhCsylEk5MAbb3NvE6GQCRDP4mg/vKBH1jrBs33IGwKSQGoOtaIkbc1nyCTpHwYgoYVTPr9kW56qB/3LnLFz2EP1VEz5zhjCTuxhYvurTUj2U7vewz+17AKCVDsm7VAk8JVgS9FMO1RV3Xlf3Lb3P3wOhQZz+5D1E3bVs02GhkNB1hxhZjnPCUtuX6l8s7dU5v+iFS6zGu55RFRz1426pvlrGB4X8PkMDsskaLTy4Nudx67DHrEBHSH2utM/xFhDx1nUkUkMmGtMR7jInGizJ+BA20O7CvgduBwu9+jb93rgrpB4cEW8cHiXd9kRkGf5YJyV/COXGqMGkfnXm+QAl7onULBdzdW3J0w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LO2P265MB5183.GBRP265.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230022)(376002)(366004)(396003)(346002)(136003)(39830400003)(451199015)(6486002)(26005)(66556008)(478600001)(41300700001)(6512007)(66574015)(1076003)(186003)(86362001)(316002)(54906003)(2616005)(38100700002)(66946007)(66476007)(6506007)(36756003)(6666004)(2906002)(5660300002)(7416002)(4326008)(6916009)(83380400001)(8936002)(8676002)(66899015);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NWo5d1A0Mk1xMkZtWlpXVEU4NnY2dDlZL2pDcEU4Z1BnRTJBVnp6UXdnRWMz?= =?utf-8?B?S0IyRllqMzlzQlk5WUNwQmtYUklKQktNYnR0THlIQTh3VWd5Tlp0dmVmZENR?= =?utf-8?B?V1dyVG5CL3h6c3JwWFhRbElLeVB4YldNVzAzS3dKd2lESmRZVmZZdUxxMlBs?= =?utf-8?B?bURXMU9pSHh6T0dNTmhrTmtkZUxRL2lRNXFhN2k5ck05Q0RCVkRESVZWRTlo?= =?utf-8?B?czE2dy95emtBZHd5U0N6T01VS0V2MGZvazhvTUsvc0wycEJxQ0NFM1pFMlJh?= =?utf-8?B?cjRwRzNZT0JWM2ZYSnQ4TDhkczRUazNjenhaRUNOWlNYTzdPUEx1cnlQM3Er?= =?utf-8?B?bGwwK0hKVU9xcGFvOVFJQkhFNkQ1VWlyOTZHMFBEeU0zY1M4ZUlG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Message-Id: 64797cba-7dbb-4055-ae9e-08dafa2f2f40 X-MS-Exchange-CrossTenant-AuthSource: LO2P265MB5183.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 15:09:39.1239 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bbc898ad-b10f-4e10-8552-d9377b823d45 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: IIXzNLvZr7FsHnmF5247Yhn45RpY4VtkAdSpbW/NXgn5t4VgbLE93lGjsIPdYlVlzRP+SRcGgLXsJcBYkKXt/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO0P265MB6947 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 Tue, 17 Jan 2023 11:22:45 -0800 Lucas De Marchi wrote: > On Tue, Jan 17, 2023 at 06:51:44PM +0100, Michal Such=C3=A1nek wrote: > >Hello, > > > >On Fri, Jan 13, 2023 at 06:18:41PM +0000, Gary Guo wrote: =20 > >> On Thu, 12 Jan 2023 14:40:59 -0700 > >> Lucas De Marchi wrote: > >> =20 > >> > On Wed, Jan 11, 2023 at 04:11:51PM +0000, Gary Guo wrote: =20 > >> > > > >> > > 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]; =20 > >> > > >> > although not really exported as uapi, this will break userspace as t= his is > >> > used in the elf file generated for the modules. I think > >> > this change must be made in a backward compatible way and kmod updat= ed > >> > 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 3= 2 > >> > and 64 bit module, and vice versa. > >> > =20 > >> > >> 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 deco= de > >> symbols longer than "64 - sizeof(long)" bytes. So the list it retrieve= s > >> 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; =20 > > > >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. =20 >=20 > that could be it indeed. My main worry here is: >=20 > "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. >=20 > 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. (sorry forget to reply-all, re-send email to the list) Best, Gary