aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/arch/x86/lib
diff options
context:
space:
mode:
authorPawan Gupta <pawan.kumar.gupta@linux.intel.com>2024-06-21 21:17:21 -0700
committerDave Hansen <dave.hansen@linux.intel.com>2025-05-09 13:22:05 -0700
commita75bf27fe41abe658c53276a0c486c4bf9adecfc (patch)
tree0898216e1eb51992a199696ed652042942ac11f9 /arch/x86/lib
parentx86/its: Add support for ITS-safe indirect thunk (diff)
downloadwireguard-linux-a75bf27fe41abe658c53276a0c486c4bf9adecfc.tar.xz
wireguard-linux-a75bf27fe41abe658c53276a0c486c4bf9adecfc.zip
x86/its: Add support for ITS-safe return thunk
RETs in the lower half of cacheline may be affected by ITS bug, specifically when the RSB-underflows. Use ITS-safe return thunk for such RETs. RETs that are not patched: - RET in retpoline sequence does not need to be patched, because the sequence itself fills an RSB before RET. - RET in Call Depth Tracking (CDT) thunks __x86_indirect_{call|jump}_thunk and call_depth_return_thunk are not patched because CDT by design prevents RSB-underflow. - RETs in .init section are not reachable after init. - RETs that are explicitly marked safe with ANNOTATE_UNRET_SAFE. Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Josh Poimboeuf <jpoimboe@kernel.org> Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Diffstat (limited to 'arch/x86/lib')
-rw-r--r--arch/x86/lib/retpoline.S13
1 files changed, 12 insertions, 1 deletions
diff --git a/arch/x86/lib/retpoline.S b/arch/x86/lib/retpoline.S
index a06891892853..ebca28fe7e31 100644
--- a/arch/x86/lib/retpoline.S
+++ b/arch/x86/lib/retpoline.S
@@ -393,7 +393,18 @@ SYM_CODE_START(__x86_indirect_its_thunk_array)
.align 64, 0xcc
SYM_CODE_END(__x86_indirect_its_thunk_array)
-#endif
+.align 64, 0xcc
+.skip 32, 0xcc
+SYM_CODE_START(its_return_thunk)
+ UNWIND_HINT_FUNC
+ ANNOTATE_NOENDBR
+ ANNOTATE_UNRET_SAFE
+ ret
+ int3
+SYM_CODE_END(its_return_thunk)
+EXPORT_SYMBOL(its_return_thunk)
+
+#endif /* CONFIG_MITIGATION_ITS */
/*
* This function name is magical and is used by -mfunction-return=thunk-extern