diff options
| author | Ingo Molnar <mingo@kernel.org> | 2017-11-07 10:53:06 +0100 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2017-11-07 10:53:06 +0100 |
| commit | b3d9a136815ca9284ade2a897a3b7d2b0084c33c (patch) | |
| tree | af222e53d833ff7218577cf98e1b856d9d6bda93 /arch/x86/kernel/module.c | |
| parent | x86/mm: Define _PAGE_TABLE using _KERNPG_TABLE (diff) | |
| parent | Merge branch 'for-4.14-fixes' of git://git.kernel.org/pub/scm/linux/kernel/gi... (diff) | |
| download | linux-b3d9a136815ca9284ade2a897a3b7d2b0084c33c.tar.gz linux-b3d9a136815ca9284ade2a897a3b7d2b0084c33c.zip | |
Merge branch 'linus' into x86/asm, to pick up fixes and resolve conflicts
Conflicts:
arch/x86/kernel/cpu/Makefile
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/module.c')
| -rw-r--r-- | arch/x86/kernel/module.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c index 62e7d70aadd5..da0c160e5589 100644 --- a/arch/x86/kernel/module.c +++ b/arch/x86/kernel/module.c @@ -172,19 +172,27 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, case R_X86_64_NONE: break; case R_X86_64_64: + if (*(u64 *)loc != 0) + goto invalid_relocation; *(u64 *)loc = val; break; case R_X86_64_32: + if (*(u32 *)loc != 0) + goto invalid_relocation; *(u32 *)loc = val; if (val != *(u32 *)loc) goto overflow; break; case R_X86_64_32S: + if (*(s32 *)loc != 0) + goto invalid_relocation; *(s32 *)loc = val; if ((s64)val != *(s32 *)loc) goto overflow; break; case R_X86_64_PC32: + if (*(u32 *)loc != 0) + goto invalid_relocation; val -= (u64)loc; *(u32 *)loc = val; #if 0 @@ -200,6 +208,11 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, } return 0; +invalid_relocation: + pr_err("x86/modules: Skipping invalid relocation target, existing value is nonzero for type %d, loc %p, val %Lx\n", + (int)ELF64_R_TYPE(rel[i].r_info), loc, val); + return -ENOEXEC; + overflow: pr_err("overflow in relocation type %d val %Lx\n", (int)ELF64_R_TYPE(rel[i].r_info), val); |
