Skip to content

Commit 35ce463

Browse files
committed
Merge tag 'x86_urgent_for_v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fix from Borislav Petkov: - Make sure TF is cleared before calling other functions (BHI mitigation in this case) in the SYSENTER compat handler, as otherwise it will warn about being in single-step mode * tag 'x86_urgent_for_v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/bhi: Avoid warning in #DB handler due to BHI mitigation
2 parents 4d145e3 + ac8b270 commit 35ce463

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

arch/x86/entry/entry_64_compat.S

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,6 @@ SYM_INNER_LABEL(entry_SYSENTER_compat_after_hwframe, SYM_L_GLOBAL)
8989

9090
cld
9191

92-
IBRS_ENTER
93-
UNTRAIN_RET
94-
CLEAR_BRANCH_HISTORY
95-
9692
/*
9793
* SYSENTER doesn't filter flags, so we need to clear NT and AC
9894
* ourselves. To save a few cycles, we can check whether
@@ -116,6 +112,16 @@ SYM_INNER_LABEL(entry_SYSENTER_compat_after_hwframe, SYM_L_GLOBAL)
116112
jnz .Lsysenter_fix_flags
117113
.Lsysenter_flags_fixed:
118114

115+
/*
116+
* CPU bugs mitigations mechanisms can call other functions. They
117+
* should be invoked after making sure TF is cleared because
118+
* single-step is ignored only for instructions inside the
119+
* entry_SYSENTER_compat function.
120+
*/
121+
IBRS_ENTER
122+
UNTRAIN_RET
123+
CLEAR_BRANCH_HISTORY
124+
119125
movq %rsp, %rdi
120126
call do_SYSENTER_32
121127
jmp sysret32_from_system_call

0 commit comments

Comments
 (0)