summaryrefslogtreecommitdiff
path: root/arch/parisc/kernel/module.c
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2018-11-10 16:14:59 +0100
committerHelge Deller <deller@gmx.de>2018-12-10 07:47:50 +0100
commit8cc28269b9574103aae9088a02a20929ec75f983 (patch)
tree17847e628ee8aaf6d6b5dbcd5d1a652211d09adf /arch/parisc/kernel/module.c
parent40e020c129cfc991e8ab4736d2665351ffd1468d (diff)
parisc: Split out alternative live patching code
Move the alternative implemenation coding to alternative.c and add code to patch modules while loading. Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'arch/parisc/kernel/module.c')
-rw-r--r--arch/parisc/kernel/module.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c
index b5b3cb00f1fb..43778420614b 100644
--- a/arch/parisc/kernel/module.c
+++ b/arch/parisc/kernel/module.c
@@ -877,6 +877,8 @@ int module_finalize(const Elf_Ehdr *hdr,
int i;
unsigned long nsyms;
const char *strtab = NULL;
+ const Elf_Shdr *s;
+ char *secstrings;
Elf_Sym *newptr, *oldptr;
Elf_Shdr *symhdr = NULL;
#ifdef DEBUG
@@ -948,6 +950,18 @@ int module_finalize(const Elf_Ehdr *hdr,
nsyms = newptr - (Elf_Sym *)symhdr->sh_addr;
DEBUGP("NEW num_symtab %lu\n", nsyms);
symhdr->sh_size = nsyms * sizeof(Elf_Sym);
+
+ /* find .altinstructions section */
+ secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
+ for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) {
+ void *aseg = (void *) s->sh_addr;
+ char *secname = secstrings + s->sh_name;
+
+ if (!strcmp(".altinstructions", secname))
+ /* patch .altinstructions */
+ apply_alternatives(aseg, aseg + s->sh_size, me->name);
+ }
+
return 0;
}