Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5539503ybi; Tue, 30 Jul 2019 23:00:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyR7IeFH7dT+RQ4dRCu7ux9GeSGRZRZwY3vJQXmKdawKrgFwfyP5/BIz2R3v3pfCFyPiODE X-Received: by 2002:a63:5a0a:: with SMTP id o10mr39639782pgb.282.1564552843362; Tue, 30 Jul 2019 23:00:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564552843; cv=none; d=google.com; s=arc-20160816; b=inAG71JVIbrGO7AnXTYCoDsanCCYSbFFCuu3lx4IYqRoLW6ctitfq612feEZDxs7tH 7NAEGYnZ8LVTttX7aPeYLT4iSKqLMzZpULdUL8DZPHb7aJ4av0Y/E1b7VBtCOA2OLIcc c6NkziUOXbfTLQxJNRIa+xNZET/qHahz5Jn/tmEbbOPMDxOaxRAOD9MCVlJCoEvRP/l2 CCv8917YVAvV8fLjGLsWs17L/KznvW8X4XJJag9Z/7CgG+MjHbpHon6McqNf9gxmfD1F gcUy8apDpOIIXM4Ynp8leHGEbdx9HQMySWfLqAYX7CEaQ4WH8Y9j3/tCh43sFfiF2oep ag3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=pb22LnSUq/I5TuyMMV/ed22byQ1Vd9m60c55OfeuMhI=; b=VN4rsTxQxhm3kG852UPiUvpfeOIol5Nb7rZ8lHaYhuuhYCpiPSQIAQgQZfy9hcYg1S kl8LcXjaqPEUmSNNcy2zs5Cyjau2E1Ln5fUqoWOiFcFwa06ZSkSvNfQ3ha7BqI3hpzpB o9GjYmBqUI0Uau4vSwXuWdLTHBp0cNaIaSWSn/VPzAHFKkfogpl36kEuVwKEIlR4GryX 0jKqaLP9hqdtFD1FLR2c52FVyYtppL0qsI36A3n1ZWCs3RZyzRbcEEnz+T09fmZ1OAig 4HqBaR9oIPzEaQ2KfEZoMh6a6MCLz66r8ox070ngtCCNzTWe3Uq7OPvvRB1godOnTqww kTTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=E+l61C0K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o61si33701368pld.392.2019.07.30.23.00.27; Tue, 30 Jul 2019 23:00:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=E+l61C0K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726822AbfGaF7U (ORCPT + 99 others); Wed, 31 Jul 2019 01:59:20 -0400 Received: from conssluserg-01.nifty.com ([210.131.2.80]:37145 "EHLO conssluserg-01.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725935AbfGaF7T (ORCPT ); Wed, 31 Jul 2019 01:59:19 -0400 X-Greylist: delayed 11287 seconds by postgrey-1.27 at vger.kernel.org; Wed, 31 Jul 2019 01:59:17 EDT Received: from mail-ua1-f41.google.com (mail-ua1-f41.google.com [209.85.222.41]) (authenticated) by conssluserg-01.nifty.com with ESMTP id x6V5x46Z020578; Wed, 31 Jul 2019 14:59:07 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com x6V5x46Z020578 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1564552747; bh=pb22LnSUq/I5TuyMMV/ed22byQ1Vd9m60c55OfeuMhI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=E+l61C0K8NMre7x8Ip9zckBBpPk4LsH/enunjZIfdV1+ykHT3zfDPAmQn3a1B3PRh zFboEnr4Xgt/jMyhawQUOQqTpltUAbV4Q8FXzV6f+YE0+lqIrFze1+weknyaneA2hC r97Yxqu+AvkD5zsiSv9LEkkWgGy3JBXPO0q84NeW+OBoO4DaZM/A8kqoBwCY/7n20T 55VjFeR7oDTesi6qJhAXv32mPpgSzremGe0tfEJ9svL7YxC8arDLzfGTsRPfue26hy 2wOvMAlxtKM4v2p13bxzNZ5dxDGc+4LFe8CKzbI61kM+omKfrJt8pyNGXgFVA4PBms jXFn1aqG4YCrA== X-Nifty-SrcIP: [209.85.222.41] Received: by mail-ua1-f41.google.com with SMTP id 34so26500080uar.8; Tue, 30 Jul 2019 22:59:06 -0700 (PDT) X-Gm-Message-State: APjAAAW7XurefAVn10eb0lliGeWdXoCGO4CE/l2m1t0QTOPqQe5uLstu vCl53Mwc5f27h0bdpJ97AUMLCJ3QC9dS2hAw4oQ= X-Received: by 2002:ab0:70d9:: with SMTP id r25mr47885061ual.109.1564552743799; Tue, 30 Jul 2019 22:59:03 -0700 (PDT) MIME-Version: 1.0 References: <20190509143859.9050-1-joe.lawrence@redhat.com> <20190509143859.9050-7-joe.lawrence@redhat.com> In-Reply-To: <20190509143859.9050-7-joe.lawrence@redhat.com> From: Masahiro Yamada Date: Wed, 31 Jul 2019 14:58:27 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 06/10] modpost: Add modinfo flag to livepatch modules To: Joe Lawrence Cc: Linux Kernel Mailing List , live-patching@vger.kernel.org, Linux Kbuild mailing list Content-Type: multipart/mixed; boundary="00000000000086ed9a058ef3d24e" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --00000000000086ed9a058ef3d24e Content-Type: text/plain; charset="UTF-8" Hi Joe, On Thu, May 9, 2019 at 11:39 PM Joe Lawrence wrote: > > From: Miroslav Benes > > Currently, livepatch infrastructure in the kernel relies on > MODULE_INFO(livepatch, "Y") statement in a livepatch module. Then the > kernel module loader knows a module is indeed livepatch module and can > behave accordingly. > > klp-convert, on the other hand relies on LIVEPATCH_* statement in the > module's Makefile for exactly the same reason. > > Remove dependency on modinfo and generate MODULE_INFO flag > automatically in modpost when LIVEPATCH_* is defined in the module's > Makefile. Generate a list of all built livepatch modules based on > the .livepatch file and store it in (MODVERDIR)/livepatchmods. Give > this list as an argument for modpost which will use it to identify > livepatch modules. > > As MODULE_INFO is no longer needed, remove it. I do not understand this patch. This makes the implementation so complicated. I think MODULE_INFO(livepatch, "Y") is cleaner than LIVEPATCH_* in Makefile. How about this approach? [1] Make modpost generate the list of livepatch modules. (livepatch-modules) [2] Generate Symbols.list in scripts/Makefile.modpost (vmlinux + modules excluding livepatch-modules) [3] Run klp-convert for modules in livepatch-modules. If you do this, you can remove most of the build system hacks can't you? I attached an example implementation for [1]. Please check whether this works. Thanks. -- Best Regards Masahiro Yamada --00000000000086ed9a058ef3d24e Content-Type: text/x-patch; charset="US-ASCII"; name="0001-livepatch-make-modpost-generate-the-list-of-livepatc.patch" Content-Disposition: attachment; filename="0001-livepatch-make-modpost-generate-the-list-of-livepatc.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jyqu4zy00 RnJvbSA4NTU3MTQzMGFhMTJjZDE5YTc1Y2JjODU2ZGExMDkyMTk5ODc2ZTZhIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBNYXNhaGlybyBZYW1hZGEgPHlhbWFkYS5tYXNhaGlyb0Bzb2Np b25leHQuY29tPgpEYXRlOiBXZWQsIDMxIEp1bCAyMDE5IDE0OjUxOjI5ICswOTAwClN1YmplY3Q6 IFtQQVRDSF0gbGl2ZXBhdGNoOiBtYWtlIG1vZHBvc3QgZ2VuZXJhdGUgdGhlIGxp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