aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/entry/entry_64.S
diff options
context:
space:
mode:
authorBorislav Petkov <bp@alien8.de>2016-08-03 13:14:29 -0400
committerIngo Molnar <mingo@kernel.org>2016-08-10 09:53:43 -0400
commit3e035305875cfa8a58c1ca573d0cfa6a7f201f27 (patch)
tree36abe0cf08dfd0b70504ce5c23c167e767a6dd83 /arch/x86/entry/entry_64.S
parent5cf0791da5c162ebc14b01eb01631cfa7ed4fa6e (diff)
x86/entry: Clarify the RF saving/restoring situation with SYSCALL/SYSRET
Clarify why exactly RF cannot be restored properly by SYSRET to avoid confusion. No functionality change. Signed-off-by: Borislav Petkov <bp@suse.de> Acked-by: Andy Lutomirski <luto@amacapital.net> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/20160803171429.GA2590@nazgul.tnic Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/entry/entry_64.S')
-rw-r--r--arch/x86/entry/entry_64.S14
1 files changed, 9 insertions, 5 deletions
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 9f85827db24e..d172c619c449 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -288,11 +288,15 @@ return_from_SYSCALL_64:
288 jne opportunistic_sysret_failed 288 jne opportunistic_sysret_failed
289 289
290 /* 290 /*
291 * SYSRET can't restore RF. SYSRET can restore TF, but unlike IRET, 291 * SYSCALL clears RF when it saves RFLAGS in R11 and SYSRET cannot
292 * restoring TF results in a trap from userspace immediately after 292 * restore RF properly. If the slowpath sets it for whatever reason, we
293 * SYSRET. This would cause an infinite loop whenever #DB happens 293 * need to restore it correctly.
294 * with register state that satisfies the opportunistic SYSRET 294 *
295 * conditions. For example, single-stepping this user code: 295 * SYSRET can restore TF, but unlike IRET, restoring TF results in a
296 * trap from userspace immediately after SYSRET. This would cause an
297 * infinite loop whenever #DB happens with register state that satisfies
298 * the opportunistic SYSRET conditions. For example, single-stepping
299 * this user code:
296 * 300 *
297 * movq $stuck_here, %rcx 301 * movq $stuck_here, %rcx
298 * pushfq 302 * pushfq