| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- From b6ebe31d563b5fade20c8516eaff92ab3122f1b8 Mon Sep 17 00:00:00 2001
- From: Josh Poimboeuf <[email protected]>
- Date: Mon, 6 Nov 2017 07:21:51 -0600
- Subject: [PATCH 130/232] objtool: Move kernel headers/code sync check to a
- script
- MIME-Version: 1.0
- Content-Type: text/plain; charset=UTF-8
- Content-Transfer-Encoding: 8bit
- CVE-2017-5754
- Replace the nasty diff checks in the objtool Makefile with a clean bash
- script, and make the warnings more specific.
- Heavily inspired by tools/perf/check-headers.sh.
- Suggested-by: Ingo Molnar <[email protected]>
- Signed-off-by: Josh Poimboeuf <[email protected]>
- Cc: Linus Torvalds <[email protected]>
- Cc: Peter Zijlstra <[email protected]>
- Cc: Thomas Gleixner <[email protected]>
- Link: http://lkml.kernel.org/r/ab015f15ccd8c0c6008493c3c6ee3d495eaf2927.1509974346.git.jpoimboe@redhat.com
- Signed-off-by: Ingo Molnar <[email protected]>
- (cherry picked from commit a89ec413c623eb2870180bcad678046bf7bc8465)
- Signed-off-by: Andy Whitcroft <[email protected]>
- Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
- (cherry picked from commit 4e72ce95a057e744b8d580239e2d8afa51118d82)
- Signed-off-by: Fabian Grünbichler <[email protected]>
- ---
- tools/objtool/Makefile | 16 +---------------
- tools/objtool/sync-check.sh | 29 +++++++++++++++++++++++++++++
- 2 files changed, 30 insertions(+), 15 deletions(-)
- create mode 100755 tools/objtool/sync-check.sh
- diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
- index f95f48e445c3..90b0241f3ccc 100644
- --- a/tools/objtool/Makefile
- +++ b/tools/objtool/Makefile
- @@ -41,22 +41,8 @@ include $(srctree)/tools/build/Makefile.include
- $(OBJTOOL_IN): fixdep FORCE
- @$(MAKE) $(build)=objtool
-
- -# Busybox's diff doesn't have -I, avoid warning in that case
- -#
- $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN)
- - @(diff -I 2>&1 | grep -q 'option requires an argument' && \
- - test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \
- - diff arch/x86/lib/insn.c ../../arch/x86/lib/insn.c >/dev/null && \
- - diff arch/x86/lib/inat.c ../../arch/x86/lib/inat.c >/dev/null && \
- - diff arch/x86/lib/x86-opcode-map.txt ../../arch/x86/lib/x86-opcode-map.txt >/dev/null && \
- - diff arch/x86/tools/gen-insn-attr-x86.awk ../../arch/x86/tools/gen-insn-attr-x86.awk >/dev/null && \
- - diff arch/x86/include/asm/insn.h ../../arch/x86/include/asm/insn.h >/dev/null && \
- - diff arch/x86/include/asm/inat.h ../../arch/x86/include/asm/inat.h >/dev/null && \
- - diff arch/x86/include/asm/inat_types.h ../../arch/x86/include/asm/inat_types.h >/dev/null) \
- - || echo "warning: objtool: x86 instruction decoder differs from kernel" >&2 )) || true
- - @(test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \
- - diff ../../arch/x86/include/asm/orc_types.h arch/x86/include/asm/orc_types.h >/dev/null) \
- - || echo "warning: objtool: orc_types.h differs from kernel" >&2 )) || true
- + @./sync-check.sh
- $(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@
-
-
- diff --git a/tools/objtool/sync-check.sh b/tools/objtool/sync-check.sh
- new file mode 100755
- index 000000000000..1470e74e9d66
- --- /dev/null
- +++ b/tools/objtool/sync-check.sh
- @@ -0,0 +1,29 @@
- +#!/bin/sh
- +# SPDX-License-Identifier: GPL-2.0
- +
- +FILES='
- +arch/x86/lib/insn.c
- +arch/x86/lib/inat.c
- +arch/x86/lib/x86-opcode-map.txt
- +arch/x86/tools/gen-insn-attr-x86.awk
- +arch/x86/include/asm/insn.h
- +arch/x86/include/asm/inat.h
- +arch/x86/include/asm/inat_types.h
- +arch/x86/include/asm/orc_types.h
- +'
- +
- +check()
- +{
- + local file=$1
- +
- + diff $file ../../$file > /dev/null ||
- + echo "Warning: synced file at 'tools/objtool/$file' differs from latest kernel version at '$file'"
- +}
- +
- +if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then
- + exit 0
- +fi
- +
- +for i in $FILES; do
- + check $i
- +done
- --
- 2.14.2
|