Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753435AbbH2PWy (ORCPT ); Sat, 29 Aug 2015 11:22:54 -0400 Received: from mail-yk0-f182.google.com ([209.85.160.182]:35983 "EHLO mail-yk0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752763AbbH2PUi (ORCPT ); Sat, 29 Aug 2015 11:20:38 -0400 From: Brian Gerst To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: Ingo Molnar , "H. Peter Anvin" , Denys Vlasenko , Andy Lutomirski , Linus Torvalds Subject: [PATCH 1/7] x86/vdso32: Separate sigreturn code Date: Sat, 29 Aug 2015 11:20:20 -0400 Message-Id: <1440861626-27008-2-git-send-email-brgerst@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1440861626-27008-1-git-send-email-brgerst@gmail.com> References: <1440861626-27008-1-git-send-email-brgerst@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3689 Lines: 113 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 --- 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 .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 #include #include +#include +#include -#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 #include .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 /* * The caller puts arg2 in %ecx, which gets pushed. The kernel will use -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/