Skip to content

Commit c0dd671

Browse files
jpoimboeingomolnar
authored andcommitted
objtool: Mark non-standard object files and directories
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>
1 parent 319e305 commit c0dd671

11 files changed

Lines changed: 32 additions & 9 deletions

File tree

‎arch/x86/boot/Makefile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
# Changed by many, many contributors over the years.
1010
#
1111

12-
KASAN_SANITIZE := n
12+
KASAN_SANITIZE := n
13+
OBJECT_FILES_NON_STANDARD := y
1314

1415
# If you want to preset the SVGA mode, uncomment the next line and
1516
# set SVGA_MODE to whatever number you want.

‎arch/x86/boot/compressed/Makefile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
# (see scripts/Makefile.lib size_append)
1717
# compressed vmlinux.bin.all + u32 size of vmlinux.bin.all
1818

19-
KASAN_SANITIZE := n
19+
KASAN_SANITIZE := n
20+
OBJECT_FILES_NON_STANDARD := y
2021

2122
targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
2223
vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4

‎arch/x86/entry/Makefile‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#
22
# Makefile for the x86 low level entry code
33
#
4+
5+
OBJECT_FILES_NON_STANDARD_entry_$(BITS).o := y
6+
OBJECT_FILES_NON_STANDARD_entry_64_compat.o := y
7+
48
obj-y := entry_$(BITS).o thunk_$(BITS).o syscall_$(BITS).o
59
obj-y += common.o
610

‎arch/x86/entry/vdso/Makefile‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
#
44

55
KBUILD_CFLAGS += $(DISABLE_LTO)
6-
KASAN_SANITIZE := n
7-
UBSAN_SANITIZE := n
6+
KASAN_SANITIZE := n
7+
UBSAN_SANITIZE := n
8+
OBJECT_FILES_NON_STANDARD := y
89

910
VDSO64-$(CONFIG_X86_64) := y
1011
VDSOX32-$(CONFIG_X86_X32_ABI) := y
@@ -16,6 +17,7 @@ vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o
1617

1718
# files to link into kernel
1819
obj-y += vma.o
20+
OBJECT_FILES_NON_STANDARD_vma.o := n
1921

2022
# vDSO images to build
2123
vdso_img-$(VDSO64-y) += 64

‎arch/x86/kernel/Makefile‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@ CFLAGS_REMOVE_ftrace.o = -pg
1616
CFLAGS_REMOVE_early_printk.o = -pg
1717
endif
1818

19-
KASAN_SANITIZE_head$(BITS).o := n
20-
KASAN_SANITIZE_dumpstack.o := n
21-
KASAN_SANITIZE_dumpstack_$(BITS).o := n
19+
KASAN_SANITIZE_head$(BITS).o := n
20+
KASAN_SANITIZE_dumpstack.o := n
21+
KASAN_SANITIZE_dumpstack_$(BITS).o := n
22+
23+
OBJECT_FILES_NON_STANDARD_head_$(BITS).o := y
24+
OBJECT_FILES_NON_STANDARD_relocate_kernel_$(BITS).o := y
25+
OBJECT_FILES_NON_STANDARD_mcount_$(BITS).o := y
26+
OBJECT_FILES_NON_STANDARD_test_nx.o := y
2227

2328
CFLAGS_irq.o := -I$(src)/../include/asm/trace
2429

‎arch/x86/platform/efi/Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
OBJECT_FILES_NON_STANDARD_efi_thunk_$(BITS).o := y
2+
13
obj-$(CONFIG_EFI) += quirks.o efi.o efi_$(BITS).o efi_stub_$(BITS).o
24
obj-$(CONFIG_ACPI_BGRT) += efi-bgrt.o
35
obj-$(CONFIG_EARLY_PRINTK_EFI) += early_printk.o

‎arch/x86/purgatory/Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
OBJECT_FILES_NON_STANDARD := y
2+
13
purgatory-y := purgatory.o stack.o setup-x86_$(BITS).o sha256.o entry64.o string.o
24

35
targets += $(purgatory-y)

‎arch/x86/realmode/Makefile‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
# for more details.
77
#
88
#
9-
KASAN_SANITIZE := n
9+
KASAN_SANITIZE := n
10+
OBJECT_FILES_NON_STANDARD := y
11+
1012
subdir- := rm
1113

1214
obj-y += init.o

‎arch/x86/realmode/rm/Makefile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
# for more details.
77
#
88
#
9-
KASAN_SANITIZE := n
9+
KASAN_SANITIZE := n
10+
OBJECT_FILES_NON_STANDARD := y
1011

1112
always := realmode.bin realmode.relocs
1213

‎drivers/firmware/efi/libstub/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ KBUILD_CFLAGS := $(cflags-y) -DDISABLE_BRANCH_PROFILING \
2323
GCOV_PROFILE := n
2424
KASAN_SANITIZE := n
2525
UBSAN_SANITIZE := n
26+
OBJECT_FILES_NON_STANDARD := y
2627

2728
lib-y := efi-stub-helper.o
2829

0 commit comments

Comments
 (0)