mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/entry/64: Drop idtentry's manual stack switch for user entries
@ 2018-04-03 22:39 Andy Lutomirski
  2018-04-09 16:20 ` Andy Lutomirski
  2018-04-09 17:11 ` [tip:x86/pti] " tip-bot for Andy Lutomirski
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Lutomirski @ 2018-04-03 22:39 UTC (permalink / raw)
  To: x86, LKML; +Cc: Borislav Petkov, Dominik Brodowski, Andy Lutomirski

For non-paranoid entries, idtentry knows how to switch from the
kernel stack to the user stack, as does error_entry.  This results
in pointless duplication and code bloat.  Make idtentry stop
thinking about stacks for non-paranoid entries.

This reduces text size by 5377 bytes.

This goes back to commit 7f2590a110b8 ("x86/entry/64: Use a per-CPU
trampoline stack for IDT entries").

Signed-off-by: Andy Lutomirski <luto@kernel.org>
---

Hi all-

I have more cleanups in the works, but this is enough of I win by itself
that I wanted to get it out there.

 arch/x86/entry/entry_64.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 9b114675fbc0..e237913a056b 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -908,7 +908,7 @@ ENTRY(\sym)
 	pushq	$-1				/* ORIG_RAX: no syscall to restart */
 	.endif
 
-	.if \paranoid < 2
+	.if \paranoid == 1
 	testb	$3, CS-ORIG_RAX(%rsp)		/* If coming from userspace, switch stacks */
 	jnz	.Lfrom_usermode_switch_stack_\@
 	.endif
@@ -955,7 +955,7 @@ ENTRY(\sym)
 	jmp	error_exit
 	.endif
 
-	.if \paranoid < 2
+	.if \paranoid == 1
 	/*
 	 * Entry from userspace.  Switch stacks and treat it
 	 * as a normal entry.  This means that paranoid handlers
-- 
2.14.3

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

* Re: [PATCH] x86/entry/64: Drop idtentry's manual stack switch for user entries
  2018-04-03 22:39 [PATCH] x86/entry/64: Drop idtentry's manual stack switch for user entries Andy Lutomirski
@ 2018-04-09 16:20 ` Andy Lutomirski
  2018-04-09 16:29   ` Ingo Molnar
  2018-04-09 17:11 ` [tip:x86/pti] " tip-bot for Andy Lutomirski
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Lutomirski @ 2018-04-09 16:20 UTC (permalink / raw)
  To: Andy Lutomirski; +Cc: X86 ML, LKML, Borislav Petkov, Dominik Brodowski

On Tue, Apr 3, 2018 at 3:39 PM, Andy Lutomirski <luto@kernel.org> wrote:
> For non-paranoid entries, idtentry knows how to switch from the
> kernel stack to the user stack, as does error_entry.  This results
> in pointless duplication and code bloat.  Make idtentry stop
> thinking about stacks for non-paranoid entries.
>
> This reduces text size by 5377 bytes.
>

Just a quick ping to make sure you all noticed this.

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

* Re: [PATCH] x86/entry/64: Drop idtentry's manual stack switch for user entries
  2018-04-09 16:20 ` Andy Lutomirski
@ 2018-04-09 16:29   ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2018-04-09 16:29 UTC (permalink / raw)
  To: Andy Lutomirski
  Cc: X86 ML, LKML, Borislav Petkov, Dominik Brodowski, Peter Zijlstra


* Andy Lutomirski <luto@kernel.org> wrote:

> On Tue, Apr 3, 2018 at 3:39 PM, Andy Lutomirski <luto@kernel.org> wrote:
> > For non-paranoid entries, idtentry knows how to switch from the
> > kernel stack to the user stack, as does error_entry.  This results
> > in pointless duplication and code bloat.  Make idtentry stop
> > thinking about stacks for non-paranoid entries.
> >
> > This reduces text size by 5377 bytes.
> >
> 
> Just a quick ping to make sure you all noticed this.

LOL, incidentally I have applied it a couple of minutes ago! :-)

Thanks

	Ingo

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

* [tip:x86/pti] x86/entry/64: Drop idtentry's manual stack switch for user entries
  2018-04-03 22:39 [PATCH] x86/entry/64: Drop idtentry's manual stack switch for user entries Andy Lutomirski
  2018-04-09 16:20 ` Andy Lutomirski
@ 2018-04-09 17:11 ` tip-bot for Andy Lutomirski
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Andy Lutomirski @ 2018-04-09 17:11 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: luto, linux-kernel, torvalds, mingo, peterz, linux, hpa, tglx, bp

Commit-ID:  071ccc966ba5db1ac8f5c24b0faebb37698f68db
Gitweb:     https://git.kernel.org/tip/071ccc966ba5db1ac8f5c24b0faebb37698f68db
Author:     Andy Lutomirski <luto@kernel.org>
AuthorDate: Tue, 3 Apr 2018 15:39:26 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 9 Apr 2018 18:23:50 +0200

x86/entry/64: Drop idtentry's manual stack switch for user entries

For non-paranoid entries, idtentry knows how to switch from the
kernel stack to the user stack, as does error_entry.  This results
in pointless duplication and code bloat.  Make idtentry stop
thinking about stacks for non-paranoid entries.

This reduces text size by 5377 bytes.

This goes back to the following commit:

  7f2590a110b8 ("x86/entry/64: Use a per-CPU trampoline stack for IDT entries")

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
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/90aab80c1f906e70742eaa4512e3c9b5e62d59d4.1522794757.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/entry/entry_64.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 9b114675fbc0..e237913a056b 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -908,7 +908,7 @@ ENTRY(\sym)
 	pushq	$-1				/* ORIG_RAX: no syscall to restart */
 	.endif
 
-	.if \paranoid < 2
+	.if \paranoid == 1
 	testb	$3, CS-ORIG_RAX(%rsp)		/* If coming from userspace, switch stacks */
 	jnz	.Lfrom_usermode_switch_stack_\@
 	.endif
@@ -955,7 +955,7 @@ ENTRY(\sym)
 	jmp	error_exit
 	.endif
 
-	.if \paranoid < 2
+	.if \paranoid == 1
 	/*
 	 * Entry from userspace.  Switch stacks and treat it
 	 * as a normal entry.  This means that paranoid handlers

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

end of thread, other threads:[~2018-04-09 17:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-03 22:39 [PATCH] x86/entry/64: Drop idtentry's manual stack switch for user entries Andy Lutomirski
2018-04-09 16:20 ` Andy Lutomirski
2018-04-09 16:29   ` Ingo Molnar
2018-04-09 17:11 ` [tip:x86/pti] " tip-bot for Andy Lutomirski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome