Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5127242yba; Wed, 10 Apr 2019 11:58:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQSA5Jt39PQoglY8zqyyGeKAJPUXpsoEQNEtCC+LH38Ancr0IKKb0fZLKHNUVHUPpQYT64 X-Received: by 2002:a62:2046:: with SMTP id g67mr44608514pfg.121.1554922696494; Wed, 10 Apr 2019 11:58:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554922696; cv=none; d=google.com; s=arc-20160816; b=uzqKKh2W+QvkmWPZiuRVrTgnTfgu0X/jKJf8Koxr+KfkI0waE1a251hH6nXkSypwvQ 4HuAUkDnrXoEZ2eaWZWW4a3woKYrqaGuEnzjXCNSZMnWejDdzKUjThDB+MXPPv2cjv+m sRuLl+LPfBC4nOY9pCkhIaby539TqfVpZPEdbxGDchVlUNN1rI+FSzFYlaLNZ4urLQqx i31QS+De+Tt78mn1C74m01+m8qMshMlJ40UuGpCKix48aGlMSG/F4eI0YrJgpCLDvUYc BPE+ht1PDO0fx5FqRvNADA9ux60h/+VG5S6jHokZfnNHA/IWMhNdu4893Wef+TGJhel5 OYRQ== 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:cc:to:from; bh=+HLAgHtD2V+mAUQdJ7U8D1NBs2BgN+5UNSZkDfLBteU=; b=lBaqPpg1gz/VI3KDbqlSpPh1JRFzOOzGpPXweoiqVgNHWvqoD/NUjWwzzE4ea7NXSI fGoBvVZsCDgYZc0w9p2Flwb/vdvFwgk5WcTOLvKhbgFb4pCcUK6Ism+GA0NEkQqr9Gu0 8Kc/w8AxIPtE+jIUFPgpS4sW4sdnE1XEhaHalFQzJemeg9pHN3lruaHLEbukVc2tzajc WQMqh9Km59Ql9nme7ocbs7jI6g7nUpbFSL+q6si6OnkpD7OkEye094B2KOQJgAPw+brt thmQj6mbTiiVhOTkCDM0UlRpDzG5PuRMGHkpmaaIAZOKXAu9xt+FJUJOQUE/SeEiFwi2 0blQ== 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 c25si3153265pfr.94.2019.04.10.11.58.00; Wed, 10 Apr 2019 11:58:16 -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 S2387520AbfDJPvN (ORCPT + 99 others); Wed, 10 Apr 2019 11:51:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37556 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387491AbfDJPvK (ORCPT ); Wed, 10 Apr 2019 11:51:10 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 74EC430B32F0; Wed, 10 Apr 2019 15:51:10 +0000 (UTC) Received: from jlaw-desktop.bos.redhat.com (dhcp-17-208.bos.redhat.com [10.18.17.208]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F33B110A180; Wed, 10 Apr 2019 15:51:09 +0000 (UTC) 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 , Joe Lawrence , Josh Poimboeuf , Konstantin Khlebnikov , Masahiro Yamada , Michael Matz , Miroslav Benes , Nicolai Stange , Petr Mladek Subject: [PATCH v3 4/9] livepatch: Add klp-convert annotation helpers Date: Wed, 10 Apr 2019 11:50:53 -0400 Message-Id: <20190410155058.9437-5-joe.lawrence@redhat.com> In-Reply-To: <20190410155058.9437-1-joe.lawrence@redhat.com> References: <20190410155058.9437-1-joe.lawrence@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 10 Apr 2019 15:51:10 +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..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, \ + }, + #else /* !CONFIG_LIVEPATCH */ static inline int klp_module_coming(struct module *mod) { return 0; } -- 2.20.1