diff options
author | Yinghai Lu <yinghai@kernel.org> | 2016-04-28 20:09:07 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-04-29 05:03:30 -0400 |
commit | 4d2d542482205d3df1a0852751f5b004cc6390cc (patch) | |
tree | ce5aca3461a76427d62413c1a07484da6f9772f1 /arch/x86/tools | |
parent | 67b6662559f7f77bcbd3ac67d09aaac11785f3c1 (diff) |
x86/KASLR: Clean up unused code from old 'run_size' and rename it to 'kernel_total_size'
Since 'run_size' is now calculated in misc.c, the old script and associated
argument passing is no longer needed. This patch removes them, and renames
'run_size' to the more descriptive 'kernel_total_size'.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Baoquan He <bhe@redhat.com>
[ Rewrote the changelog, renamed 'run_size' to 'kernel_total_size' ]
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Junjie Mao <eternal.n08@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: lasse.collin@tukaani.org
Link: http://lkml.kernel.org/r/1461888548-32439-6-git-send-email-keescook@chromium.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/tools')
-rw-r--r-- | arch/x86/tools/calc_run_size.sh | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/arch/x86/tools/calc_run_size.sh b/arch/x86/tools/calc_run_size.sh deleted file mode 100644 index 1a4c17bb3910..000000000000 --- a/arch/x86/tools/calc_run_size.sh +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # Calculate the amount of space needed to run the kernel, including room for | ||
4 | # the .bss and .brk sections. | ||
5 | # | ||
6 | # Usage: | ||
7 | # objdump -h a.out | sh calc_run_size.sh | ||
8 | |||
9 | NUM='\([0-9a-fA-F]*[ \t]*\)' | ||
10 | OUT=$(sed -n 's/^[ \t0-9]*.b[sr][sk][ \t]*'"$NUM$NUM$NUM$NUM"'.*/\1\4/p') | ||
11 | if [ -z "$OUT" ] ; then | ||
12 | echo "Never found .bss or .brk file offset" >&2 | ||
13 | exit 1 | ||
14 | fi | ||
15 | |||
16 | OUT=$(echo ${OUT# }) | ||
17 | sizeA=$(printf "%d" 0x${OUT%% *}) | ||
18 | OUT=${OUT#* } | ||
19 | offsetA=$(printf "%d" 0x${OUT%% *}) | ||
20 | OUT=${OUT#* } | ||
21 | sizeB=$(printf "%d" 0x${OUT%% *}) | ||
22 | OUT=${OUT#* } | ||
23 | offsetB=$(printf "%d" 0x${OUT%% *}) | ||
24 | |||
25 | run_size=$(( $offsetA + $sizeA + $sizeB )) | ||
26 | |||
27 | # BFD linker shows the same file offset in ELF. | ||
28 | if [ "$offsetA" -ne "$offsetB" ] ; then | ||
29 | # Gold linker shows them as consecutive. | ||
30 | endB=$(( $offsetB + $sizeB )) | ||
31 | if [ "$endB" != "$run_size" ] ; then | ||
32 | printf "sizeA: 0x%x\n" $sizeA >&2 | ||
33 | printf "offsetA: 0x%x\n" $offsetA >&2 | ||
34 | printf "sizeB: 0x%x\n" $sizeB >&2 | ||
35 | printf "offsetB: 0x%x\n" $offsetB >&2 | ||
36 | echo ".bss and .brk are non-contiguous" >&2 | ||
37 | exit 1 | ||
38 | fi | ||
39 | fi | ||
40 | |||
41 | printf "%d\n" $run_size | ||
42 | exit 0 | ||