mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Andy Lutomirski <luto@amacapital.net>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	Brian Gerst <brgerst@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH 2/4] x86/asm/entry: Untangle 'ia32_sysenter_target' into two entry points: entry_SYSENTER_32 and entry_SYSENTER_compat
Date: Mon,  8 Jun 2015 10:34:59 +0200	[thread overview]
Message-ID: <1433752501-15901-3-git-send-email-mingo@kernel.org> (raw)
In-Reply-To: <1433752501-15901-1-git-send-email-mingo@kernel.org>

So the SYSENTER instruction is pretty quirky and it has different behavior
depending on bitness and CPU maker.

Yet we create a false sense of coherency by naming it 'ia32_sysenter_target'
in both of the cases.

Split the name into its two uses:

	ia32_sysenter_target (32)    -> entry_SYSENTER_32
	ia32_sysenter_target (64)    -> entry_SYSENTER_compat

As per the generic naming scheme for x86 system call entry points:

	entry_MNEMONIC_qualifier

where 'qualifier' is one of _32, _64 or _compat.

Cc: Andy Lutomirski <luto@amacapital.net>
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: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/entry/entry_32.S        | 10 +++++-----
 arch/x86/entry/entry_64_compat.S |  4 ++--
 arch/x86/include/asm/proto.h     |  3 ++-
 arch/x86/kernel/cpu/common.c     |  4 ++--
 arch/x86/xen/xen-asm_64.S        |  2 +-
 5 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S
index 0ac73de925d1..a65f46c3b8e1 100644
--- a/arch/x86/entry/entry_32.S
+++ b/arch/x86/entry/entry_32.S
@@ -307,7 +307,7 @@ END(resume_kernel)
    the vsyscall page.  See vsyscall-sysentry.S, which defines the symbol.  */
 
 	# sysenter call handler stub
-ENTRY(ia32_sysenter_target)
+ENTRY(entry_SYSENTER_32)
 	movl TSS_sysenter_sp0(%esp),%esp
 sysenter_past_esp:
 	/*
@@ -412,7 +412,7 @@ ENTRY(ia32_sysenter_target)
 .popsection
 	_ASM_EXTABLE(1b,2b)
 	PTGS_TO_GS_EX
-ENDPROC(ia32_sysenter_target)
+ENDPROC(entry_SYSENTER_32)
 
 	# system call handler stub
 ENTRY(system_call)
@@ -1135,7 +1135,7 @@ END(page_fault)
 
 ENTRY(debug)
 	ASM_CLAC
-	cmpl $ia32_sysenter_target,(%esp)
+	cmpl $entry_SYSENTER_32,(%esp)
 	jne debug_stack_correct
 	FIX_STACK 12, debug_stack_correct, debug_esp_fix_insn
 debug_stack_correct:
@@ -1165,7 +1165,7 @@ ENTRY(nmi)
 	popl %eax
 	je nmi_espfix_stack
 #endif
-	cmpl $ia32_sysenter_target,(%esp)
+	cmpl $entry_SYSENTER_32,(%esp)
 	je nmi_stack_fixup
 	pushl %eax
 	movl %esp,%eax
@@ -1176,7 +1176,7 @@ ENTRY(nmi)
 	cmpl $(THREAD_SIZE-20),%eax
 	popl %eax
 	jae nmi_stack_correct
-	cmpl $ia32_sysenter_target,12(%esp)
+	cmpl $entry_SYSENTER_32,12(%esp)
 	je nmi_debug_stack_check
 nmi_stack_correct:
 	pushl %eax
diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S
index 8058892fb5ff..59840e33d203 100644
--- a/arch/x86/entry/entry_64_compat.S
+++ b/arch/x86/entry/entry_64_compat.S
@@ -57,7 +57,7 @@ ENDPROC(native_usergs_sysret32)
  * path below. We set up a complete hardware stack frame to share code
  * with the int 0x80 path.
  */
-ENTRY(ia32_sysenter_target)
+ENTRY(entry_SYSENTER_compat)
 	/*
 	 * Interrupts are off on entry.
 	 * We do not frame this tiny irq-off block with TRACE_IRQS_OFF/ON,
@@ -256,7 +256,7 @@ ENTRY(ia32_sysenter_target)
 
 	RESTORE_EXTRA_REGS
 	jmp	sysenter_do_call
-ENDPROC(ia32_sysenter_target)
+ENDPROC(entry_SYSENTER_compat)
 
 /*
  * 32-bit SYSCALL instruction entry.
diff --git a/arch/x86/include/asm/proto.h b/arch/x86/include/asm/proto.h
index 7d2961a231f1..83a7f8227949 100644
--- a/arch/x86/include/asm/proto.h
+++ b/arch/x86/include/asm/proto.h
@@ -10,7 +10,8 @@ void syscall_init(void);
 
 void entry_INT80_compat(void);
 void entry_SYSCALL_compat(void);
-void ia32_sysenter_target(void);
+void entry_SYSENTER_32(void);
+void entry_SYSENTER_compat(void);
 
 void x86_configure_nx(void);
 void x86_report_nx(void);
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index f0b85c401014..b2ae7cec33ca 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1026,7 +1026,7 @@ void enable_sep_cpu(void)
 	      (unsigned long)tss + offsetofend(struct tss_struct, SYSENTER_stack),
 	      0);
 
-	wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long)ia32_sysenter_target, 0);
+	wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long)entry_SYSENTER_32, 0);
 
 out:
 	put_cpu();
@@ -1216,7 +1216,7 @@ void syscall_init(void)
 	 */
 	wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS);
 	wrmsrl_safe(MSR_IA32_SYSENTER_ESP, 0ULL);
-	wrmsrl_safe(MSR_IA32_SYSENTER_EIP, (u64)ia32_sysenter_target);
+	wrmsrl_safe(MSR_IA32_SYSENTER_EIP, (u64)entry_SYSENTER_compat);
 #else
 	wrmsrl(MSR_CSTAR, ignore_sysret);
 	wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)GDT_ENTRY_INVALID_SEG);
diff --git a/arch/x86/xen/xen-asm_64.S b/arch/x86/xen/xen-asm_64.S
index 3c43c03a499c..ccac1b1e6e93 100644
--- a/arch/x86/xen/xen-asm_64.S
+++ b/arch/x86/xen/xen-asm_64.S
@@ -128,7 +128,7 @@ ENDPROC(xen_syscall32_target)
 /* 32-bit compat sysenter target */
 ENTRY(xen_sysenter_target)
 	undo_xen_syscall
-	jmp ia32_sysenter_target
+	jmp entry_SYSENTER_compat
 ENDPROC(xen_sysenter_target)
 
 #else /* !CONFIG_IA32_EMULATION */
-- 
2.1.4


  parent reply	other threads:[~2015-06-08  8:35 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-08  8:34 [PATCH 0/4] x86: Untangle and standardize x86 system call entry point names Ingo Molnar
2015-06-08  8:34 ` [PATCH 1/4] x86/asm/entry: Rename compat syscall entry points Ingo Molnar
2015-06-08  8:47   ` Borislav Petkov
2015-06-08  8:34 ` Ingo Molnar [this message]
2015-06-09  0:13   ` [PATCH 2/4] x86/asm/entry: Untangle 'ia32_sysenter_target' into two entry points: entry_SYSENTER_32 and entry_SYSENTER_compat Andy Lutomirski
2015-06-09  9:33     ` Ingo Molnar
2015-06-09 16:33       ` Andy Lutomirski
2015-06-08  8:35 ` [PATCH 3/4] x86/asm/entry: Untangle 'system_call' into two entry points: entry_SYSCALL_64 and entry_INT80_32 Ingo Molnar
2015-06-08  8:35 ` [PATCH 4/4] x86/asm/entry/32: Clean up entry_32.S Ingo Molnar
2015-06-08 13:14   ` Denys Vlasenko
2015-06-08 18:51     ` [PATCH] x86/asm/entry/64: Clean up entry_64.S Ingo Molnar
2015-07-06 15:00       ` Sasha Levin
2015-07-06 16:07         ` Ingo Molnar
2015-07-06 16:19           ` Sasha Levin
2015-07-06 16:23             ` Ingo Molnar
2015-07-06 16:36               ` Sasha Levin
2015-07-06 16:43                 ` Ingo Molnar
2015-07-06 17:02                   ` Sasha Levin
2015-07-06 17:20         ` Andy Lutomirski
2015-07-06 17:34           ` Sasha Levin
2015-07-06 17:41             ` Ingo Molnar
2015-07-06 18:35               ` Andy Lutomirski
2015-07-06 18:39                 ` Andy Lutomirski
2015-07-08 15:39                   ` Sasha Levin
2015-07-07  7:01                 ` Ingo Molnar
2015-07-09  0:59         ` Andy Lutomirski
2015-07-10 13:27           ` Sasha Levin
2015-07-10 15:26           ` Andrey Ryabinin
2015-07-10 15:36             ` Andy Lutomirski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1433752501-15901-3-git-send-email-mingo@kernel.org \
    --to=mingo@kernel.org \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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