Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp225975yba; Fri, 12 Apr 2019 02:15:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGFYppWurmBqIHKDZrbTbYK1D3me1xetuG46KPHdPkazIpylCTd+ceOR6UrdXSfjstkyyB X-Received: by 2002:a62:174c:: with SMTP id 73mr55556265pfx.33.1555060538521; Fri, 12 Apr 2019 02:15:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555060538; cv=none; d=google.com; s=arc-20160816; b=leG6ysgQHRYiwToM1vnwAiUZJStWu1+BNjQwPjHHAS8sArt8tR2g4kGH5IkE64pj4p Z2wDxSFyHZMmUjEqSmLDaCRcvpSsKJ96cliRsYzB4J5IPtoXfFuijO1tbvWjvtXNmQnJ BQ65o60hECR3UTEjp0bk09mk9Od+ruswf47ahVaVoHBGaFav78bnSiZoR3i5fHMQmUbm qVpqoE/tqVMz/Baw1Lbd3gUvQauzAXLb421NvcMYlc1QxQzoR2rzEPnT1CCow28OJ5tJ XhNnl+tk/VVsNw3oyBtPSGufUyWTI0q34lHpocxOpUlyVWzp6LMi6SSmFlQmgrtyEPqi GSow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=6zLX8U85m78OOb5h8+IOgQ9tUbSoJYbntsWpQl18q7s=; b=PsVqiV0iP42VNWnwoHJb3zymCuALHWhvOExYzFjLbav5f4xtylrciiBQMf0RaPliCY p8AR2MTxMylQNYObfhSJWRziy5d80UVFfTSi/q/1NV6f/SrcZg5iP8G8sbiKWK8SyzjK /e/YSQP5QmCB5N+siBRcH7b5Rze1E6l1vhVSvWVHGP2oQwJQ2mwc1wVG8TF5mFbA3Yj5 75co7qpaNLQg5i9m0it0NvzlaDnEBbhVoRfZLt4RDT/UrQkZO0vrG8JxivNOFHnF0bGG 10CwlkicpAlL3J54jQhfmuuvOANStkd7SC2/aOSmbHIakqRHFYbfG3Vot6JflxKVhMHB GCBQ== ARC-Authentication-Results: i=1; mx.google.com; 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 a190si17835824pge.88.2019.04.12.02.15.20; Fri, 12 Apr 2019 02:15:38 -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; 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 S1727313AbfDLJOb (ORCPT + 99 others); Fri, 12 Apr 2019 05:14:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:48774 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725973AbfDLJOb (ORCPT ); Fri, 12 Apr 2019 05:14:31 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A6E44AE31; Fri, 12 Apr 2019 09:14:29 +0000 (UTC) Date: Fri, 12 Apr 2019 11:14:28 +0200 (CEST) From: Miroslav Benes To: Joe Lawrence cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, linux-kbuild@vger.kernel.org, Jessica Yu , Jiri Kosina , Joao Moreira , Josh Poimboeuf , Konstantin Khlebnikov , Masahiro Yamada , Michael Matz , Nicolai Stange , Petr Mladek Subject: Re: [PATCH v3 4/9] livepatch: Add klp-convert annotation helpers In-Reply-To: <20190410181837.GA13083@redhat.com> Message-ID: References: <20190410155058.9437-1-joe.lawrence@redhat.com> <20190410155058.9437-5-joe.lawrence@redhat.com> <20190410181837.GA13083@redhat.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 10 Apr 2019, Joe Lawrence wrote: > On Wed, Apr 10, 2019 at 11:50:53AM -0400, Joe Lawrence wrote: > > From: Josh Poimboeuf > > > > Define macros KLP_MODULE_RELOC and KLP_SYMPOS in > > include/linux/livepatch.h to improve user-friendliness of the > > livepatch annotation process. > > > > Signed-off-by: Josh Poimboeuf > > Signed-off-by: Joao Moreira > > Signed-off-by: Joe Lawrence > > --- > > include/linux/livepatch.h | 12 ++++++++++++ > > 1 file changed, 12 insertions(+) > > > > diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h > > index 16b48e8b29a2..947cfc2d1980 100644 > > --- a/include/linux/livepatch.h > > +++ b/include/linux/livepatch.h > > @@ -236,6 +236,18 @@ void *klp_shadow_get_or_alloc(void *obj, unsigned long id, > > void klp_shadow_free(void *obj, unsigned long id, klp_shadow_dtor_t dtor); > > void klp_shadow_free_all(unsigned long id, klp_shadow_dtor_t dtor); > > > > +/* Used to annotate symbol relocations in livepatches */ > > +#define KLP_MODULE_RELOC(obj) \ > > + struct klp_module_reloc \ > > + __attribute__((__section__(".klp.module_relocs." #obj))) \ > > + __attribute__((aligned (4))) > > + > > +#define KLP_SYMPOS(symbol, pos) \ > > + { \ > > + .sym = &symbol, \ > > + .sympos = pos, \ > > + }, > ^^ > nit: if we dropped the trailing array comma delimiter from KLP_SYMPOS > macro, the invocations would look more intuitively like an array. For > example: > > KLP_MODULE_RELOC(test_klp_convert_mod) test_klp_convert_mod_relocs_a[] = { > KLP_SYMPOS(driver_name, 0), > KLP_SYMPOS(homonym_string, 2), > KLP_SYMPOS(get_homonym_string, 2), > }; > > But I could not figure out a good regex to reference if other such > kernel preprocessor macros include or exclude the delimiter. Are there > reasons to include it? No, I don't think so. We should change it. Good catch. Miroslav