public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Gerst <brgerst@gmail.com>
To: x86@kernel.org, linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 1/7] x86/vdso32: Separate sigreturn code
Date: Sat, 29 Aug 2015 11:20:20 -0400	[thread overview]
Message-ID: <1440861626-27008-2-git-send-email-brgerst@gmail.com> (raw)
In-Reply-To: <1440861626-27008-1-git-send-email-brgerst@gmail.com>

Compile a separate sigreturn.o instead of including it in the three
syscall entry stub files.  Use alternatives to patch in a syscall
instruction when supported.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
 arch/x86/entry/vdso/Makefile           | 3 ++-
 arch/x86/entry/vdso/vdso32/int80.S     | 5 +----
 arch/x86/entry/vdso/vdso32/sigreturn.S | 9 +++++++--
 arch/x86/entry/vdso/vdso32/syscall.S   | 7 +------
 arch/x86/entry/vdso/vdso32/sysenter.S  | 5 +----
 5 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
index a3d0767..b4cd431 100644
--- a/arch/x86/entry/vdso/Makefile
+++ b/arch/x86/entry/vdso/Makefile
@@ -140,7 +140,7 @@ override obj-dirs = $(dir $(obj)) $(obj)/vdso32/
 
 targets += vdso32/vdso32.lds
 targets += vdso32/note.o vdso32/vclock_gettime.o $(vdso32.so-y:%=vdso32/%.o)
-targets += vdso32/vclock_gettime.o
+targets += vdso32/vclock_gettime.o vdso32/sigreturn.o
 
 $(obj)/vdso32.o: $(vdso32-images:%=$(obj)/%)
 
@@ -163,6 +163,7 @@ $(vdso32-images:%=$(obj)/%.dbg): $(obj)/vdso32-%.so.dbg: FORCE \
 				 $(obj)/vdso32/vdso32.lds \
 				 $(obj)/vdso32/vclock_gettime.o \
 				 $(obj)/vdso32/note.o \
+				 $(obj)/vdso32/sigreturn.o \
 				 $(obj)/vdso32/%.o
 	$(call if_changed,vdso)
 
diff --git a/arch/x86/entry/vdso/vdso32/int80.S b/arch/x86/entry/vdso/vdso32/int80.S
index b15b7c0..e40af1c 100644
--- a/arch/x86/entry/vdso/vdso32/int80.S
+++ b/arch/x86/entry/vdso/vdso32/int80.S
@@ -1,10 +1,7 @@
 /*
  * Code for the vDSO.  This version uses the old int $0x80 method.
- *
- * First get the common code for the sigreturn entry points.
- * This must come first.
  */
-#include "sigreturn.S"
+#include <linux/linkage.h>
 
 	.text
 	.globl __kernel_vsyscall
diff --git a/arch/x86/entry/vdso/vdso32/sigreturn.S b/arch/x86/entry/vdso/vdso32/sigreturn.S
index d7ec4e2..ca0e6ca 100644
--- a/arch/x86/entry/vdso/vdso32/sigreturn.S
+++ b/arch/x86/entry/vdso/vdso32/sigreturn.S
@@ -9,9 +9,14 @@
 #include <linux/linkage.h>
 #include <asm/unistd_32.h>
 #include <asm/asm-offsets.h>
+#include <asm/alternative-asm.h>
+#include <asm/cpufeature.h>
 
-#ifndef SYSCALL_ENTER_KERNEL
-#define	SYSCALL_ENTER_KERNEL	int $0x80
+#ifdef CONFIG_COMPAT
+#define SYSCALL_ENTER_KERNEL \
+	ALTERNATIVE "int $0x80", "syscall", X86_FEATURE_SYSCALL32
+#else
+#define SYSCALL_ENTER_KERNEL int $0x80
 #endif
 
 	.text
diff --git a/arch/x86/entry/vdso/vdso32/syscall.S b/arch/x86/entry/vdso/vdso32/syscall.S
index 6b286bb..75545ec 100644
--- a/arch/x86/entry/vdso/vdso32/syscall.S
+++ b/arch/x86/entry/vdso/vdso32/syscall.S
@@ -1,12 +1,7 @@
 /*
  * Code for the vDSO.  This version uses the syscall instruction.
- *
- * First get the common code for the sigreturn entry points.
- * This must come first.
  */
-#define SYSCALL_ENTER_KERNEL	syscall
-#include "sigreturn.S"
-
+#include <linux/linkage.h>
 #include <asm/segment.h>
 
 	.text
diff --git a/arch/x86/entry/vdso/vdso32/sysenter.S b/arch/x86/entry/vdso/vdso32/sysenter.S
index e354bce..e99c7699 100644
--- a/arch/x86/entry/vdso/vdso32/sysenter.S
+++ b/arch/x86/entry/vdso/vdso32/sysenter.S
@@ -1,10 +1,7 @@
 /*
  * Code for the vDSO.  This version uses the sysenter instruction.
- *
- * First get the common code for the sigreturn entry points.
- * This must come first.
  */
-#include "sigreturn.S"
+#include <linux/linkage.h>
 
 /*
  * The caller puts arg2 in %ecx, which gets pushed. The kernel will use
-- 
2.4.3


  reply	other threads:[~2015-08-29 15:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-29 15:20 [PATCH 0/7] x86 vdso32 cleanups Brian Gerst
2015-08-29 15:20 ` Brian Gerst [this message]
2015-08-29 15:20 ` [PATCH 2/7] x86/vdso32: Remove VDSO32_vsyscall_eh_frame_size Brian Gerst
2015-08-29 15:20 ` [PATCH 3/7] x86/vdso32: Remove unused vdso-fakesections.c Brian Gerst
2015-08-30 16:47   ` Andy Lutomirski
2015-08-29 15:20 ` [PATCH 4/7] x86/vdso32: Build single vdso32 image Brian Gerst
2015-08-29 15:20 ` [PATCH 5/7] x86/vdso: Merge 32-bit and 64-bit source files Brian Gerst
2015-08-29 15:20 ` [PATCH 6/7] x86/vdso32/xen: Move VDSO_NOTE_NONEGSEG_BIT define Brian Gerst
2015-08-29 15:20 ` [PATCH 7/7] x86/vdso32: Remove vdso32 subdirectory Brian Gerst
2015-08-29 16:10 ` [PATCH 0/7] x86 vdso32 cleanups Andy Lutomirski
2015-08-30 21:18   ` Brian Gerst
2015-08-31  2:52     ` Andy Lutomirski
     [not found]       ` <CALCETrVdaDuSuLLByWbFsEei6LYaxZK6qFtJAHZhRu3ZqUc+RQ@mail.gmail.com>
2015-09-01  1:37         ` Andy Lutomirski
2015-09-01 21:50           ` 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=1440861626-27008-2-git-send-email-brgerst@gmail.com \
    --to=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.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