Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751496AbdH2TCc (ORCPT ); Tue, 29 Aug 2017 15:02:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:37125 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751415AbdH2TC3 (ORCPT ); Tue, 29 Aug 2017 15:02:29 -0400 From: Joao Moreira To: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Cc: mbenes@suse.cz, mmarek@suse.cz, pmladek@suse.com, jikos@suse.cz, nstange@suse.de, jroedel@suse.de, matz@suse.de, jpoimboe@redhat.com, khlebnikov@yandex-team.ru, jeyu@kernel.org, jmoreira@suse.de Subject: [PATCH 4/8] livepatch: Add klp-convert annotation helpers Date: Tue, 29 Aug 2017 16:01:36 -0300 Message-Id: <20170829190140.401-5-jmoreira@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20170829190140.401-1-jmoreira@suse.de> References: <20170829190140.401-1-jmoreira@suse.de> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1250 Lines: 42 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. [jmoreira: * split up: move KLP_MODULE_RELOC from previous patch to here * add KLP_SYMPOS * move macros from include/uapi/livepatch.h to include/linux/livepatch.h ] Signed-off-by: Josh Poimboeuf Signed-off-by: Joao Moreira --- include/linux/livepatch.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h index 96a75be7ef50..3956929f21bc 100644 --- a/include/linux/livepatch.h +++ b/include/linux/livepatch.h @@ -165,6 +165,17 @@ static inline bool klp_have_reliable_stack(void) IS_ENABLED(CONFIG_HAVE_RELIABLE_STACKTRACE); } +/* Used to annotate symbol relocations in livepatches */ +#define KLP_MODULE_RELOC(obj) \ + struct klp_module_reloc \ + __attribute__((__section__(".klp.module_relocs." #obj))) + +#define KLP_SYMPOS(symbol, pos) \ + { \ + .sym = &symbol, \ + .sympos = pos, \ + }, + #else /* !CONFIG_LIVEPATCH */ static inline int klp_module_coming(struct module *mod) { return 0; } -- 2.12.0