From: Joao Moreira <jmoreira@suse.de>
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 1/8] livepatch: Create and include UAPI headers
Date: Tue, 29 Aug 2017 16:01:33 -0300 [thread overview]
Message-ID: <20170829190140.401-2-jmoreira@suse.de> (raw)
In-Reply-To: <20170829190140.401-1-jmoreira@suse.de>
From: Josh Poimboeuf <jpoimboe@redhat.com>
Define klp prefixes in include/uapi/linux/livepatch.h, and use them for
replacing hard-coded values in kernel/livepatch/core.c.
Update MAINTAINERS.
Note: Add defines to uapi as these are also to be used by klp-convert, a
userspace tool that will be added in patch 03/07 of this same patch set.
[jmoreira: split up and changelog]
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Joao Moreira <jmoreira@suse.de>
---
MAINTAINERS | 1 +
include/linux/livepatch.h | 1 +
include/uapi/linux/livepatch.h | 28 ++++++++++++++++++++++++++++
kernel/livepatch/core.c | 4 ++--
4 files changed, 32 insertions(+), 2 deletions(-)
create mode 100644 include/uapi/linux/livepatch.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 09b5ab6a8a5c..1d8ea36e1173 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7713,6 +7713,7 @@ R: Petr Mladek <pmladek@suse.com>
S: Maintained
F: kernel/livepatch/
F: include/linux/livepatch.h
+F: include/uapi/linux/livepatch.h
F: arch/x86/include/asm/livepatch.h
F: arch/x86/kernel/livepatch.c
F: Documentation/livepatch/
diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h
index 194991ef9347..96a75be7ef50 100644
--- a/include/linux/livepatch.h
+++ b/include/linux/livepatch.h
@@ -24,6 +24,7 @@
#include <linux/module.h>
#include <linux/ftrace.h>
#include <linux/completion.h>
+#include <uapi/linux/livepatch.h>
#if IS_ENABLED(CONFIG_LIVEPATCH)
diff --git a/include/uapi/linux/livepatch.h b/include/uapi/linux/livepatch.h
new file mode 100644
index 000000000000..bc35f85fd859
--- /dev/null
+++ b/include/uapi/linux/livepatch.h
@@ -0,0 +1,28 @@
+/*
+ * livepatch.h - Kernel Live Patching Core
+ *
+ * Copyright (C) 2016 Josh Poimboeuf <jpoimboe@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _UAPI_LIVEPATCH_H
+#define _UAPI_LIVEPATCH_H
+
+#include <linux/types.h>
+
+#define KLP_RELA_PREFIX ".klp.rela."
+#define KLP_SYM_PREFIX ".klp.sym."
+
+#endif /* _UAPI_LIVEPATCH_H */
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index b9628e43c78f..a9b172d2c83f 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -212,7 +212,7 @@ static int klp_resolve_symbols(Elf_Shdr *relasec, struct module *pmod)
/* Format: .klp.sym.objname.symname,sympos */
cnt = sscanf(strtab + sym->st_name,
- ".klp.sym.%55[^.].%127[^,],%lu",
+ KLP_SYM_PREFIX "%55[^.].%127[^,],%lu",
objname, symname, &sympos);
if (cnt != 3) {
pr_err("symbol %s has an incorrectly formatted name\n",
@@ -258,7 +258,7 @@ static int klp_write_object_relocations(struct module *pmod,
* See comment in klp_resolve_symbols() for an explanation
* of the selected field width value.
*/
- cnt = sscanf(secname, ".klp.rela.%55[^.]", sec_objname);
+ cnt = sscanf(secname, KLP_RELA_PREFIX "%55[^.]", sec_objname);
if (cnt != 1) {
pr_err("section %s has an incorrectly formatted name\n",
secname);
--
2.12.0
next prev parent reply other threads:[~2017-08-29 19:02 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-29 19:01 [PATCH 0/8] livepatch: klp-convert tool Joao Moreira
2017-08-29 19:01 ` Joao Moreira [this message]
2017-08-29 19:01 ` [PATCH 2/8] kbuild: Support for Symbols.list creation Joao Moreira
2017-08-31 15:24 ` Joe Lawrence
2017-08-31 17:34 ` Josh Poimboeuf
2017-09-04 7:23 ` Joao Moreira
2017-08-29 19:01 ` [PATCH 3/8] livepatch: Add klp-convert tool Joao Moreira
2017-08-30 20:03 ` Joao Moreira
2017-08-29 19:01 ` [PATCH 4/8] livepatch: Add klp-convert annotation helpers Joao Moreira
2017-08-29 19:01 ` [PATCH 5/8] modpost: Integrate klp-convert Joao Moreira
2017-08-29 19:01 ` [PATCH 6/8] modpost: Add modinfo flag to livepatch modules Joao Moreira
2017-08-29 19:01 ` [PATCH 7/8] livepatch: Add sample livepatch module Joao Moreira
2017-08-29 19:01 ` [PATCH 8/8] documentation: Update on livepatch elf format Joao Moreira
2017-08-30 18:00 ` [PATCH 0/8] livepatch: klp-convert tool Josh Poimboeuf
2017-10-10 14:17 ` Miroslav Benes
2017-10-11 2:46 ` Josh Poimboeuf
2017-10-11 12:42 ` Joao Moreira
2017-10-19 13:01 ` Josh Poimboeuf
2017-10-19 13:24 ` Miroslav Benes
2017-10-19 14:03 ` Josh Poimboeuf
2017-10-19 14:27 ` Miroslav Benes
2017-10-19 15:15 ` Josh Poimboeuf
2017-10-19 16:00 ` Miroslav Benes
2017-10-19 16:20 ` Josh Poimboeuf
2017-10-20 8:51 ` Miroslav Benes
2017-10-20 12:03 ` Josh Poimboeuf
2017-10-20 12:44 ` Torsten Duwe
2017-10-20 13:24 ` Josh Poimboeuf
2017-10-20 13:39 ` Miroslav Benes
2017-10-20 13:44 ` Torsten Duwe
2017-10-20 14:20 ` Josh Poimboeuf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170829190140.401-2-jmoreira@suse.de \
--to=jmoreira@suse.de \
--cc=jeyu@kernel.org \
--cc=jikos@suse.cz \
--cc=jpoimboe@redhat.com \
--cc=jroedel@suse.de \
--cc=khlebnikov@yandex-team.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=matz@suse.de \
--cc=mbenes@suse.cz \
--cc=mmarek@suse.cz \
--cc=nstange@suse.de \
--cc=pmladek@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome