Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'objtool-urgent-2022-06-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull objtool fixes from Thomas Gleixner:

- Handle __ubsan_handle_builtin_unreachable() correctly and treat it as
noreturn

- Allow architectures to select uaccess validation

- Use the non-instrumented bit test for test_cpu_has() to prevent
escape from non-instrumentable regions

- Use arch_ prefixed atomics for JUMP_LABEL=n builds to prevent escape
from non-instrumentable regions

- Mark a few tiny inline as __always_inline to prevent GCC from
bringing them out of line and instrumenting them

- Mark the empty stub context_tracking_enabled() as always inline as
GCC brings them out of line and instruments the empty shell

- Annotate ex_handler_msr_mce() as dead end

* tag 'objtool-urgent-2022-06-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/extable: Annotate ex_handler_msr_mce() as a dead end
context_tracking: Always inline empty stubs
x86: Always inline on_thread_stack() and current_top_of_stack()
jump_label,noinstr: Avoid instrumentation for JUMP_LABEL=n builds
x86/cpu: Elide KCSAN for cpu_has() and friends
objtool: Mark __ubsan_handle_builtin_unreachable() as noreturn
objtool: Add CONFIG_HAVE_UACCESS_VALIDATION

+24 -13
+4
arch/Kconfig
··· 1048 1048 config HAVE_NOINSTR_VALIDATION 1049 1049 bool 1050 1050 1051 + config HAVE_UACCESS_VALIDATION 1052 + bool 1053 + select OBJTOOL 1054 + 1051 1055 config HAVE_STACK_VALIDATION 1052 1056 bool 1053 1057 help
+1
arch/x86/Kconfig
··· 258 258 select HAVE_PREEMPT_DYNAMIC_CALL 259 259 select HAVE_RSEQ 260 260 select HAVE_SYSCALL_TRACEPOINTS 261 + select HAVE_UACCESS_VALIDATION if HAVE_OBJTOOL 261 262 select HAVE_UNSTABLE_SCHED_CLOCK 262 263 select HAVE_USER_RETURN_NOTIFIER 263 264 select HAVE_GENERIC_VDSO
+1 -1
arch/x86/include/asm/cpufeature.h
··· 54 54 extern const char * const x86_bug_flags[NBUGINTS*32]; 55 55 56 56 #define test_cpu_cap(c, bit) \ 57 - test_bit(bit, (unsigned long *)((c)->x86_capability)) 57 + arch_test_bit(bit, (unsigned long *)((c)->x86_capability)) 58 58 59 59 /* 60 60 * There are 32 bits/features in each mask word. The high bits
+6 -2
arch/x86/include/asm/extable.h
··· 42 42 extern void early_fixup_exception(struct pt_regs *regs, int trapnr); 43 43 44 44 #ifdef CONFIG_X86_MCE 45 - extern void ex_handler_msr_mce(struct pt_regs *regs, bool wrmsr); 45 + extern void __noreturn ex_handler_msr_mce(struct pt_regs *regs, bool wrmsr); 46 46 #else 47 - static inline void ex_handler_msr_mce(struct pt_regs *regs, bool wrmsr) { } 47 + static inline void __noreturn ex_handler_msr_mce(struct pt_regs *regs, bool wrmsr) 48 + { 49 + for (;;) 50 + cpu_relax(); 51 + } 48 52 #endif 49 53 50 54 #if defined(CONFIG_BPF_JIT) && defined(CONFIG_X86_64)
+2 -2
arch/x86/include/asm/processor.h
··· 559 559 #endif 560 560 } 561 561 562 - static inline unsigned long current_top_of_stack(void) 562 + static __always_inline unsigned long current_top_of_stack(void) 563 563 { 564 564 /* 565 565 * We can't read directly from tss.sp0: sp0 on x86_32 is special in ··· 569 569 return this_cpu_read_stable(cpu_current_top_of_stack); 570 570 } 571 571 572 - static inline bool on_thread_stack(void) 572 + static __always_inline bool on_thread_stack(void) 573 573 { 574 574 return (unsigned long)(current_top_of_stack() - 575 575 current_stack_pointer) < THREAD_SIZE;
+4 -4
include/linux/context_tracking_state.h
··· 46 46 return __this_cpu_read(context_tracking.state) == CONTEXT_USER; 47 47 } 48 48 #else 49 - static inline bool context_tracking_in_user(void) { return false; } 50 - static inline bool context_tracking_enabled(void) { return false; } 51 - static inline bool context_tracking_enabled_cpu(int cpu) { return false; } 52 - static inline bool context_tracking_enabled_this_cpu(void) { return false; } 49 + static __always_inline bool context_tracking_in_user(void) { return false; } 50 + static __always_inline bool context_tracking_enabled(void) { return false; } 51 + static __always_inline bool context_tracking_enabled_cpu(int cpu) { return false; } 52 + static __always_inline bool context_tracking_enabled_this_cpu(void) { return false; } 53 53 #endif /* CONFIG_CONTEXT_TRACKING */ 54 54 55 55 #endif
+2 -2
include/linux/jump_label.h
··· 256 256 #include <linux/atomic.h> 257 257 #include <linux/bug.h> 258 258 259 - static inline int static_key_count(struct static_key *key) 259 + static __always_inline int static_key_count(struct static_key *key) 260 260 { 261 - return atomic_read(&key->enabled); 261 + return arch_atomic_read(&key->enabled); 262 262 } 263 263 264 264 static __always_inline void jump_label_init(void)
+1 -1
scripts/Makefile.lib
··· 239 239 $(if $(CONFIG_SLS), --sls) \ 240 240 $(if $(CONFIG_STACK_VALIDATION), --stackval) \ 241 241 $(if $(CONFIG_HAVE_STATIC_CALL_INLINE), --static-call) \ 242 - --uaccess \ 242 + $(if $(CONFIG_HAVE_UACCESS_VALIDATION), --uaccess) \ 243 243 $(if $(delay-objtool), --link) \ 244 244 $(if $(part-of-module), --module) \ 245 245 $(if $(CONFIG_GCOV_KERNEL), --no-unreachable)
+3 -1
tools/objtool/check.c
··· 185 185 "do_group_exit", 186 186 "stop_this_cpu", 187 187 "__invalid_creds", 188 - "cpu_startup_entry", 188 + "cpu_startup_entry", 189 + "__ubsan_handle_builtin_unreachable", 190 + "ex_handler_msr_mce", 189 191 }; 190 192 191 193 if (!func)