Skip to contentSkip to conversation

x86/headers changes for v4.4

GIT PULL Ingo Molnar 1 participant 1 message Nov 3, 2015 x86

lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest x86-headers-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-headers-for-linus

# HEAD: 0e2815de552a638295cfdaf0865e575573bf263e x86/headers: Clean up too long lines

This series reorganizes and cleans up various aspects of the main sigcontext UAPI headers, such as unifying the data structures and updating/adding lots of comments to explain all the ABI details an quirks. The headers can now also be built in user-space standalone.

Thanks,

Ingo

------------------>
Ingo Molnar (15):
x86/headers: Fix (old) header file dependency bug in uapi/asm/sigcontext32.h x86/headers: Clean up uapi/asm/sigcontext32.h
x86/headers: Clean up and better document uapi/asm/sigcontext.h x86/headers: Separate out legacy user-space structure definitions x86/headers: Use ABI types consistently in sigcontext*.h x86/headers: Unify register type definitions between 32-bit compat and i386 x86/headers: Unify 'struct _fpstate_ia32' and i386 struct _fpstate x86/headers: Convert uses of _fpstate_ia32 to _fpstate_32 x86/headers: Clean up the kernel's struct sigcontext types to be ABI-clean x86/headers: Move the 'struct sigcontext' definitions into the UAPI header x86/headers: Make sigcontext pointers bit independent x86/headers: Unify 'struct sigcontext_ia32' and 'struct sigcontext_32' x86/headers: Convert sigcontext_ia32 uses to sigcontext_32 x86/headers: Remove direct sigcontext32.h uses
x86/headers: Remove <asm/sigcontext.h> references on the kernel side

Peter Zijlstra (1):
x86/headers: Clean up too long lines

 arch/x86/ia32/ia32_signal.c              |   8 +-
 arch/x86/include/asm/fpu/signal.h        |   2 +-
 arch/x86/include/asm/ia32.h              |   4 +-
 arch/x86/include/asm/processor.h         |   2 +-
 arch/x86/include/asm/sigcontext.h        |  75 +----
 arch/x86/include/asm/sigframe.h          |   8 +-
 arch/x86/include/asm/signal.h            |   2 +-
 arch/x86/include/uapi/asm/sigcontext.h   | 475 ++++++++++++++++++++-----------
 arch/x86/include/uapi/asm/sigcontext32.h |  73 +----
 arch/x86/kernel/asm-offsets.c            |  18 +-
 arch/x86/kernel/fpu/signal.c             |   4 +-
 arch/x86/kernel/signal.c                 |   4 +-
 arch/x86/math-emu/fpu_emu.h              |   2 +-
 13 files changed, 338 insertions(+), 339 deletions(-)
arch/x86/ia32/ia32_signal.c +4 -4
index a0a19b7ba22d..5959042fae8d 100644
@@ -26,7 +26,7 @@
 #include <asm/ptrace.h>
 #include <asm/ia32_unistd.h>
 #include <asm/user32.h>
-#include <asm/sigcontext32.h>
+#include <uapi/asm/sigcontext.h>
 #include <asm/proto.h>
 #include <asm/vdso.h>
 #include <asm/sigframe.h>
@@ -68,7 +68,7 @@
 }
 
 static int ia32_restore_sigcontext(struct pt_regs *regs,
-				   struct sigcontext_ia32 __user *sc)
+				   struct sigcontext_32 __user *sc)
 {
 	unsigned int tmpflags, err = 0;
 	void __user *buf;
@@ -170,7 +170,7 @@ asmlinkage long sys32_rt_sigreturn(void)
  * Set up a signal frame.
  */
 
-static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc,
+static int ia32_setup_sigcontext(struct sigcontext_32 __user *sc,
 				 void __user *fpstate,
 				 struct pt_regs *regs, unsigned int mask)
 {
@@ -234,7 +234,7 @@ static void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
 		unsigned long fx_aligned, math_size;
 
 		sp = fpu__alloc_mathframe(sp, 1, &fx_aligned, &math_size);
-		*fpstate = (struct _fpstate_ia32 __user *) sp;
+		*fpstate = (struct _fpstate_32 __user *) sp;
 		if (copy_fpstate_to_sigframe(*fpstate, (void __user *)fx_aligned,
 				    math_size) < 0)
 			return (void __user *) -1L;
arch/x86/include/asm/fpu/signal.h +1 -1
index 7358e9d61f1e..0e970d00dfcd 100644
@@ -5,7 +5,7 @@
 #define _ASM_X86_FPU_SIGNAL_H
 
 #ifdef CONFIG_X86_64
-# include <asm/sigcontext32.h>
+# include <uapi/asm/sigcontext.h>
 # include <asm/user32.h>
 struct ksignal;
 int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
arch/x86/include/asm/ia32.h +2 -2
index 28019765442e..a9bdf5569ab3 100644
@@ -10,7 +10,7 @@
  * 32 bit structures for IA32 support.
  */
 
-#include <asm/sigcontext32.h>
+#include <uapi/asm/sigcontext.h>
 
 /* signal.h */
 
@@ -18,7 +18,7 @@ struct ucontext_ia32 {
 	unsigned int	  uc_flags;
 	unsigned int 	  uc_link;
 	compat_stack_t	  uc_stack;
-	struct sigcontext_ia32 uc_mcontext;
+	struct sigcontext_32 uc_mcontext;
 	compat_sigset_t	  uc_sigmask;	/* mask last for extensibility */
 };
 
arch/x86/include/asm/processor.h +1 -1
index 19577dd325fa..bb911e718330 100644
@@ -11,7 +11,7 @@ struct vm86;
 #include <asm/math_emu.h>
 #include <asm/segment.h>
 #include <asm/types.h>
-#include <asm/sigcontext.h>
+#include <uapi/asm/sigcontext.h>
 #include <asm/current.h>
 #include <asm/cpufeature.h>
 #include <asm/page.h>
arch/x86/include/asm/sigcontext.h +2 -73

81 lines not on this page · raw message

arch/x86/include/asm/sigframe.h +3 -5
index 1f3175bb994e..34edd1650bae 100644
@@ -1,7 +1,7 @@
 #ifndef _ASM_X86_SIGFRAME_H
 #define _ASM_X86_SIGFRAME_H
 
-#include <asm/sigcontext.h>
+#include <uapi/asm/sigcontext.h>
 #include <asm/siginfo.h>
 #include <asm/ucontext.h>
 #include <linux/compat.h>
@@ -9,8 +9,6 @@
 #ifdef CONFIG_X86_32
 #define sigframe_ia32		sigframe
 #define rt_sigframe_ia32	rt_sigframe
-#define sigcontext_ia32		sigcontext
-#define _fpstate_ia32		_fpstate
 #define ucontext_ia32		ucontext
 #else /* !CONFIG_X86_32 */
 
@@ -24,7 +22,7 @@
 struct sigframe_ia32 {
 	u32 pretcode;
 	int sig;
-	struct sigcontext_ia32 sc;
+	struct sigcontext_32 sc;
 	/*
 	 * fpstate is unused. fpstate is moved/allocated after
 	 * retcode[] below. This movement allows to have the FP state and the
@@ -33,7 +31,7 @@ struct sigframe_ia32 {
 	 * the offset of extramask[] in the sigframe and thus prevent any
 	 * legacy application accessing/modifying it.
 	 */
-	struct _fpstate_ia32 fpstate_unused;
+	struct _fpstate_32 fpstate_unused;
 #ifdef CONFIG_IA32_EMULATION
 	unsigned int extramask[_COMPAT_NSIG_WORDS-1];
 #else /* !CONFIG_IA32_EMULATION */
arch/x86/include/asm/signal.h +1 -1
index c481be78fcf1..2138c9ae19ee 100644
@@ -34,7 +34,7 @@ extern void do_signal(struct pt_regs *regs);
 
 #define __ARCH_HAS_SA_RESTORER
 
-#include <asm/sigcontext.h>
+#include <uapi/asm/sigcontext.h>
 
 #ifdef __i386__
 
arch/x86/include/uapi/asm/sigcontext.h +307 -168

528 lines not on this page · raw message

arch/x86/include/uapi/asm/sigcontext32.h +2 -71

79 lines not on this page · raw message

arch/x86/kernel/asm-offsets.c +9 -9
index 8e3d22a1af94..bc9f4afa889a 100644
@@ -43,15 +43,15 @@ void common(void) {
 
 #if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
 	BLANK();
-	OFFSET(IA32_SIGCONTEXT_ax, sigcontext_ia32, ax);
-	OFFSET(IA32_SIGCONTEXT_bx, sigcontext_ia32, bx);
-	OFFSET(IA32_SIGCONTEXT_cx, sigcontext_ia32, cx);
-	OFFSET(IA32_SIGCONTEXT_dx, sigcontext_ia32, dx);
-	OFFSET(IA32_SIGCONTEXT_si, sigcontext_ia32, si);
-	OFFSET(IA32_SIGCONTEXT_di, sigcontext_ia32, di);
-	OFFSET(IA32_SIGCONTEXT_bp, sigcontext_ia32, bp);
-	OFFSET(IA32_SIGCONTEXT_sp, sigcontext_ia32, sp);
-	OFFSET(IA32_SIGCONTEXT_ip, sigcontext_ia32, ip);
+	OFFSET(IA32_SIGCONTEXT_ax, sigcontext_32, ax);
+	OFFSET(IA32_SIGCONTEXT_bx, sigcontext_32, bx);
+	OFFSET(IA32_SIGCONTEXT_cx, sigcontext_32, cx);
+	OFFSET(IA32_SIGCONTEXT_dx, sigcontext_32, dx);
+	OFFSET(IA32_SIGCONTEXT_si, sigcontext_32, si);
+	OFFSET(IA32_SIGCONTEXT_di, sigcontext_32, di);
+	OFFSET(IA32_SIGCONTEXT_bp, sigcontext_32, bp);
+	OFFSET(IA32_SIGCONTEXT_sp, sigcontext_32, sp);
+	OFFSET(IA32_SIGCONTEXT_ip, sigcontext_32, ip);
 
 	BLANK();
 	OFFSET(TI_sysenter_return, thread_info, sysenter_return);
arch/x86/kernel/fpu/signal.c +2 -2
index 50ec9af1bd51..24aac16603a2 100644
@@ -56,7 +56,7 @@ static inline int save_fsave_header(struct task_struct *tsk, void __user *buf)
 	if (use_fxsr()) {
 		struct xregs_state *xsave = &tsk->thread.fpu.state.xsave;
 		struct user_i387_ia32_struct env;
-		struct _fpstate_ia32 __user *fp = buf;
+		struct _fpstate_32 __user *fp = buf;
 
 		convert_from_fxsr(&env, tsk);
 
@@ -165,7 +165,7 @@ int copy_fpstate_to_sigframe(void __user *buf, void __user *buf_fx, int size)
 	if (!static_cpu_has(X86_FEATURE_FPU))
 		return fpregs_soft_get(current, NULL, 0,
 			sizeof(struct user_i387_ia32_struct), NULL,
-			(struct _fpstate_ia32 __user *) buf) ? -1 : 1;
+			(struct _fpstate_32 __user *) buf) ? -1 : 1;
 
 	if (fpregs_active()) {
 		/* Save the live register state to the user directly. */
arch/x86/kernel/signal.c +3 -1
index da52e6bb5c7f..3724ff38033e 100644
@@ -63,6 +63,7 @@
 
 int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
 {
+	unsigned long buf_val;
 	void __user *buf;
 	unsigned int tmpflags;
 	unsigned int err = 0;
@@ -107,7 +108,8 @@ int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
 		regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
 		regs->orig_ax = -1;		/* disable syscall checks */
 
-		get_user_ex(buf, &sc->fpstate);
+		get_user_ex(buf_val, &sc->fpstate);
+		buf = (void __user *)buf_val;
 	} get_user_catch(err);
 
 	err |= fpu__restore_sig(buf, config_enabled(CONFIG_X86_32));
arch/x86/math-emu/fpu_emu.h +1 -1
index 4dae511c85ad..afbc4d805d66 100644
@@ -71,7 +71,7 @@
 
 #include "fpu_system.h"
 
-#include <asm/sigcontext.h>	/* for struct _fpstate */
+#include <uapi/asm/sigcontext.h>	/* for struct _fpstate */
 #include <asm/math_emu.h>
 #include <linux/linkage.h>