lkml.org 
[lkml]   [2019]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v4 10/10] livepatch/klp-convert: abort on special sections
Date
To properly convert alternatives, paravirt ops, and static keys,
klp-convert needs to implement "klp.arch" sections as supported by
d4c3e6e1b193 (“livepatch/x86: apply alternatives and paravirt patches
after relocations”).

There is some amount of ELF section bookkeeping required for this (ie,
moving data structure entries and relocations to their ".klp.arch"
equivalents) but the hardest part will be determining klp_object
relationships. This may require some larger changes to livepatch API,
so defer support for now.

Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
---
scripts/livepatch/klp-convert.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/scripts/livepatch/klp-convert.c b/scripts/livepatch/klp-convert.c
index 72b65428e738..b5873abecefb 100644
--- a/scripts/livepatch/klp-convert.c
+++ b/scripts/livepatch/klp-convert.c
@@ -617,6 +617,18 @@ static void free_converted_resources(struct elf *klp_elf)
}
}

+/* Check for special sections that klp-convert doesn't support */
+static bool is_section_supported(char *sname)
+{
+ if (strcmp(sname, ".rela.altinstructions") == 0)
+ return false;
+ if (strcmp(sname, ".rela.parainstructions") == 0)
+ return false;
+ if (strcmp(sname, ".rela__jump_table") == 0)
+ return false;
+ return true;
+}
+
int main(int argc, const char **argv)
{
const char *klp_in_module, *klp_out_module, *symbols_list;
@@ -649,6 +661,12 @@ int main(int argc, const char **argv)
}

list_for_each_entry_safe(sec, aux, &klp_elf->sections, list) {
+ if (!is_section_supported(sec->name)) {
+ WARN("Special ELF section: %s not supported",
+ sec->name);
+ return -1;
+ }
+
if (!is_rela_section(sec) ||
is_klp_rela_section(sec->name))
continue;
--
2.20.1
\
 
 \ /
  Last update: 2019-05-09 16:39    [W:0.218 / U:0.828 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site