Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1362382
| From | Baoquan He <bhe@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v4 08/20] x86, kaslr: Get correct max_addr for relocs pointer |
| Date | 2016-03-22 08:40 +0100 |
| Message-ID | <rfp51-1bB-41@gated-at.bofh.it> (permalink) |
| References | <rfp4Z-1bB-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Yinghai Lu <yinghai@kernel.org>
Relocation handling performs bounds checking on the relocated
addresses. The existing code uses output_len (VO size plus relocs
size) as the max address. This is not right since the max_addr check
should stop at the end of VO and exclude bss, brk, etc, which follows.
The valid range should be VO [_text, __bss_start] in the loaded
physical address space.
In this patch, add export for __bss_start to voffset.h and use it to
get the correct max_addr.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Baoquan He <bhe@redhat.com>
---
v2->v3:
Adjust patch log.
v3->v4:
Kees help rewrite the patch log
arch/x86/boot/compressed/Makefile | 2 +-
arch/x86/boot/compressed/misc.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index fef80fa..2e7c0ce 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -41,7 +41,7 @@ LDFLAGS_vmlinux := -T
hostprogs-y := mkpiggy
HOST_EXTRACFLAGS += -I$(srctree)/tools/include
-sed-voffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(_text\|_end\)$$/\#define VO_\2 _AC(0x\1,UL)/p'
+sed-voffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(_text\|__bss_start\|_end\)$$/\#define VO_\2 _AC(0x\1,UL)/p'
quiet_cmd_voffset = VOFFSET $@
cmd_voffset = $(NM) $< | sed -n $(sed-voffset) > $@
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index def6207..029f42f 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -259,7 +259,7 @@ static void handle_relocations(void *output, unsigned long output_len)
int *reloc;
unsigned long delta, map, ptr;
unsigned long min_addr = (unsigned long)output;
- unsigned long max_addr = min_addr + output_len;
+ unsigned long max_addr = min_addr + (VO___bss_start - VO__text);
/*
* Calculate the delta between where vmlinux was linked to load
--
2.5.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v4 00/20] x86, boot: kaslr cleanup and 64bit kaslr support Baoquan He <bhe@redhat.com> - 2016-03-22 08:40 +0100
[PATCH v4 08/20] x86, kaslr: Get correct max_addr for relocs pointer Baoquan He <bhe@redhat.com> - 2016-03-22 08:40 +0100
Re: [PATCH v4 08/20] x86, kaslr: Get correct max_addr for relocs pointer Kees Cook <keescook@chromium.org> - 2016-03-22 22:00 +0100
[PATCH v4 19/20] x86, kaslr: Allow random address to be below loaded address Baoquan He <bhe@redhat.com> - 2016-03-22 08:40 +0100
Re: [PATCH v4 19/20] x86, kaslr: Allow random address to be below loaded address Kees Cook <keescook@chromium.org> - 2016-03-22 21:00 +0100
Re: [PATCH v4 19/20] x86, kaslr: Allow random address to be below loaded address Baoquan He <bhe@redhat.com> - 2016-03-23 02:50 +0100
[PATCH v5 19/20] x86, kaslr: Allow random address to be below loaded address Baoquan He <bhe@redhat.com> - 2016-03-23 10:00 +0100
[PATCH v4 12/20] x86, boot: Add checking for memcpy Baoquan He <bhe@redhat.com> - 2016-03-22 08:40 +0100
[PATCH v4 14/20] x86, kaslr: Add two functions which will be used later Baoquan He <bhe@redhat.com> - 2016-03-22 08:40 +0100
Re: [PATCH v4 00/20] x86, boot: kaslr cleanup and 64bit kaslr support Kees Cook <keescook@chromium.org> - 2016-03-22 21:30 +0100
Re: [PATCH v4 00/20] x86, boot: kaslr cleanup and 64bit kaslr support Kees Cook <keescook@chromium.org> - 2016-03-23 23:50 +0100
csiph-web