objtool: Mark non-standard object files and directories
authorJosh Poimboeuf <jpoimboe@redhat.com>
Mon, 29 Feb 2016 04:22:34 +0000 (22:22 -0600)
committerIngo Molnar <mingo@kernel.org>
Mon, 29 Feb 2016 07:35:02 +0000 (08:35 +0100)
Code which runs outside the kernel's normal mode of operation often does
unusual things which can cause a static analysis tool like objtool to
emit false positive warnings:

 - boot image
 - vdso image
 - relocation
 - realmode
 - efi
 - head
 - purgatory
 - modpost

Set OBJECT_FILES_NON_STANDARD for their related files and directories,
which will tell objtool to skip checking them.  It's ok to skip them
because they don't affect runtime stack traces.

Also skip the following code which does the right thing with respect to
frame pointers, but is too "special" to be validated by a tool:

 - entry
 - mcount

Also skip the test_nx module because it modifies its exception handling
table at runtime, which objtool can't understand.  Fortunately it's
just a test module so it doesn't matter much.

Currently objtool is the only user of OBJECT_FILES_NON_STANDARD, but it
might eventually be useful for other tools.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Chris J Arges <chris.j.arges@canonical.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Pedro Alves <palves@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: live-patching@vger.kernel.org
Link: http://lkml.kernel.org/r/366c080e3844e8a5b6a0327dc7e8c2b90ca3baeb.1456719558.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/boot/Makefile
arch/x86/boot/compressed/Makefile
arch/x86/entry/Makefile
arch/x86/entry/vdso/Makefile
arch/x86/kernel/Makefile
arch/x86/platform/efi/Makefile
arch/x86/purgatory/Makefile
arch/x86/realmode/Makefile
arch/x86/realmode/rm/Makefile
drivers/firmware/efi/libstub/Makefile
scripts/mod/Makefile

index bbe1a62efc021aadb29f27a1c7a68257b8478cef..0bf6749522d9fd3b843ca7e35eb9b170a3263730 100644 (file)
@@ -9,7 +9,8 @@
 # Changed by many, many contributors over the years.
 #
 
-KASAN_SANITIZE := n
+KASAN_SANITIZE                 := n
+OBJECT_FILES_NON_STANDARD      := y
 
 # If you want to preset the SVGA mode, uncomment the next line and
 # set SVGA_MODE to whatever number you want.
index f9ce75d80101cc7a620bed1169a1128056b9caa5..5e1d26e094076873c8f37b117de4588f568ccea5 100644 (file)
@@ -16,7 +16,8 @@
 #      (see scripts/Makefile.lib size_append)
 #      compressed vmlinux.bin.all + u32 size of vmlinux.bin.all
 
-KASAN_SANITIZE := n
+KASAN_SANITIZE                 := n
+OBJECT_FILES_NON_STANDARD      := y
 
 targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
        vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4
index bd55dedd7614aee2c38e5793a47c66197403f34c..fe91c25092da2662b67413a154e446843e7d5f7a 100644 (file)
@@ -1,6 +1,10 @@
 #
 # Makefile for the x86 low level entry code
 #
+
+OBJECT_FILES_NON_STANDARD_entry_$(BITS).o   := y
+OBJECT_FILES_NON_STANDARD_entry_64_compat.o := y
+
 obj-y                          := entry_$(BITS).o thunk_$(BITS).o syscall_$(BITS).o
 obj-y                          += common.o
 
index c854541d93ff66d71fa8b38d0d4f7f1ed9e16c15..f9fb859c98b974c138b045554b135275195d728f 100644 (file)
@@ -3,8 +3,9 @@
 #
 
 KBUILD_CFLAGS += $(DISABLE_LTO)
-KASAN_SANITIZE := n
-UBSAN_SANITIZE := n
+KASAN_SANITIZE                 := n
+UBSAN_SANITIZE                 := n
+OBJECT_FILES_NON_STANDARD      := y
 
 VDSO64-$(CONFIG_X86_64)                := y
 VDSOX32-$(CONFIG_X86_X32_ABI)  := y
@@ -16,6 +17,7 @@ vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o
 
 # files to link into kernel
 obj-y                          += vma.o
+OBJECT_FILES_NON_STANDARD_vma.o        := n
 
 # vDSO images to build
 vdso_img-$(VDSO64-y)           += 64
index b1b78ffe01d060a38c93c3c7486393702edd4ffc..d5fb0871aba3fcb3a556dae66255c8b185b7e32e 100644 (file)
@@ -16,9 +16,14 @@ CFLAGS_REMOVE_ftrace.o = -pg
 CFLAGS_REMOVE_early_printk.o = -pg
 endif
 
-KASAN_SANITIZE_head$(BITS).o := n
-KASAN_SANITIZE_dumpstack.o := n
-KASAN_SANITIZE_dumpstack_$(BITS).o := n
+KASAN_SANITIZE_head$(BITS).o                           := n
+KASAN_SANITIZE_dumpstack.o                             := n
+KASAN_SANITIZE_dumpstack_$(BITS).o                     := n
+
+OBJECT_FILES_NON_STANDARD_head_$(BITS).o               := y
+OBJECT_FILES_NON_STANDARD_relocate_kernel_$(BITS).o    := y
+OBJECT_FILES_NON_STANDARD_mcount_$(BITS).o             := y
+OBJECT_FILES_NON_STANDARD_test_nx.o                    := y
 
 CFLAGS_irq.o := -I$(src)/../include/asm/trace
 
index 2846aaab510352117b808f8eb16e4d9ff7002f32..066619b0700c91643c31c49f1cbc8f2d4899bb88 100644 (file)
@@ -1,3 +1,5 @@
+OBJECT_FILES_NON_STANDARD_efi_thunk_$(BITS).o := y
+
 obj-$(CONFIG_EFI)              += quirks.o efi.o efi_$(BITS).o efi_stub_$(BITS).o
 obj-$(CONFIG_ACPI_BGRT) += efi-bgrt.o
 obj-$(CONFIG_EARLY_PRINTK_EFI) += early_printk.o
index 2c835e356349b9284b6b6997fff19208b6dd1b61..92e3e1d84c1d73fb86b086b6ea8783ccf2f3663e 100644 (file)
@@ -1,3 +1,5 @@
+OBJECT_FILES_NON_STANDARD := y
+
 purgatory-y := purgatory.o stack.o setup-x86_$(BITS).o sha256.o entry64.o string.o
 
 targets += $(purgatory-y)
index e02c2c6c56a57a8a762c66d8e2f1f34315fa0410..682c895753d96a7c3a9b231cbf5f01dcbc8420ba 100644 (file)
@@ -6,7 +6,9 @@
 # for more details.
 #
 #
-KASAN_SANITIZE := n
+KASAN_SANITIZE                 := n
+OBJECT_FILES_NON_STANDARD      := y
+
 subdir- := rm
 
 obj-y += init.o
index 3e75fcf6b8362e7c43f24340a3836386a4d5ac48..053abe7b0ef760376f8a854d0fc1ace8edde2fd8 100644 (file)
@@ -6,7 +6,8 @@
 # for more details.
 #
 #
-KASAN_SANITIZE := n
+KASAN_SANITIZE                 := n
+OBJECT_FILES_NON_STANDARD      := y
 
 always := realmode.bin realmode.relocs
 
index aaf9c0bab42e8fc29e093da64f609d99064046fd..68fa977b2c1b7c182b9656d2c30c155fb26295c4 100644 (file)
@@ -23,6 +23,7 @@ KBUILD_CFLAGS                 := $(cflags-y) -DDISABLE_BRANCH_PROFILING \
 GCOV_PROFILE                   := n
 KASAN_SANITIZE                 := n
 UBSAN_SANITIZE                 := n
+OBJECT_FILES_NON_STANDARD      := y
 
 lib-y                          := efi-stub-helper.o
 
index c11212ff35105a66430d27c56b1f00de56c556fd..19d9bcadc0ccd448fd4cff3e687ec61e3f95001a 100644 (file)
@@ -1,3 +1,5 @@
+OBJECT_FILES_NON_STANDARD := y
+
 hostprogs-y    := modpost mk_elfconfig
 always         := $(hostprogs-y) empty.o
 
This page took 0.030195 seconds and 5 git commands to generate.