]>
Commit | Line | Data |
---|---|---|
59d5af67 | 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
321d628a FG |
2 | From: Josh Poimboeuf <jpoimboe@redhat.com> |
3 | Date: Mon, 6 Nov 2017 07:21:51 -0600 | |
59d5af67 | 4 | Subject: [PATCH] objtool: Move kernel headers/code sync check to a script |
321d628a FG |
5 | MIME-Version: 1.0 |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ||
9 | CVE-2017-5754 | |
10 | ||
11 | Replace the nasty diff checks in the objtool Makefile with a clean bash | |
12 | script, and make the warnings more specific. | |
13 | ||
14 | Heavily inspired by tools/perf/check-headers.sh. | |
15 | ||
16 | Suggested-by: Ingo Molnar <mingo@kernel.org> | |
17 | Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> | |
18 | Cc: Linus Torvalds <torvalds@linux-foundation.org> | |
19 | Cc: Peter Zijlstra <peterz@infradead.org> | |
20 | Cc: Thomas Gleixner <tglx@linutronix.de> | |
21 | Link: http://lkml.kernel.org/r/ab015f15ccd8c0c6008493c3c6ee3d495eaf2927.1509974346.git.jpoimboe@redhat.com | |
22 | Signed-off-by: Ingo Molnar <mingo@kernel.org> | |
23 | (cherry picked from commit a89ec413c623eb2870180bcad678046bf7bc8465) | |
24 | Signed-off-by: Andy Whitcroft <apw@canonical.com> | |
25 | Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com> | |
26 | (cherry picked from commit 4e72ce95a057e744b8d580239e2d8afa51118d82) | |
27 | Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> | |
28 | --- | |
29 | tools/objtool/Makefile | 16 +--------------- | |
30 | tools/objtool/sync-check.sh | 29 +++++++++++++++++++++++++++++ | |
31 | 2 files changed, 30 insertions(+), 15 deletions(-) | |
32 | create mode 100755 tools/objtool/sync-check.sh | |
33 | ||
34 | diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile | |
35 | index f95f48e445c3..90b0241f3ccc 100644 | |
36 | --- a/tools/objtool/Makefile | |
37 | +++ b/tools/objtool/Makefile | |
38 | @@ -41,22 +41,8 @@ include $(srctree)/tools/build/Makefile.include | |
39 | $(OBJTOOL_IN): fixdep FORCE | |
40 | @$(MAKE) $(build)=objtool | |
41 | ||
42 | -# Busybox's diff doesn't have -I, avoid warning in that case | |
43 | -# | |
44 | $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN) | |
45 | - @(diff -I 2>&1 | grep -q 'option requires an argument' && \ | |
46 | - test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \ | |
47 | - diff arch/x86/lib/insn.c ../../arch/x86/lib/insn.c >/dev/null && \ | |
48 | - diff arch/x86/lib/inat.c ../../arch/x86/lib/inat.c >/dev/null && \ | |
49 | - diff arch/x86/lib/x86-opcode-map.txt ../../arch/x86/lib/x86-opcode-map.txt >/dev/null && \ | |
50 | - diff arch/x86/tools/gen-insn-attr-x86.awk ../../arch/x86/tools/gen-insn-attr-x86.awk >/dev/null && \ | |
51 | - diff arch/x86/include/asm/insn.h ../../arch/x86/include/asm/insn.h >/dev/null && \ | |
52 | - diff arch/x86/include/asm/inat.h ../../arch/x86/include/asm/inat.h >/dev/null && \ | |
53 | - diff arch/x86/include/asm/inat_types.h ../../arch/x86/include/asm/inat_types.h >/dev/null) \ | |
54 | - || echo "warning: objtool: x86 instruction decoder differs from kernel" >&2 )) || true | |
55 | - @(test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \ | |
56 | - diff ../../arch/x86/include/asm/orc_types.h arch/x86/include/asm/orc_types.h >/dev/null) \ | |
57 | - || echo "warning: objtool: orc_types.h differs from kernel" >&2 )) || true | |
58 | + @./sync-check.sh | |
59 | $(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@ | |
60 | ||
61 | ||
62 | diff --git a/tools/objtool/sync-check.sh b/tools/objtool/sync-check.sh | |
63 | new file mode 100755 | |
64 | index 000000000000..1470e74e9d66 | |
65 | --- /dev/null | |
66 | +++ b/tools/objtool/sync-check.sh | |
67 | @@ -0,0 +1,29 @@ | |
68 | +#!/bin/sh | |
69 | +# SPDX-License-Identifier: GPL-2.0 | |
70 | + | |
71 | +FILES=' | |
72 | +arch/x86/lib/insn.c | |
73 | +arch/x86/lib/inat.c | |
74 | +arch/x86/lib/x86-opcode-map.txt | |
75 | +arch/x86/tools/gen-insn-attr-x86.awk | |
76 | +arch/x86/include/asm/insn.h | |
77 | +arch/x86/include/asm/inat.h | |
78 | +arch/x86/include/asm/inat_types.h | |
79 | +arch/x86/include/asm/orc_types.h | |
80 | +' | |
81 | + | |
82 | +check() | |
83 | +{ | |
84 | + local file=$1 | |
85 | + | |
86 | + diff $file ../../$file > /dev/null || | |
87 | + echo "Warning: synced file at 'tools/objtool/$file' differs from latest kernel version at '$file'" | |
88 | +} | |
89 | + | |
90 | +if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then | |
91 | + exit 0 | |
92 | +fi | |
93 | + | |
94 | +for i in $FILES; do | |
95 | + check $i | |
96 | +done | |
97 | -- | |
98 | 2.14.2 | |
99 |