[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-3e035305875cfa8a58c1ca573d0cfa6a7f201f27@git.kernel.org>
Date: Wed, 10 Aug 2016 11:10:51 -0700
From: tip-bot for Borislav Petkov <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: brgerst@...il.com, jpoimboe@...hat.com, tglx@...utronix.de,
torvalds@...ux-foundation.org, hpa@...or.com, dvlasenk@...hat.com,
peterz@...radead.org, mingo@...nel.org, luto@...nel.org,
linux-kernel@...r.kernel.org, bp@...en8.de, bp@...e.de,
luto@...capital.net
Subject: [tip:x86/urgent] x86/entry: Clarify the RF saving/restoring
situation with SYSCALL/SYSRET
Commit-ID: 3e035305875cfa8a58c1ca573d0cfa6a7f201f27
Gitweb: http://git.kernel.org/tip/3e035305875cfa8a58c1ca573d0cfa6a7f201f27
Author: Borislav Petkov <bp@...en8.de>
AuthorDate: Wed, 3 Aug 2016 19:14:29 +0200
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Wed, 10 Aug 2016 15:53:43 +0200
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@...e.de>
Acked-by: Andy Lutomirski <luto@...capital.net>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Brian Gerst <brgerst@...il.com>
Cc: Denys Vlasenko <dvlasenk@...hat.com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Link: http://lkml.kernel.org/r/20160803171429.GA2590@nazgul.tnic
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
arch/x86/entry/entry_64.S | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 9f85827..d172c61 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -288,11 +288,15 @@ return_from_SYSCALL_64:
jne opportunistic_sysret_failed
/*
- * SYSRET can't restore RF. SYSRET can restore TF, but unlike IRET,
- * restoring TF results in a trap from userspace immediately after
- * SYSRET. This would cause an infinite loop whenever #DB happens
- * with register state that satisfies the opportunistic SYSRET
- * conditions. For example, single-stepping this user code:
+ * SYSCALL clears RF when it saves RFLAGS in R11 and SYSRET cannot
+ * restore RF properly. If the slowpath sets it for whatever reason, we
+ * need to restore it correctly.
+ *
+ * SYSRET can restore TF, but unlike IRET, restoring TF results in a
+ * trap from userspace immediately after SYSRET. This would cause an
+ * infinite loop whenever #DB happens with register state that satisfies
+ * the opportunistic SYSRET conditions. For example, single-stepping
+ * this user code:
*
* movq $stuck_here, %rcx
* pushfq
Powered by blists - more mailing lists