All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/entry/64: Further improve paranoid_entry comments
@ 2018-10-14 18:38 Andy Lutomirski
  2018-10-16  6:21 ` [tip:x86/urgent] " tip-bot for Andy Lutomirski
  2018-10-18  6:21 ` tip-bot for Andy Lutomirski
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Lutomirski @ 2018-10-14 18:38 UTC (permalink / raw)
  To: x86; +Cc: LKML, Andy Lutomirski, Dave Hansen, Thomas Gleixner, Borislav Petkov

Commit 16561f27f94e ("x86/entry: Add some paranoid entry/exit CR3
handling comments") added some comments.  This improves them a bit:

 - When I first read the new comments, it was unclear to me whether
   they were referring to the case where paranoid_entry interrupted
   other entry code or where paranoid_entry was itself interrupted.
   Clarify it.

 - Remove the EBX comment.  We no longer use EBX as a SWAPGS
   indicator.

Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.come
Cc: Borislav Petkov <bp@alien8.de>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
 arch/x86/entry/entry_64.S | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 1d9b4a300c8c..f95dcb209fdf 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -1189,15 +1189,13 @@ ENTRY(paranoid_entry)
 1:
 	/*
 	 * Always stash CR3 in %r14.  This value will be restored,
-	 * verbatim, at exit.  Needed if kernel is interrupted
-	 * after switching to the user CR3 value but before
-	 * returning to userspace.
+	 * verbatim, at exit.  Needed if paranoid_entry interrupted
+	 * another entry that already switched to the user CR3 value
+	 * but has not yet returned to userspace.
 	 *
 	 * This is also why CS (stashed in the "iret frame" by the
 	 * hardware at entry) can not be used: this may be a return
-	 * to kernel code, but with a user CR3 value.  The %ebx flag
-	 * for SWAPGS is also unusable for CR3 because there is a
-	 * window with a user GS and a kernel CR3.
+	 * to kernel code, but with a user CR3 value.
 	 */
 	SAVE_AND_SWITCH_TO_KERNEL_CR3 scratch_reg=%rax save_reg=%r14
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip:x86/urgent] x86/entry/64: Further improve paranoid_entry comments
  2018-10-14 18:38 [PATCH] x86/entry/64: Further improve paranoid_entry comments Andy Lutomirski
@ 2018-10-16  6:21 ` tip-bot for Andy Lutomirski
  2018-10-18  6:21 ` tip-bot for Andy Lutomirski
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Andy Lutomirski @ 2018-10-16  6:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: dave.hansen, luto, mingo, torvalds, linux-kernel, bp, hpa, peterz, tglx

Commit-ID:  0cd6fa95a4a44ff2d649957423946c19eb98e825
Gitweb:     https://git.kernel.org/tip/0cd6fa95a4a44ff2d649957423946c19eb98e825
Author:     Andy Lutomirski <luto@kernel.org>
AuthorDate: Sun, 14 Oct 2018 11:38:18 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 16 Oct 2018 08:19:34 +0200

x86/entry/64: Further improve paranoid_entry comments

Commit:

  16561f27f94e ("x86/entry: Add some paranoid entry/exit CR3 handling comments")

... added some comments.  This improves them a bit:

 - When I first read the new comments, it was unclear to me whether
   they were referring to the case where paranoid_entry interrupted
   other entry code or where paranoid_entry was itself interrupted.
   Clarify it.

 - Remove the EBX comment.  We no longer use EBX as a SWAPGS
   indicator.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/c47daa1888dc2298e7e1d3f82bd76b776ea33393.1539542111.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/entry/entry_64.S | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 1d9b4a300c8c..f95dcb209fdf 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -1189,15 +1189,13 @@ ENTRY(paranoid_entry)
 1:
 	/*
 	 * Always stash CR3 in %r14.  This value will be restored,
-	 * verbatim, at exit.  Needed if kernel is interrupted
-	 * after switching to the user CR3 value but before
-	 * returning to userspace.
+	 * verbatim, at exit.  Needed if paranoid_entry interrupted
+	 * another entry that already switched to the user CR3 value
+	 * but has not yet returned to userspace.
 	 *
 	 * This is also why CS (stashed in the "iret frame" by the
 	 * hardware at entry) can not be used: this may be a return
-	 * to kernel code, but with a user CR3 value.  The %ebx flag
-	 * for SWAPGS is also unusable for CR3 because there is a
-	 * window with a user GS and a kernel CR3.
+	 * to kernel code, but with a user CR3 value.
 	 */
 	SAVE_AND_SWITCH_TO_KERNEL_CR3 scratch_reg=%rax save_reg=%r14
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip:x86/urgent] x86/entry/64: Further improve paranoid_entry comments
  2018-10-14 18:38 [PATCH] x86/entry/64: Further improve paranoid_entry comments Andy Lutomirski
  2018-10-16  6:21 ` [tip:x86/urgent] " tip-bot for Andy Lutomirski
@ 2018-10-18  6:21 ` tip-bot for Andy Lutomirski
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Andy Lutomirski @ 2018-10-18  6:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, peterz, mingo, torvalds, luto, tglx, bp, dave.hansen

Commit-ID:  ae852495be365f6be433dde6629d3f0316f8efde
Gitweb:     https://git.kernel.org/tip/ae852495be365f6be433dde6629d3f0316f8efde
Author:     Andy Lutomirski <luto@kernel.org>
AuthorDate: Sun, 14 Oct 2018 11:38:18 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 17 Oct 2018 12:30:27 +0200

x86/entry/64: Further improve paranoid_entry comments

Commit:

  16561f27f94e ("x86/entry: Add some paranoid entry/exit CR3 handling comments")

... added some comments.  This improves them a bit:

 - When I first read the new comments, it was unclear to me whether
   they were referring to the case where paranoid_entry interrupted
   other entry code or where paranoid_entry was itself interrupted.
   Clarify it.

 - Remove the EBX comment.  We no longer use EBX as a SWAPGS
   indicator.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/c47daa1888dc2298e7e1d3f82bd76b776ea33393.1539542111.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/entry/entry_64.S | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 1d9b4a300c8c..f95dcb209fdf 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -1189,15 +1189,13 @@ ENTRY(paranoid_entry)
 1:
 	/*
 	 * Always stash CR3 in %r14.  This value will be restored,
-	 * verbatim, at exit.  Needed if kernel is interrupted
-	 * after switching to the user CR3 value but before
-	 * returning to userspace.
+	 * verbatim, at exit.  Needed if paranoid_entry interrupted
+	 * another entry that already switched to the user CR3 value
+	 * but has not yet returned to userspace.
 	 *
 	 * This is also why CS (stashed in the "iret frame" by the
 	 * hardware at entry) can not be used: this may be a return
-	 * to kernel code, but with a user CR3 value.  The %ebx flag
-	 * for SWAPGS is also unusable for CR3 because there is a
-	 * window with a user GS and a kernel CR3.
+	 * to kernel code, but with a user CR3 value.
 	 */
 	SAVE_AND_SWITCH_TO_KERNEL_CR3 scratch_reg=%rax save_reg=%r14
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-18  6:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-14 18:38 [PATCH] x86/entry/64: Further improve paranoid_entry comments Andy Lutomirski
2018-10-16  6:21 ` [tip:x86/urgent] " tip-bot for Andy Lutomirski
2018-10-18  6:21 ` tip-bot for Andy Lutomirski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.