Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5137435yba; Wed, 10 Apr 2019 12:10:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFHzoFlu7yY2Qwk+1E0LuNCVztmrAmVnvN6EXkl64nrn0TOLPQBw7TUXCD5w213CQLYsHP X-Received: by 2002:a17:902:e709:: with SMTP id co9mr46216807plb.86.1554923449178; Wed, 10 Apr 2019 12:10:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554923449; cv=none; d=google.com; s=arc-20160816; b=BmAxfeRH5s/35ChBMdpvmy0jesoZTOgN/hfhJiMCAMKv62DcYGjA+56dpoi/xJt1DZ tm2/+rLW2FC4iW1kwAc/YQ/r2V1eNzIDYgHiy7gBgWlb3DGsHrQNXPJ+PaIMwIgrigp6 vDfXMyi2BRzvCe0uig4nqjPXmDPg/1sck5yoi4M1JQZy3PV8XPOcCjZVbXSA8PHQMKkn 6A5WnTUbjv8VKtaP1czTB052X3PBjlcGEjLpo+a7ATrI8Zp4AatJ0d24spEuuCZ58h0f xJ8HYeBotAZsU293xrhlGGulfX3P2qgp4r+VLxL4J1H7eVAy3mGFFZp47jtvjlQcvWwL QraA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=qa58RENFq5Qs06SQQMe3YpfMlrbpiu1I5NdM/VWp0IY=; b=wMrwqCFalWNpcPPdYtnrn1wczNzxyjnpFYcz86lM4l5nV0hKiOVeNzOC76TkKbeVgw xKR+c/gmxCvBrnhafqvQiukSBHpsAmIlNAWwJi55Tl4Jo9hnBeRCIaSJAVuUVnxssrT0 8KHbfiJRwxOjz9QGAEDS85H964yH9SonBnoSUFMWblyKal/n2dOgNjL002lXJkjuAzwE xKV+RkjqjewtfWWM5a2aJ3ic72Vy8Q9GswJW+JcPio5w6jl/ItppLCSLBO3wRw3GmC6y HEkEsoA5Zx54/qsPFbMET6uPww/H+X0q7dM/z3K+4zShu9L11+IygA0MtUqLL/l+L+BZ n3Pg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n13si22496187pgl.348.2019.04.10.12.10.33; Wed, 10 Apr 2019 12:10:49 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730710AbfDJSSl (ORCPT + 99 others); Wed, 10 Apr 2019 14:18:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56858 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727305AbfDJSSl (ORCPT ); Wed, 10 Apr 2019 14:18:41 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 02D9A308624B; Wed, 10 Apr 2019 18:18:41 +0000 (UTC) Received: from redhat.com (dhcp-17-208.bos.redhat.com [10.18.17.208]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B7E019C6F; Wed, 10 Apr 2019 18:18:39 +0000 (UTC) Date: Wed, 10 Apr 2019 14:18:37 -0400 From: Joe Lawrence To: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, linux-kbuild@vger.kernel.org Cc: Jessica Yu , Jiri Kosina , Joao Moreira , Josh Poimboeuf , Konstantin Khlebnikov , Masahiro Yamada , Michael Matz , Miroslav Benes , Nicolai Stange , Petr Mladek Subject: Re: [PATCH v3 4/9] livepatch: Add klp-convert annotation helpers Message-ID: <20190410181837.GA13083@redhat.com> References: <20190410155058.9437-1-joe.lawrence@redhat.com> <20190410155058.9437-5-joe.lawrence@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190410155058.9437-5-joe.lawrence@redhat.com> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 10 Apr 2019 18:18:41 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? -- Joe