1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * Common place for both 32- and 64-bit entry routines. 4 */ 5 6#include <linux/linkage.h> 7#include <asm/export.h> 8#include <asm/msr-index.h> 9#include <asm/unwind_hints.h> 10#include <asm/segment.h> 11#include <asm/cache.h> 12#include <asm/cpufeatures.h> 13#include <asm/nospec-branch.h> 14 15.pushsection .noinstr.text, "ax" 16 17SYM_FUNC_START(entry_ibpb) 18 movl $MSR_IA32_PRED_CMD, %ecx 19 movl $PRED_CMD_IBPB, %eax 20 xorl %edx, %edx 21 wrmsr 22 23 /* Make sure IBPB clears return stack preductions too. */ 24 FILL_RETURN_BUFFER %rax, RSB_CLEAR_LOOPS, X86_BUG_IBPB_NO_RET 25 RET 26SYM_FUNC_END(entry_ibpb) 27/* For KVM */ 28EXPORT_SYMBOL_GPL(entry_ibpb); 29 30.popsection 31 32/* 33 * Define the VERW operand that is disguised as entry code so that 34 * it can be referenced with KPTI enabled. This ensure VERW can be 35 * used late in exit-to-user path after page tables are switched. 36 */ 37.pushsection .entry.text, "ax" 38 39.align L1_CACHE_BYTES, 0xcc 40SYM_CODE_START_NOALIGN(mds_verw_sel) 41 UNWIND_HINT_UNDEFINED 42 ANNOTATE_NOENDBR 43 .word __KERNEL_DS 44.align L1_CACHE_BYTES, 0xcc 45SYM_CODE_END(mds_verw_sel); 46/* For KVM */ 47EXPORT_SYMBOL_GPL(mds_verw_sel); 48 49.popsection 50 51#ifndef CONFIG_X86_64 52/* 53 * Clang's implementation of TLS stack cookies requires the variable in 54 * question to be a TLS variable. If the variable happens to be defined as an 55 * ordinary variable with external linkage in the same compilation unit (which 56 * amounts to the whole of vmlinux with LTO enabled), Clang will drop the 57 * segment register prefix from the references, resulting in broken code. Work 58 * around this by avoiding the symbol used in -mstack-protector-guard-symbol= 59 * entirely in the C code, and use an alias emitted by the linker script 60 * instead. 61 */ 62#ifdef CONFIG_STACKPROTECTOR 63EXPORT_SYMBOL(__ref_stack_chk_guard); 64#endif 65#endif 66