Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit c207aee

Browse files
jpoimboeIngo Molnar
authored andcommitted
objtool, x86: Add several functions and files to the objtool whitelist
In preparation for an objtool rewrite which will have broader checks, whitelist functions and files which cause problems because they do unusual things with the stack. These whitelists serve as a TODO list for which functions and files don't yet have undwarf unwinder coverage. Eventually most of the whitelists can be removed in favor of manual CFI hint annotations or objtool improvements. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Jiri Slaby <jslaby@suse.cz> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: live-patching@vger.kernel.org Link: http://lkml.kernel.org/r/7f934a5d707a574bda33ea282e9478e627fb1829.1498659915.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent dcc914f commit c207aee

File tree

15 files changed

+39
-6
lines changed

15 files changed

+39
-6
lines changed

arch/x86/crypto/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Arch-specific CryptoAPI modules.
33
#
44

5+
OBJECT_FILES_NON_STANDARD := y
6+
57
avx_supported := $(call as-instr,vpxor %xmm0$(comma)%xmm0$(comma)%xmm0,yes,no)
68
avx2_supported := $(call as-instr,vpgatherdd %ymm0$(comma)(%eax$(comma)%ymm1\
79
$(comma)4)$(comma)%ymm2,yes,no)

arch/x86/crypto/sha1-mb/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Arch-specific CryptoAPI modules.
33
#
44

5+
OBJECT_FILES_NON_STANDARD := y
6+
57
avx2_supported := $(call as-instr,vpgatherdd %ymm0$(comma)(%eax$(comma)%ymm1\
68
$(comma)4)$(comma)%ymm2,yes,no)
79
ifeq ($(avx2_supported),yes)

arch/x86/crypto/sha256-mb/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Arch-specific CryptoAPI modules.
33
#
44

5+
OBJECT_FILES_NON_STANDARD := y
6+
57
avx2_supported := $(call as-instr,vpgatherdd %ymm0$(comma)(%eax$(comma)%ymm1\
68
$(comma)4)$(comma)%ymm2,yes,no)
79
ifeq ($(avx2_supported),yes)

arch/x86/kernel/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ OBJECT_FILES_NON_STANDARD_head_$(BITS).o := y
2929
OBJECT_FILES_NON_STANDARD_relocate_kernel_$(BITS).o := y
3030
OBJECT_FILES_NON_STANDARD_ftrace_$(BITS).o := y
3131
OBJECT_FILES_NON_STANDARD_test_nx.o := y
32+
OBJECT_FILES_NON_STANDARD_paravirt_patch_$(BITS).o := y
3233

3334
# If instrumentation of this dir is enabled, boot hangs during first second.
3435
# Probably could be more selective here, but note that files related to irqs,

arch/x86/kernel/acpi/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
OBJECT_FILES_NON_STANDARD_wakeup_$(BITS).o := y
2+
13
obj-$(CONFIG_ACPI) += boot.o
24
obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_$(BITS).o
35
obj-$(CONFIG_ACPI_APEI) += apei.o

arch/x86/kernel/kprobes/opt.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <linux/kdebug.h>
2929
#include <linux/kallsyms.h>
3030
#include <linux/ftrace.h>
31+
#include <linux/frame.h>
3132

3233
#include <asm/text-patching.h>
3334
#include <asm/cacheflush.h>
@@ -94,6 +95,7 @@ static void synthesize_set_arg1(kprobe_opcode_t *addr, unsigned long val)
9495
}
9596

9697
asm (
98+
"optprobe_template_func:\n"
9799
".global optprobe_template_entry\n"
98100
"optprobe_template_entry:\n"
99101
#ifdef CONFIG_X86_64
@@ -131,7 +133,12 @@ asm (
131133
" popf\n"
132134
#endif
133135
".global optprobe_template_end\n"
134-
"optprobe_template_end:\n");
136+
"optprobe_template_end:\n"
137+
".type optprobe_template_func, @function\n"
138+
".size optprobe_template_func, .-optprobe_template_func\n");
139+
140+
void optprobe_template_func(void);
141+
STACK_FRAME_NON_STANDARD(optprobe_template_func);
135142

136143
#define TMPL_MOVE_IDX \
137144
((long)&optprobe_template_val - (long)&optprobe_template_entry)

arch/x86/kernel/reboot.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/sched.h>
1010
#include <linux/tboot.h>
1111
#include <linux/delay.h>
12+
#include <linux/frame.h>
1213
#include <acpi/reboot.h>
1314
#include <asm/io.h>
1415
#include <asm/apic.h>
@@ -123,6 +124,7 @@ void __noreturn machine_real_restart(unsigned int type)
123124
#ifdef CONFIG_APM_MODULE
124125
EXPORT_SYMBOL(machine_real_restart);
125126
#endif
127+
STACK_FRAME_NON_STANDARD(machine_real_restart);
126128

127129
/*
128130
* Some Apple MacBook and MacBookPro's needs reboot=p to be able to reboot

arch/x86/kvm/svm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <linux/slab.h>
3737
#include <linux/amd-iommu.h>
3838
#include <linux/hashtable.h>
39+
#include <linux/frame.h>
3940

4041
#include <asm/apic.h>
4142
#include <asm/perf_event.h>
@@ -4906,6 +4907,7 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
49064907

49074908
mark_all_clean(svm->vmcb);
49084909
}
4910+
STACK_FRAME_NON_STANDARD(svm_vcpu_run);
49094911

49104912
static void svm_set_cr3(struct kvm_vcpu *vcpu, unsigned long root)
49114913
{

arch/x86/kvm/vmx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <linux/slab.h>
3434
#include <linux/tboot.h>
3535
#include <linux/hrtimer.h>
36+
#include <linux/frame.h>
3637
#include "kvm_cache_regs.h"
3738
#include "x86.h"
3839

@@ -8652,6 +8653,7 @@ static void vmx_handle_external_intr(struct kvm_vcpu *vcpu)
86528653
);
86538654
}
86548655
}
8656+
STACK_FRAME_NON_STANDARD(vmx_handle_external_intr);
86558657

86568658
static bool vmx_has_high_real_mode_segbase(void)
86578659
{
@@ -9028,6 +9030,7 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
90289030
vmx_recover_nmi_blocking(vmx);
90299031
vmx_complete_interrupts(vmx);
90309032
}
9033+
STACK_FRAME_NON_STANDARD(vmx_vcpu_run);
90319034

90329035
static void vmx_switch_vmcs(struct kvm_vcpu *vcpu, struct loaded_vmcs *vmcs)
90339036
{

arch/x86/lib/msr-reg.S

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
.macro op_safe_regs op
1414
ENTRY(\op\()_safe_regs)
1515
pushq %rbx
16-
pushq %rbp
16+
pushq %r12
1717
movq %rdi, %r10 /* Save pointer */
1818
xorl %r11d, %r11d /* Return value */
1919
movl (%rdi), %eax
2020
movl 4(%rdi), %ecx
2121
movl 8(%rdi), %edx
2222
movl 12(%rdi), %ebx
23-
movl 20(%rdi), %ebp
23+
movl 20(%rdi), %r12d
2424
movl 24(%rdi), %esi
2525
movl 28(%rdi), %edi
2626
1: \op
@@ -29,10 +29,10 @@ ENTRY(\op\()_safe_regs)
2929
movl %ecx, 4(%r10)
3030
movl %edx, 8(%r10)
3131
movl %ebx, 12(%r10)
32-
movl %ebp, 20(%r10)
32+
movl %r12d, 20(%r10)
3333
movl %esi, 24(%r10)
3434
movl %edi, 28(%r10)
35-
popq %rbp
35+
popq %r12
3636
popq %rbx
3737
ret
3838
3:

0 commit comments

Comments
 (0)