Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp902799yba; Thu, 9 May 2019 07:42:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzCGaKkPAi5LHv/VMHV2cUSjfp+vgDpJ/7TXZWhqzy2Rfyfvz901UU0LbwN65VrkijZiqdR X-Received: by 2002:a17:902:12f:: with SMTP id 44mr5612179plb.193.1557412963353; Thu, 09 May 2019 07:42:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557412963; cv=none; d=google.com; s=arc-20160816; b=L9mnXDgVESatKYtQMjpW1DtVGoat14Cps23y9a0aFbZ6zQiDdBdeZFdEsNWIHAiHaE AY3Ky+NpfQsZeTKeim9Hj40IsGdsBps1wG6F1mdV+3WFgg8lCB3FLspYtrngkKEti9Ui 8100sfgzQiswAiQa+3xLCXint/RprXOCN6iZkc4PuBeGTXEwgrfSoTXV8OoVZ3MX+SkV LAT0wAbM8VU6ze10m/7cSAU0vl11IEiRv1bw+Z5lZjhTDaDSlZHLdSDFKT2IPfWL8dVI CF83HSjYAqsbMTrRZP9iD3wsBDP1Vf7wLi7EJKmslW3IiPucKGcpDZAgF6/adw2hcn51 2trg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from; bh=NC90zbhcXWQNy2g2k01TMtKHtVAsAYtDYqkiYaCxpEM=; b=MLqXehutLyOKgvOf9SdF0R1imfFBvoLiAUcWeI4XaWwmi4QcyW333ieL5xYUGGs/II jPDdgh3DULS1wd5LbFCBmIURoUfvjZ5ub2IfAbxWF6I67i5DF5oQC5WOAygeaSx2CD4T Md8Eg6DRiL5ci7Wo6Al0nLH3tAE2EqzYa/HkILzEXsQX3wAKge/uLghc9udyfRhMkxD8 xDBNzsEYLCyfuK4Opbt+h/J2Qdgc6ekck63f6y2i6cZepdFw/YWxhilCakAlx5Oypdgs ggosj7ZwqGvS+OkdC76AShOw03LcLDrr+YpuBGzaA4lFwK2wPyVZh16Jh3tWNf7rZxri gdfA== 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 b2si3274774pgk.89.2019.05.09.07.42.26; Thu, 09 May 2019 07:42: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; 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 S1727015AbfEIOjs (ORCPT + 99 others); Thu, 9 May 2019 10:39:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43526 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726743AbfEIOjL (ORCPT ); Thu, 9 May 2019 10:39:11 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 78F363079B93; Thu, 9 May 2019 14:39:11 +0000 (UTC) Received: from jlaw-desktop.redhat.com (ovpn-123-90.rdu2.redhat.com [10.10.123.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id E38925DF49; Thu, 9 May 2019 14:39:10 +0000 (UTC) From: Joe Lawrence To: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, linux-kbuild@vger.kernel.org Subject: [PATCH v4 04/10] livepatch: Add klp-convert annotation helpers Date: Thu, 9 May 2019 10:38:53 -0400 Message-Id: <20190509143859.9050-5-joe.lawrence@redhat.com> In-Reply-To: <20190509143859.9050-1-joe.lawrence@redhat.com> References: <20190509143859.9050-1-joe.lawrence@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 09 May 2019 14:39:11 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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..3071aec8fd72 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, \ + } + #else /* !CONFIG_LIVEPATCH */ static inline int klp_module_coming(struct module *mod) { return 0; } -- 2.20.1