From c51ec9c1cb0ab5c9953c49869d7354bd6d1e1103 Mon Sep 17 00:00:00 2001 From: Borislav Petkov Date: Mon, 22 Mar 2021 10:41:26 +0800 Subject: [PATCH 2635/2944] x86/entry/64: Correct the comment over SAVE_AND_SET_GSBASE to #30648216 commit 0b2c605fa4ee3117c00b97b7af67791576b28f88 upstream. Add the proper explanation why an LFENCE is not needed in the FSGSBASE case. Fixes: 7c01912462a9 ("x86/entry/64: Handle FSGSBASE enabled paranoid entry/exit") Signed-off-by: Borislav Petkov Link: https://lkml.kernel.org/r/20200821090710.GE12181@zn.tnic Signed-off-by: Ethan Zhao Signed-off-by: Zelin Deng Reviewed-by: Artie Ding --- arch/x86/entry/entry_64.S | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index f92d984..8c661d26 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -1260,8 +1260,9 @@ ENTRY(paranoid_entry) * retrieve and set the current CPUs kernel GSBASE. The stored value * has to be restored in paranoid_exit unconditionally. * - * The MSR write ensures that no subsequent load is based on a - * mispredicted GSBASE. No extra FENCE required. + * The unconditional write to GS base below ensures that no subsequent + * loads based on a mispredicted GS base can happen, therefore no LFENCE + * is needed here. */ SAVE_AND_SET_GSBASE scratch_reg=%rax save_reg=%rbx ret -- 1.8.3.1