Commit a3ba9660 authored by Thomas Gleixner's avatar Thomas Gleixner

x86/entry/32: Clarify register saving in __switch_to_asm()

commit 6690e86b ("sched/x86: Save [ER]FLAGS on context switch")
re-introduced the flags saving on context switch to prevent AC leakage.

The pushf/popf instructions are right among the callee saved register
section, so the comment explaining the save/restore is not entirely
correct.

Add a seperate comment to pushf/popf explaining the reason.
Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent e638ad00
...@@ -718,6 +718,11 @@ ENTRY(__switch_to_asm) ...@@ -718,6 +718,11 @@ ENTRY(__switch_to_asm)
pushl %ebx pushl %ebx
pushl %edi pushl %edi
pushl %esi pushl %esi
/*
* Flags are saved to prevent AC leakage. This could go
* away if objtool would have 32bit support to verify
* the STAC/CLAC correctness.
*/
pushfl pushfl
/* switch stack */ /* switch stack */
...@@ -740,8 +745,9 @@ ENTRY(__switch_to_asm) ...@@ -740,8 +745,9 @@ ENTRY(__switch_to_asm)
FILL_RETURN_BUFFER %ebx, RSB_CLEAR_LOOPS, X86_FEATURE_RSB_CTXSW FILL_RETURN_BUFFER %ebx, RSB_CLEAR_LOOPS, X86_FEATURE_RSB_CTXSW
#endif #endif
/* restore callee-saved registers */ /* Restore flags or the incoming task to restore AC state. */
popfl popfl
/* restore callee-saved registers */
popl %esi popl %esi
popl %edi popl %edi
popl %ebx popl %ebx
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment