* [PATCH 00/15] x86/headers: Clean up sigcontext types and headers
@ 2015-09-05 7:32 Ingo Molnar
2015-09-05 7:32 ` [PATCH 01/15] x86/headers: Fix (old) header file dependency bug in uapi/asm/sigcontext32.h Ingo Molnar
` (14 more replies)
0 siblings, 15 replies; 41+ messages in thread
From: Ingo Molnar @ 2015-09-05 7:32 UTC (permalink / raw)
To: linux-kernel
Cc: Mikko Rapeli, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
So Mikko Rapeli reported that sigcontext32.h does not build standalone,
and while trying to fix it I came up with this series that cleans up
all sorts of details and makes the sigcontext types (hopefully) much
more maintainable.
Before this series we had a somewhat messy duplication that resulted
in 3 type definitions (repeated for both sigcontext and for various
FPU state structures):
- native 32-bit types (only available on 32-bit kernels)
- native 64-bit types (only available on 64-bit kernels)
- compat 32-bit types (only available on 64-bit kernels)
- wrappers defining _32 named variants of these types
... while in reality our compat 32-bit ABI structures are the same as
the native 32-bit ABI structures.
So after the series there's a clear, bitness independent definition
of all the relevant types:
struct sigcontext_32 (available on all kernels)
struct sigcontext_64 (available on all kernels)
struct _fpstate_32 (available on all kernels)
struct _fpstate_64 (available on all kernels)
and the kernel bitness dependent 'struct sigcontext' and 'struct _fpstate'
structures are then mapped to their respective types, depending on bitness.
Modern user-space can start using these cleaner types. (If they want to: all
old names are kept as well).
I have also extended/harmonized all the disjunct (and often hard to read)
comments in the various structure definitions. The patches add a lot of
new comments, this is why the diffstat shows only a modest line count
reduction:
13 files changed, 324 insertions(+), 338 deletions(-)
Another effect of the series is that sigcontext32.h is gone (only
a wrapper to sigcontext.h is kept, in case existing user-space relies
on the header), and the kernel side asm/sigcontext.h file is gone as
well. This should solve the original build failure reported by Mikko
Rapeli.
All legacy names are still kept to make sure we don't break user-space
builds, and are collected at the end of the file, without confusing people
who'd only like to read the file to understand the kernel side code.
The various _ia32 names are mostly gone as well from the kernel side,
compatibility wrappers are kept for the user-space side.
There's one new type quirk in patch 11, which is the result of having unified
C code operating on a 32-bit pointer field both from 64-bit kernel and from
a native 32-bit kernel:
int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
{
+ unsigned long buf_val;
- get_user_ex(buf, &sc->fpstate);
+ get_user_ex(buf_val, &sc->fpstate);
+ buf = (void __user *)buf_val;
this is the cleanest I could structure it. If this is the only quirk then I
think the advantages outweigh the ugliness - BYMMV.
So in general this is how I imagine our model should be to define ABIs
going forward.
Comments, suggestions are welcome!
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>
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 | 79 ------
arch/x86/include/asm/sigframe.h | 8 +-
arch/x86/include/asm/signal.h | 2 +-
arch/x86/include/uapi/asm/sigcontext.h | 456 ++++++++++++++++++++-----------
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, 324 insertions(+), 338 deletions(-)
delete mode 100644 arch/x86/include/asm/sigcontext.h
--
2.1.4
^ permalink raw reply [flat|nested] 41+ messages in thread
* [PATCH 01/15] x86/headers: Fix (old) header file dependency bug in uapi/asm/sigcontext32.h
2015-09-05 7:32 [PATCH 00/15] x86/headers: Clean up sigcontext types and headers Ingo Molnar
@ 2015-09-05 7:32 ` Ingo Molnar
2015-09-08 14:24 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 02/15] x86/headers: Clean up uapi/asm/sigcontext32.h Ingo Molnar
` (13 subsequent siblings)
14 siblings, 1 reply; 41+ messages in thread
From: Ingo Molnar @ 2015-09-05 7:32 UTC (permalink / raw)
To: linux-kernel
Cc: Mikko Rapeli, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
Mikko Rapeli reported that the following standalone user-space header does not compile:
#include <asm/sigcontext32.h>
Due to undefined 'struct __fpx_sw_bytes' which is defined in asm/sigcontext.h.
The following header order works:
#include <asm/sigcontext.h>
#include <asm/sigcontext32.h>
and that's probably how everyone's been using these headers for the past decade or
so, but it's a legit header file dependency bug, so include asm/sigcontext.h in
sigcontext32.h to allow it to be built standlone.
Reported-by: Mikko Rapeli <mikko.rapeli@iki.fi>
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/include/uapi/asm/sigcontext32.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
index ad1478c4ae12..ff7826c41a1c 100644
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -3,6 +3,8 @@
#include <linux/types.h>
+#include <asm/sigcontext.h>
+
/* signal context for 32bit programs. */
#define X86_FXSR_MAGIC 0x0000
--
2.1.4
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 02/15] x86/headers: Clean up uapi/asm/sigcontext32.h
2015-09-05 7:32 [PATCH 00/15] x86/headers: Clean up sigcontext types and headers Ingo Molnar
2015-09-05 7:32 ` [PATCH 01/15] x86/headers: Fix (old) header file dependency bug in uapi/asm/sigcontext32.h Ingo Molnar
@ 2015-09-05 7:32 ` Ingo Molnar
2015-09-08 14:25 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 03/15] x86/headers: Clean up and better document uapi/asm/sigcontext.h Ingo Molnar
` (12 subsequent siblings)
14 siblings, 1 reply; 41+ messages in thread
From: Ingo Molnar @ 2015-09-05 7:32 UTC (permalink / raw)
To: linux-kernel
Cc: Mikko Rapeli, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
Clean up sigcontext32.h a bit:
- use consistent and readable vertical spacing
- fix, harmonize and extend comments
No field name has been changed, user-space might be relying on them.
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: Mikko Rapeli <mikko.rapeli@iki.fi>
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/include/uapi/asm/sigcontext32.h | 110 ++++++++++++++++---------------
1 file changed, 58 insertions(+), 52 deletions(-)
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
index ff7826c41a1c..6ff4fbab650e 100644
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -1,79 +1,85 @@
#ifndef _ASM_X86_SIGCONTEXT32_H
#define _ASM_X86_SIGCONTEXT32_H
+/* Signal context definitions for compat 32-bit programs: */
+
#include <linux/types.h>
#include <asm/sigcontext.h>
-/* signal context for 32bit programs. */
-
-#define X86_FXSR_MAGIC 0x0000
-
+/* 10-byte legacy floating point register: */
struct _fpreg {
- unsigned short significand[4];
- unsigned short exponent;
+ unsigned short significand[4];
+ unsigned short exponent;
};
+/* 16-byte floating point register: */
struct _fpxreg {
- unsigned short significand[4];
- unsigned short exponent;
- unsigned short padding[3];
+ unsigned short significand[4];
+ unsigned short exponent;
+ unsigned short padding[3];
};
+/* 16-byte XMM vector register: */
struct _xmmreg {
__u32 element[4];
};
-/* FSAVE frame with extensions */
+#define X86_FXSR_MAGIC 0x0000
+
+/* FXSAVE frame: FSAVE frame with extensions */
struct _fpstate_ia32 {
- /* Regular FPU environment */
- __u32 cw;
- __u32 sw;
- __u32 tag; /* not compatible to 64bit twd */
- __u32 ipoff;
- __u32 cssel;
- __u32 dataoff;
- __u32 datasel;
- struct _fpreg _st[8];
- unsigned short status;
- unsigned short magic; /* 0xffff = regular FPU data only */
+ /* Regular FPU environment: */
+ __u32 cw;
+ __u32 sw;
+ __u32 tag; /* Not compatible with the 64-bit frame */
+ __u32 ipoff;
+ __u32 cssel;
+ __u32 dataoff;
+ __u32 datasel;
+ struct _fpreg _st[8];
+ unsigned short status;
+ unsigned short magic; /* 0xffff: regular FPU data only */
+ /* 0x0000: FXSR data */
- /* FXSR FPU environment */
- __u32 _fxsr_env[6];
- __u32 mxcsr;
- __u32 reserved;
- struct _fpxreg _fxsr_st[8];
- struct _xmmreg _xmm[8]; /* It's actually 16 */
- __u32 padding[44];
+ /* Extended FXSR FPU environment: */
+ __u32 _fxsr_env[6];
+ __u32 mxcsr;
+ __u32 reserved;
+ struct _fpxreg _fxsr_st[8];
+ struct _xmmreg _xmm[8]; /* The first 8 XMM registers */
+ __u32 padding[44]; /* The second 8 XMM registers plus padding */
union {
- __u32 padding2[12];
- struct _fpx_sw_bytes sw_reserved;
+ __u32 padding2[12];
+ /* Might encode xstate extensions, see asm/sigcontext.h: */
+ struct _fpx_sw_bytes sw_reserved;
};
};
+/* 32-bit compat sigcontext: */
struct sigcontext_ia32 {
- unsigned short gs, __gsh;
- unsigned short fs, __fsh;
- unsigned short es, __esh;
- unsigned short ds, __dsh;
- unsigned int di;
- unsigned int si;
- unsigned int bp;
- unsigned int sp;
- unsigned int bx;
- unsigned int dx;
- unsigned int cx;
- unsigned int ax;
- unsigned int trapno;
- unsigned int err;
- unsigned int ip;
- unsigned short cs, __csh;
- unsigned int flags;
- unsigned int sp_at_signal;
- unsigned short ss, __ssh;
- unsigned int fpstate; /* really (struct _fpstate_ia32 *) */
- unsigned int oldmask;
- unsigned int cr2;
+ unsigned short gs, __gsh;
+ unsigned short fs, __fsh;
+ unsigned short es, __esh;
+ unsigned short ds, __dsh;
+ unsigned int di;
+ unsigned int si;
+ unsigned int bp;
+ unsigned int sp;
+ unsigned int bx;
+ unsigned int dx;
+ unsigned int cx;
+ unsigned int ax;
+ unsigned int trapno;
+ unsigned int err;
+ unsigned int ip;
+ unsigned short cs, __csh;
+ unsigned int flags;
+ unsigned int sp_at_signal;
+ unsigned short ss, __ssh;
+ unsigned int fpstate; /* Pointer to 'struct _fpstate_ia32' */
+ unsigned int oldmask;
+ unsigned int cr2;
};
#endif /* _ASM_X86_SIGCONTEXT32_H */
--
2.1.4
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 03/15] x86/headers: Clean up and better document uapi/asm/sigcontext.h
2015-09-05 7:32 [PATCH 00/15] x86/headers: Clean up sigcontext types and headers Ingo Molnar
2015-09-05 7:32 ` [PATCH 01/15] x86/headers: Fix (old) header file dependency bug in uapi/asm/sigcontext32.h Ingo Molnar
2015-09-05 7:32 ` [PATCH 02/15] x86/headers: Clean up uapi/asm/sigcontext32.h Ingo Molnar
@ 2015-09-05 7:32 ` Ingo Molnar
2015-09-08 14:25 ` [tip:x86/headers] x86/headers: Clean up and better document uapi/ asm/sigcontext.h tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 04/15] x86/headers: Separate out legacy user-space structure definitions Ingo Molnar
` (11 subsequent siblings)
14 siblings, 1 reply; 41+ messages in thread
From: Ingo Molnar @ 2015-09-05 7:32 UTC (permalink / raw)
To: linux-kernel
Cc: Mikko Rapeli, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
Clean up sigcontext.h:
- the explanations were full of typos and were hard to read in general
- use consistent and readable vertical spacing
- fix, harmonize and extend comments
No field name has been changed, user-space might be relying on them.
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: Mikko Rapeli <mikko.rapeli@iki.fi>
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/include/uapi/asm/sigcontext.h | 330 ++++++++++++++++++---------------
1 file changed, 182 insertions(+), 148 deletions(-)
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index 40836a9a7250..f89b2f1abe7c 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -1,221 +1,255 @@
#ifndef _UAPI_ASM_X86_SIGCONTEXT_H
#define _UAPI_ASM_X86_SIGCONTEXT_H
+/*
+ * Linux signal context definitions. The sigcontext includes a complex hierarchy of CPU
+ * and FPU state, available to user-space (on the stack) when a signal handler is
+ * executed.
+ *
+ * As over the years this ABI grew from its very simple roots towards supporting more and
+ * more CPU state organically, some of the details (which were rather clever hacks back
+ * in the days) became a bit quirky by today.
+ *
+ * The current ABI includes flexible provisions for future extensions, so we won't have
+ * to grow new quirks for quite some time. Promise!
+ */
+
#include <linux/compiler.h>
#include <linux/types.h>
-#define FP_XSTATE_MAGIC1 0x46505853U
-#define FP_XSTATE_MAGIC2 0x46505845U
-#define FP_XSTATE_MAGIC2_SIZE sizeof(FP_XSTATE_MAGIC2)
+#define FP_XSTATE_MAGIC1 0x46505853U
+#define FP_XSTATE_MAGIC2 0x46505845U
+#define FP_XSTATE_MAGIC2_SIZE sizeof(FP_XSTATE_MAGIC2)
/*
- * bytes 464..511 in the current 512byte layout of fxsave/fxrstor frame
- * are reserved for SW usage. On cpu's supporting xsave/xrstor, these bytes
- * are used to extended the fpstate pointer in the sigcontext, which now
+ * Bytes 464..511 in the current 512-byte layout of the FXSAVE/FXRSTOR frame
+ * are reserved for SW usage. On CPUs supporting XSAVE/XRSTOR, these bytes
+ * are used to extend the fpstate pointer in the sigcontext, which now
* includes the extended state information along with fpstate information.
*
- * Presence of FP_XSTATE_MAGIC1 at the beginning of this SW reserved
- * area and FP_XSTATE_MAGIC2 at the end of memory layout
- * (extended_size - FP_XSTATE_MAGIC2_SIZE) indicates the presence of the
- * extended state information in the memory layout pointed by the fpstate
- * pointer in sigcontext.
+ * If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then there's a sw_reserved.extended_size
+ * bytes large extended context area present. (The last 32-bit word of this extended
+ * area (at the fpstate+extended_size-FP_XSTATE_MAGIC2_SIZE address) is set to
+ * FP_XSTATE_MAGIC2 so that you can sanity check your size calculations.)
+ *
+ * This extended area typically grows with newer CPUs that have larger and larger
+ * XSAVE areas.
*/
struct _fpx_sw_bytes {
- __u32 magic1; /* FP_XSTATE_MAGIC1 */
- __u32 extended_size; /* total size of the layout referred by
- * fpstate pointer in the sigcontext.
- */
- __u64 xfeatures;
- /* feature bit mask (including fp/sse/extended
- * state) that is present in the memory
- * layout.
- */
- __u32 xstate_size; /* actual xsave state size, based on the
- * features saved in the layout.
- * 'extended_size' will be greater than
- * 'xstate_size'.
- */
- __u32 padding[7]; /* for future use. */
+ /* If set to FP_XSTATE_MAGIC1 then this is an xstate context. 0 if a legacy frame. */
+ __u32 magic1;
+
+ /*
+ * Total size of the fpstate area:
+ *
+ * - if magic1 == 0 then it's sizeof(struct _fpstate)
+ * - if magic1 == FP_XSTATE_MAGIC1 then it's sizeof(struct _xstate) plus extensions (if any)
+ */
+ __u32 extended_size;
+
+ /*
+ * Feature bit mask (including FP/SSE/extended state) that is present
+ * in the memory layout:
+ */
+ __u64 xfeatures;
+
+ /*
+ * Actual XSAVE state size, based on the xfeatures saved in the layout.
+ * 'extended_size' is greater than 'xstate_size':
+ */
+ __u32 xstate_size;
+
+ /* For future use: */
+ __u32 padding[7];
};
#ifdef __i386__
/*
- * As documented in the iBCS2 standard..
+ * As documented in the iBCS2 standard:
*
* The first part of "struct _fpstate" is just the normal i387
* hardware setup, the extra "status" word is used to save the
* coprocessor status word before entering the handler.
*
- * Pentium III FXSR, SSE support
- * Gareth Hughes <gareth@valinux.com>, May 2000
- *
* The FPU state data structure has had to grow to accommodate the
* extended FPU state required by the Streaming SIMD Extensions.
* There is no documented standard to accomplish this at the moment.
*/
+
+/* 10-byte legacy floating point register: */
struct _fpreg {
- unsigned short significand[4];
- unsigned short exponent;
+ unsigned short significand[4];
+ unsigned short exponent;
};
+/* 16-byte floating point register: */
struct _fpxreg {
- unsigned short significand[4];
- unsigned short exponent;
- unsigned short padding[3];
+ unsigned short significand[4];
+ unsigned short exponent;
+ unsigned short padding[3];
};
+/* 16-byte XMM register: */
struct _xmmreg {
- unsigned long element[4];
+ unsigned long element[4];
};
+#define X86_FXSR_MAGIC 0x0000
+
struct _fpstate {
- /* Regular FPU environment */
- unsigned long cw;
- unsigned long sw;
- unsigned long tag;
- unsigned long ipoff;
- unsigned long cssel;
- unsigned long dataoff;
- unsigned long datasel;
- struct _fpreg _st[8];
- unsigned short status;
- unsigned short magic; /* 0xffff = regular FPU data only */
+ /* Legacy FPU environment: */
+ unsigned long cw;
+ unsigned long sw;
+ unsigned long tag;
+ unsigned long ipoff;
+ unsigned long cssel;
+ unsigned long dataoff;
+ unsigned long datasel;
+ struct _fpreg _st[8];
+ unsigned short status;
+ unsigned short magic; /* 0xffff: regular FPU data only */
+ /* 0x0000: FXSR FPU data */
/* FXSR FPU environment */
- unsigned long _fxsr_env[6]; /* FXSR FPU env is ignored */
- unsigned long mxcsr;
- unsigned long reserved;
- struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */
- struct _xmmreg _xmm[8];
- unsigned long padding1[44];
+ unsigned long _fxsr_env[6]; /* FXSR FPU env is ignored */
+ unsigned long mxcsr;
+ unsigned long reserved;
+ struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */
+ struct _xmmreg _xmm[8]; /* First 8 XMM registers */
+ unsigned long padding1[44]; /* Second 8 XMM registers plus padding */
union {
- unsigned long padding2[12];
- struct _fpx_sw_bytes sw_reserved; /* represents the extended
- * state info */
+ unsigned long padding2[12];
+ struct _fpx_sw_bytes sw_reserved; /* Potential extended state is encoded here */
};
};
-#define X86_FXSR_MAGIC 0x0000
-
-#ifndef __KERNEL__
+# ifndef __KERNEL__
/*
* User-space might still rely on the old definition:
*/
struct sigcontext {
- unsigned short gs, __gsh;
- unsigned short fs, __fsh;
- unsigned short es, __esh;
- unsigned short ds, __dsh;
- unsigned long edi;
- unsigned long esi;
- unsigned long ebp;
- unsigned long esp;
- unsigned long ebx;
- unsigned long edx;
- unsigned long ecx;
- unsigned long eax;
- unsigned long trapno;
- unsigned long err;
- unsigned long eip;
- unsigned short cs, __csh;
- unsigned long eflags;
- unsigned long esp_at_signal;
- unsigned short ss, __ssh;
- struct _fpstate __user *fpstate;
- unsigned long oldmask;
- unsigned long cr2;
+ unsigned short gs, __gsh;
+ unsigned short fs, __fsh;
+ unsigned short es, __esh;
+ unsigned short ds, __dsh;
+ unsigned long edi;
+ unsigned long esi;
+ unsigned long ebp;
+ unsigned long esp;
+ unsigned long ebx;
+ unsigned long edx;
+ unsigned long ecx;
+ unsigned long eax;
+ unsigned long trapno;
+ unsigned long err;
+ unsigned long eip;
+ unsigned short cs, __csh;
+ unsigned long eflags;
+ unsigned long esp_at_signal;
+ unsigned short ss, __ssh;
+ struct _fpstate __user *fpstate;
+ unsigned long oldmask;
+ unsigned long cr2;
};
-#endif /* !__KERNEL__ */
+# endif /* !__KERNEL__ */
-#else /* __i386__ */
+#else /* __x86_64__: */
-/* FXSAVE frame */
-/* Note: reserved1/2 may someday contain valuable data. Always save/restore
- them when you change signal frames. */
+/*
+ * The FXSAVE frame.
+ *
+ * Note1: If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then the structure is
+ * larger: 'struct _xstate'. Note that 'struct _xstate' embedds
+ * 'struct _fpstate' so that you can always assume the _fpstate portion
+ * exists so that you can check the magic value.
+ *
+ * Note2: Reserved fields may someday contain valuable data. Always save/restore
+ * them when you change signal frames.
+ */
struct _fpstate {
- __u16 cwd;
- __u16 swd;
- __u16 twd; /* Note this is not the same as the
- 32bit/x87/FSAVE twd */
- __u16 fop;
- __u64 rip;
- __u64 rdp;
- __u32 mxcsr;
- __u32 mxcsr_mask;
- __u32 st_space[32]; /* 8*16 bytes for each FP-reg */
- __u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg */
- __u32 reserved2[12];
+ __u16 cwd;
+ __u16 swd;
+ /* Note this is not the same as the 32-bit/x87/FSAVE twd: */
+ __u16 twd;
+ __u16 fop;
+ __u64 rip;
+ __u64 rdp;
+ __u32 mxcsr;
+ __u32 mxcsr_mask;
+ __u32 st_space[32]; /* 8x FP registers, 16 bytes each */
+ __u32 xmm_space[64]; /* 16x XMM registers, 16 bytes each */
+ __u32 reserved2[12];
union {
- __u32 reserved3[12];
- struct _fpx_sw_bytes sw_reserved; /* represents the extended
- * state information */
+ __u32 reserved3[12];
+ struct _fpx_sw_bytes sw_reserved; /* Potential extended state is encoded here */
};
};
-#ifndef __KERNEL__
+# ifndef __KERNEL__
/*
* User-space might still rely on the old definition:
*/
struct sigcontext {
- __u64 r8;
- __u64 r9;
- __u64 r10;
- __u64 r11;
- __u64 r12;
- __u64 r13;
- __u64 r14;
- __u64 r15;
- __u64 rdi;
- __u64 rsi;
- __u64 rbp;
- __u64 rbx;
- __u64 rdx;
- __u64 rax;
- __u64 rcx;
- __u64 rsp;
- __u64 rip;
- __u64 eflags; /* RFLAGS */
- __u16 cs;
- __u16 gs;
- __u16 fs;
- __u16 __pad0;
- __u64 err;
- __u64 trapno;
- __u64 oldmask;
- __u64 cr2;
- struct _fpstate __user *fpstate; /* zero when no FPU context */
-#ifdef __ILP32__
- __u32 __fpstate_pad;
-#endif
- __u64 reserved1[8];
+ __u64 r8;
+ __u64 r9;
+ __u64 r10;
+ __u64 r11;
+ __u64 r12;
+ __u64 r13;
+ __u64 r14;
+ __u64 r15;
+ __u64 rdi;
+ __u64 rsi;
+ __u64 rbp;
+ __u64 rbx;
+ __u64 rdx;
+ __u64 rax;
+ __u64 rcx;
+ __u64 rsp;
+ __u64 rip;
+ __u64 eflags; /* RFLAGS */
+ __u16 cs;
+ __u16 gs;
+ __u16 fs;
+ __u16 __pad0;
+ __u64 err;
+ __u64 trapno;
+ __u64 oldmask;
+ __u64 cr2;
+ struct _fpstate __user *fpstate; /* Zero when no FPU context */
+# ifdef __ILP32__
+ __u32 __fpstate_pad;
+# endif
+ __u64 reserved1[8];
};
-#endif /* !__KERNEL__ */
+# endif /* !__KERNEL__ */
-#endif /* !__i386__ */
+#endif /* __x86_64__ */
struct _header {
- __u64 xfeatures;
- __u64 reserved1[2];
- __u64 reserved2[5];
+ __u64 xfeatures;
+ __u64 reserved1[2];
+ __u64 reserved2[5];
};
struct _ymmh_state {
- /* 16 * 16 bytes for each YMMH-reg */
- __u32 ymmh_space[64];
+ /* 16x YMM registers, 16 bytes each: */
+ __u32 ymmh_space[64];
};
/*
- * Extended state pointed by the fpstate pointer in the sigcontext.
- * In addition to the fpstate, information encoded in the xstate_hdr
- * indicates the presence of other extended state information
- * supported by the processor and OS.
+ * Extended state pointed to by sigcontext::fpstate.
+ *
+ * In addition to the fpstate, information encoded in _xstate::xstate_hdr
+ * indicates the presence of other extended state information supported
+ * by the CPU and kernel:
*/
struct _xstate {
- struct _fpstate fpstate;
- struct _header xstate_hdr;
- struct _ymmh_state ymmh;
- /* new processor state extensions go here */
+ struct _fpstate fpstate;
+ struct _header xstate_hdr;
+ struct _ymmh_state ymmh;
+ /* New processor state extensions go here: */
};
#endif /* _UAPI_ASM_X86_SIGCONTEXT_H */
--
2.1.4
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 04/15] x86/headers: Separate out legacy user-space structure definitions
2015-09-05 7:32 [PATCH 00/15] x86/headers: Clean up sigcontext types and headers Ingo Molnar
` (2 preceding siblings ...)
2015-09-05 7:32 ` [PATCH 03/15] x86/headers: Clean up and better document uapi/asm/sigcontext.h Ingo Molnar
@ 2015-09-05 7:32 ` Ingo Molnar
2015-09-08 14:25 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 05/15] x86/headers: Use ABI types consistently in sigcontext*.h Ingo Molnar
` (10 subsequent siblings)
14 siblings, 1 reply; 41+ messages in thread
From: Ingo Molnar @ 2015-09-05 7:32 UTC (permalink / raw)
To: linux-kernel
Cc: Mikko Rapeli, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
Better separate the user-space struct sigcontext definitions from
the kernel definitions, so that we can unify the kernel definitions
with sigcontext32.h.
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: Mikko Rapeli <mikko.rapeli@iki.fi>
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/include/uapi/asm/sigcontext.h | 119 ++++++++++++++++-----------------
1 file changed, 59 insertions(+), 60 deletions(-)
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index f89b2f1abe7c..40d6cbac08c6 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -124,36 +124,6 @@ struct _fpstate {
};
};
-# ifndef __KERNEL__
-/*
- * User-space might still rely on the old definition:
- */
-struct sigcontext {
- unsigned short gs, __gsh;
- unsigned short fs, __fsh;
- unsigned short es, __esh;
- unsigned short ds, __dsh;
- unsigned long edi;
- unsigned long esi;
- unsigned long ebp;
- unsigned long esp;
- unsigned long ebx;
- unsigned long edx;
- unsigned long ecx;
- unsigned long eax;
- unsigned long trapno;
- unsigned long err;
- unsigned long eip;
- unsigned short cs, __csh;
- unsigned long eflags;
- unsigned long esp_at_signal;
- unsigned short ss, __ssh;
- struct _fpstate __user *fpstate;
- unsigned long oldmask;
- unsigned long cr2;
-};
-# endif /* !__KERNEL__ */
-
#else /* __x86_64__: */
/*
@@ -186,10 +156,65 @@ struct _fpstate {
};
};
-# ifndef __KERNEL__
+#endif /* __x86_64__ */
+
+struct _header {
+ __u64 xfeatures;
+ __u64 reserved1[2];
+ __u64 reserved2[5];
+};
+
+struct _ymmh_state {
+ /* 16x YMM registers, 16 bytes each: */
+ __u32 ymmh_space[64];
+};
+
/*
- * User-space might still rely on the old definition:
+ * Extended state pointed to by sigcontext::fpstate.
+ *
+ * In addition to the fpstate, information encoded in _xstate::xstate_hdr
+ * indicates the presence of other extended state information supported
+ * by the CPU and kernel:
*/
+struct _xstate {
+ struct _fpstate fpstate;
+ struct _header xstate_hdr;
+ struct _ymmh_state ymmh;
+ /* New processor state extensions go here: */
+};
+
+/*
+ * The old user-space sigcontext definition, just in case user-space still
+ * relies on it. The kernel definition (in asm/sigcontext.h) has unified
+ * field names but otherwise the same layout.
+ */
+#ifndef __KERNEL__
+# ifdef __i386__
+struct sigcontext {
+ unsigned short gs, __gsh;
+ unsigned short fs, __fsh;
+ unsigned short es, __esh;
+ unsigned short ds, __dsh;
+ unsigned long edi;
+ unsigned long esi;
+ unsigned long ebp;
+ unsigned long esp;
+ unsigned long ebx;
+ unsigned long edx;
+ unsigned long ecx;
+ unsigned long eax;
+ unsigned long trapno;
+ unsigned long err;
+ unsigned long eip;
+ unsigned short cs, __csh;
+ unsigned long eflags;
+ unsigned long esp_at_signal;
+ unsigned short ss, __ssh;
+ struct _fpstate __user *fpstate;
+ unsigned long oldmask;
+ unsigned long cr2;
+};
+# else /* __x86_64__: */
struct sigcontext {
__u64 r8;
__u64 r9;
@@ -223,33 +248,7 @@ struct sigcontext {
# endif
__u64 reserved1[8];
};
-# endif /* !__KERNEL__ */
-
-#endif /* __x86_64__ */
-
-struct _header {
- __u64 xfeatures;
- __u64 reserved1[2];
- __u64 reserved2[5];
-};
-
-struct _ymmh_state {
- /* 16x YMM registers, 16 bytes each: */
- __u32 ymmh_space[64];
-};
-
-/*
- * Extended state pointed to by sigcontext::fpstate.
- *
- * In addition to the fpstate, information encoded in _xstate::xstate_hdr
- * indicates the presence of other extended state information supported
- * by the CPU and kernel:
- */
-struct _xstate {
- struct _fpstate fpstate;
- struct _header xstate_hdr;
- struct _ymmh_state ymmh;
- /* New processor state extensions go here: */
-};
+# endif /* __x86_64__ */
+#endif /* !__KERNEL__ */
#endif /* _UAPI_ASM_X86_SIGCONTEXT_H */
--
2.1.4
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 05/15] x86/headers: Use ABI types consistently in sigcontext*.h
2015-09-05 7:32 [PATCH 00/15] x86/headers: Clean up sigcontext types and headers Ingo Molnar
` (3 preceding siblings ...)
2015-09-05 7:32 ` [PATCH 04/15] x86/headers: Separate out legacy user-space structure definitions Ingo Molnar
@ 2015-09-05 7:32 ` Ingo Molnar
2015-09-08 14:26 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 06/15] x86/headers: Unify register type definitions between 32-bit compat and i386 Ingo Molnar
` (9 subsequent siblings)
14 siblings, 1 reply; 41+ messages in thread
From: Ingo Molnar @ 2015-09-05 7:32 UTC (permalink / raw)
To: linux-kernel
Cc: Mikko Rapeli, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
Use the __u16/32/64 types we standardized on in ABI definitions - and which most
of this header was already using.
This will allow us to more obviously unify the compat header
into the main header.
No change in functionality.
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: Mikko Rapeli <mikko.rapeli@iki.fi>
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/include/uapi/asm/sigcontext.h | 82 ++++++++++++++++----------------
arch/x86/include/uapi/asm/sigcontext32.h | 58 +++++++++++-----------
2 files changed, 70 insertions(+), 70 deletions(-)
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index 40d6cbac08c6..07b0e32a1d23 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -78,48 +78,48 @@ struct _fpx_sw_bytes {
/* 10-byte legacy floating point register: */
struct _fpreg {
- unsigned short significand[4];
- unsigned short exponent;
+ __u16 significand[4];
+ __u16 exponent;
};
/* 16-byte floating point register: */
struct _fpxreg {
- unsigned short significand[4];
- unsigned short exponent;
- unsigned short padding[3];
+ __u16 significand[4];
+ __u16 exponent;
+ __u16 padding[3];
};
/* 16-byte XMM register: */
struct _xmmreg {
- unsigned long element[4];
+ __u32 element[4];
};
#define X86_FXSR_MAGIC 0x0000
struct _fpstate {
/* Legacy FPU environment: */
- unsigned long cw;
- unsigned long sw;
- unsigned long tag;
- unsigned long ipoff;
- unsigned long cssel;
- unsigned long dataoff;
- unsigned long datasel;
+ __u32 cw;
+ __u32 sw;
+ __u32 tag;
+ __u32 ipoff;
+ __u32 cssel;
+ __u32 dataoff;
+ __u32 datasel;
struct _fpreg _st[8];
- unsigned short status;
- unsigned short magic; /* 0xffff: regular FPU data only */
+ __u16 status;
+ __u16 magic; /* 0xffff: regular FPU data only */
/* 0x0000: FXSR FPU data */
/* FXSR FPU environment */
- unsigned long _fxsr_env[6]; /* FXSR FPU env is ignored */
- unsigned long mxcsr;
- unsigned long reserved;
+ __u32 _fxsr_env[6]; /* FXSR FPU env is ignored */
+ __u32 mxcsr;
+ __u32 reserved;
struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */
struct _xmmreg _xmm[8]; /* First 8 XMM registers */
- unsigned long padding1[44]; /* Second 8 XMM registers plus padding */
+ __u32 padding1[44]; /* Second 8 XMM registers plus padding */
union {
- unsigned long padding2[12];
+ __u32 padding2[12];
struct _fpx_sw_bytes sw_reserved; /* Potential extended state is encoded here */
};
};
@@ -191,28 +191,28 @@ struct _xstate {
#ifndef __KERNEL__
# ifdef __i386__
struct sigcontext {
- unsigned short gs, __gsh;
- unsigned short fs, __fsh;
- unsigned short es, __esh;
- unsigned short ds, __dsh;
- unsigned long edi;
- unsigned long esi;
- unsigned long ebp;
- unsigned long esp;
- unsigned long ebx;
- unsigned long edx;
- unsigned long ecx;
- unsigned long eax;
- unsigned long trapno;
- unsigned long err;
- unsigned long eip;
- unsigned short cs, __csh;
- unsigned long eflags;
- unsigned long esp_at_signal;
- unsigned short ss, __ssh;
+ __u16 gs, __gsh;
+ __u16 fs, __fsh;
+ __u16 es, __esh;
+ __u16 ds, __dsh;
+ __u32 edi;
+ __u32 esi;
+ __u32 ebp;
+ __u32 esp;
+ __u32 ebx;
+ __u32 edx;
+ __u32 ecx;
+ __u32 eax;
+ __u32 trapno;
+ __u32 err;
+ __u32 eip;
+ __u16 cs, __csh;
+ __u32 eflags;
+ __u32 esp_at_signal;
+ __u16 ss, __ssh;
struct _fpstate __user *fpstate;
- unsigned long oldmask;
- unsigned long cr2;
+ __u32 oldmask;
+ __u32 cr2;
};
# else /* __x86_64__: */
struct sigcontext {
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
index 6ff4fbab650e..939a84885673 100644
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -9,15 +9,15 @@
/* 10-byte legacy floating point register: */
struct _fpreg {
- unsigned short significand[4];
- unsigned short exponent;
+ __u16 significand[4];
+ __u16 exponent;
};
/* 16-byte floating point register: */
struct _fpxreg {
- unsigned short significand[4];
- unsigned short exponent;
- unsigned short padding[3];
+ __u16 significand[4];
+ __u16 exponent;
+ __u16 padding[3];
};
/* 16-byte XMM vector register: */
@@ -38,8 +38,8 @@ struct _fpstate_ia32 {
__u32 dataoff;
__u32 datasel;
struct _fpreg _st[8];
- unsigned short status;
- unsigned short magic; /* 0xffff: regular FPU data only */
+ __u16 status;
+ __u16 magic; /* 0xffff: regular FPU data only */
/* 0x0000: FXSR data */
/* Extended FXSR FPU environment: */
@@ -58,28 +58,28 @@ struct _fpstate_ia32 {
/* 32-bit compat sigcontext: */
struct sigcontext_ia32 {
- unsigned short gs, __gsh;
- unsigned short fs, __fsh;
- unsigned short es, __esh;
- unsigned short ds, __dsh;
- unsigned int di;
- unsigned int si;
- unsigned int bp;
- unsigned int sp;
- unsigned int bx;
- unsigned int dx;
- unsigned int cx;
- unsigned int ax;
- unsigned int trapno;
- unsigned int err;
- unsigned int ip;
- unsigned short cs, __csh;
- unsigned int flags;
- unsigned int sp_at_signal;
- unsigned short ss, __ssh;
- unsigned int fpstate; /* Pointer to 'struct _fpstate_ia32' */
- unsigned int oldmask;
- unsigned int cr2;
+ __u16 gs, __gsh;
+ __u16 fs, __fsh;
+ __u16 es, __esh;
+ __u16 ds, __dsh;
+ __u32 di;
+ __u32 si;
+ __u32 bp;
+ __u32 sp;
+ __u32 bx;
+ __u32 dx;
+ __u32 cx;
+ __u32 ax;
+ __u32 trapno;
+ __u32 err;
+ __u32 ip;
+ __u16 cs, __csh;
+ __u32 flags;
+ __u32 sp_at_signal;
+ __u16 ss, __ssh;
+ __u32 fpstate; /* Pointer to 'struct _fpstate_ia32' */
+ __u32 oldmask;
+ __u32 cr2;
};
#endif /* _ASM_X86_SIGCONTEXT32_H */
--
2.1.4
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 06/15] x86/headers: Unify register type definitions between 32-bit compat and i386
2015-09-05 7:32 [PATCH 00/15] x86/headers: Clean up sigcontext types and headers Ingo Molnar
` (4 preceding siblings ...)
2015-09-05 7:32 ` [PATCH 05/15] x86/headers: Use ABI types consistently in sigcontext*.h Ingo Molnar
@ 2015-09-05 7:32 ` Ingo Molnar
2015-09-08 14:26 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 07/15] x86/headers: Unify 'struct _fpstate_ia32' and i386 struct _fpstate Ingo Molnar
` (8 subsequent siblings)
14 siblings, 1 reply; 41+ messages in thread
From: Ingo Molnar @ 2015-09-05 7:32 UTC (permalink / raw)
To: linux-kernel
Cc: Mikko Rapeli, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
The following sigcontext related types were duplicated across native 32-bit and
compat 32-bit headers:
struct _fpreg;
struct _fpxreg;
struct _xmmreg;
X86_FXSR_MAGIC
Unify them.
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: Mikko Rapeli <mikko.rapeli@iki.fi>
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/include/uapi/asm/sigcontext.h | 3 ++-
arch/x86/include/uapi/asm/sigcontext32.h | 22 ----------------------
2 files changed, 2 insertions(+), 23 deletions(-)
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index 07b0e32a1d23..9df4df3e40ef 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -63,7 +63,6 @@ struct _fpx_sw_bytes {
__u32 padding[7];
};
-#ifdef __i386__
/*
* As documented in the iBCS2 standard:
*
@@ -96,6 +95,8 @@ struct _xmmreg {
#define X86_FXSR_MAGIC 0x0000
+#ifdef __i386__
+
struct _fpstate {
/* Legacy FPU environment: */
__u32 cw;
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
index 939a84885673..356caab997e7 100644
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -3,30 +3,8 @@
/* Signal context definitions for compat 32-bit programs: */
-#include <linux/types.h>
-
#include <asm/sigcontext.h>
-/* 10-byte legacy floating point register: */
-struct _fpreg {
- __u16 significand[4];
- __u16 exponent;
-};
-
-/* 16-byte floating point register: */
-struct _fpxreg {
- __u16 significand[4];
- __u16 exponent;
- __u16 padding[3];
-};
-
-/* 16-byte XMM vector register: */
-struct _xmmreg {
- __u32 element[4];
-};
-
-#define X86_FXSR_MAGIC 0x0000
-
/* FXSAVE frame: FSAVE frame with extensions */
struct _fpstate_ia32 {
/* Regular FPU environment: */
--
2.1.4
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 07/15] x86/headers: Unify 'struct _fpstate_ia32' and i386 struct _fpstate
2015-09-05 7:32 [PATCH 00/15] x86/headers: Clean up sigcontext types and headers Ingo Molnar
` (5 preceding siblings ...)
2015-09-05 7:32 ` [PATCH 06/15] x86/headers: Unify register type definitions between 32-bit compat and i386 Ingo Molnar
@ 2015-09-05 7:32 ` Ingo Molnar
2015-09-08 14:26 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 08/15] x86/headers: Convert uses of _fpstate_ia32 to _fpstate_32 Ingo Molnar
` (7 subsequent siblings)
14 siblings, 1 reply; 41+ messages in thread
From: Ingo Molnar @ 2015-09-05 7:32 UTC (permalink / raw)
To: linux-kernel
Cc: Mikko Rapeli, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
'struct _fpstate_ia32' and 'struct _fpstate' on i386 are identical in all fields,
except 'padding1' being named 'padding'.
We unify the two structures and add a union that is both named 'padding1' and
'padding', in the (unlikely) case there's user-space code that relies on the
padding field name.
We rename the two main types to be:
struct _fpstate_32
struct _fpstate_64
for the 32-bit and 64-bit frame, and map them to the main and compat structure
names (_fpstate) depending on whether we are on 32-bit or on 64-bit kernels.
We also keep the old _fpstate_ia32 name as a legacy name.
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: Mikko Rapeli <mikko.rapeli@iki.fi>
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/include/asm/sigframe.h | 1 -
arch/x86/include/uapi/asm/sigcontext.h | 26 +++++++++++++++++---------
arch/x86/include/uapi/asm/sigcontext32.h | 29 -----------------------------
3 files changed, 17 insertions(+), 39 deletions(-)
diff --git a/arch/x86/include/asm/sigframe.h b/arch/x86/include/asm/sigframe.h
index 7c7c27c97daa..67d3027520ee 100644
--- a/arch/x86/include/asm/sigframe.h
+++ b/arch/x86/include/asm/sigframe.h
@@ -9,7 +9,6 @@
#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 */
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index 9df4df3e40ef..85811167821f 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -95,9 +95,10 @@ struct _xmmreg {
#define X86_FXSR_MAGIC 0x0000
-#ifdef __i386__
-
-struct _fpstate {
+/*
+ * The 32-bit FPU frame:
+ */
+struct _fpstate_32 {
/* Legacy FPU environment: */
__u32 cw;
__u32 sw;
@@ -117,7 +118,10 @@ struct _fpstate {
__u32 reserved;
struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */
struct _xmmreg _xmm[8]; /* First 8 XMM registers */
- __u32 padding1[44]; /* Second 8 XMM registers plus padding */
+ union {
+ __u32 padding1[44]; /* Second 8 XMM registers plus padding */
+ __u32 padding[44]; /* Alias name for old user-space */
+ };
union {
__u32 padding2[12];
@@ -125,10 +129,8 @@ struct _fpstate {
};
};
-#else /* __x86_64__: */
-
/*
- * The FXSAVE frame.
+ * The 64-bit FPU frame. (FXSAVE format and later)
*
* Note1: If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then the structure is
* larger: 'struct _xstate'. Note that 'struct _xstate' embedds
@@ -138,7 +140,7 @@ struct _fpstate {
* Note2: Reserved fields may someday contain valuable data. Always save/restore
* them when you change signal frames.
*/
-struct _fpstate {
+struct _fpstate_64 {
__u16 cwd;
__u16 swd;
/* Note this is not the same as the 32-bit/x87/FSAVE twd: */
@@ -157,7 +159,13 @@ struct _fpstate {
};
};
-#endif /* __x86_64__ */
+#ifdef __i386__
+# define _fpstate _fpstate_32
+#else
+# define _fpstate _fpstate_64
+#endif
+
+#define _fpstate_ia32 _fpstate_32
struct _header {
__u64 xfeatures;
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
index 356caab997e7..19a89165ea1d 100644
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -5,35 +5,6 @@
#include <asm/sigcontext.h>
-/* FXSAVE frame: FSAVE frame with extensions */
-struct _fpstate_ia32 {
- /* Regular FPU environment: */
- __u32 cw;
- __u32 sw;
- __u32 tag; /* Not compatible with the 64-bit frame */
- __u32 ipoff;
- __u32 cssel;
- __u32 dataoff;
- __u32 datasel;
- struct _fpreg _st[8];
- __u16 status;
- __u16 magic; /* 0xffff: regular FPU data only */
- /* 0x0000: FXSR data */
-
- /* Extended FXSR FPU environment: */
- __u32 _fxsr_env[6];
- __u32 mxcsr;
- __u32 reserved;
- struct _fpxreg _fxsr_st[8];
- struct _xmmreg _xmm[8]; /* The first 8 XMM registers */
- __u32 padding[44]; /* The second 8 XMM registers plus padding */
- union {
- __u32 padding2[12];
- /* Might encode xstate extensions, see asm/sigcontext.h: */
- struct _fpx_sw_bytes sw_reserved;
- };
-};
-
/* 32-bit compat sigcontext: */
struct sigcontext_ia32 {
__u16 gs, __gsh;
--
2.1.4
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 08/15] x86/headers: Convert uses of _fpstate_ia32 to _fpstate_32
2015-09-05 7:32 [PATCH 00/15] x86/headers: Clean up sigcontext types and headers Ingo Molnar
` (6 preceding siblings ...)
2015-09-05 7:32 ` [PATCH 07/15] x86/headers: Unify 'struct _fpstate_ia32' and i386 struct _fpstate Ingo Molnar
@ 2015-09-05 7:32 ` Ingo Molnar
2015-09-08 14:27 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 09/15] x86/headers: Clean up the kernel's struct sigcontext types to be ABI-clean Ingo Molnar
` (6 subsequent siblings)
14 siblings, 1 reply; 41+ messages in thread
From: Ingo Molnar @ 2015-09-05 7:32 UTC (permalink / raw)
To: linux-kernel
Cc: Mikko Rapeli, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
Remove uses of _fpstate_ia32 from the kernel, and move the legacy
_fpstate_ia32 definition to the user-space only portion of the
header.
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: Mikko Rapeli <mikko.rapeli@iki.fi>
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/ia32/ia32_signal.c | 2 +-
arch/x86/include/asm/sigframe.h | 2 +-
arch/x86/include/uapi/asm/sigcontext.h | 5 +++--
arch/x86/include/uapi/asm/sigcontext32.h | 2 +-
arch/x86/kernel/fpu/signal.c | 4 ++--
5 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index ae3a29ae875b..805d76b21d95 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -327,7 +327,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;
diff --git a/arch/x86/include/asm/sigframe.h b/arch/x86/include/asm/sigframe.h
index 67d3027520ee..38ade7255a21 100644
--- a/arch/x86/include/asm/sigframe.h
+++ b/arch/x86/include/asm/sigframe.h
@@ -31,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 */
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index 85811167821f..ca542e37c783 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -165,8 +165,6 @@ struct _fpstate_64 {
# define _fpstate _fpstate_64
#endif
-#define _fpstate_ia32 _fpstate_32
-
struct _header {
__u64 xfeatures;
__u64 reserved1[2];
@@ -198,6 +196,9 @@ struct _xstate {
* field names but otherwise the same layout.
*/
#ifndef __KERNEL__
+
+#define _fpstate_ia32 _fpstate_32
+
# ifdef __i386__
struct sigcontext {
__u16 gs, __gsh;
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
index 19a89165ea1d..06c749b40263 100644
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -26,7 +26,7 @@ struct sigcontext_ia32 {
__u32 flags;
__u32 sp_at_signal;
__u16 ss, __ssh;
- __u32 fpstate; /* Pointer to 'struct _fpstate_ia32' */
+ __u32 fpstate; /* Pointer to 'struct _fpstate_32' */
__u32 oldmask;
__u32 cr2;
};
diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c
index 50ec9af1bd51..24aac16603a2 100644
--- a/arch/x86/kernel/fpu/signal.c
+++ b/arch/x86/kernel/fpu/signal.c
@@ -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. */
--
2.1.4
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 09/15] x86/headers: Clean up the kernel's struct sigcontext types to be ABI-clean
2015-09-05 7:32 [PATCH 00/15] x86/headers: Clean up sigcontext types and headers Ingo Molnar
` (7 preceding siblings ...)
2015-09-05 7:32 ` [PATCH 08/15] x86/headers: Convert uses of _fpstate_ia32 to _fpstate_32 Ingo Molnar
@ 2015-09-05 7:32 ` Ingo Molnar
2015-09-08 14:27 ` [tip:x86/headers] x86/headers: Clean up the kernel' s " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 10/15] x86/headers: Move the 'struct sigcontext' definitions into the UAPI header Ingo Molnar
` (5 subsequent siblings)
14 siblings, 1 reply; 41+ messages in thread
From: Ingo Molnar @ 2015-09-05 7:32 UTC (permalink / raw)
To: linux-kernel
Cc: Mikko Rapeli, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
Use the __u16/32/64 types we standardized on in ABI definitions and which
other sigcontext related types are already using.
This will help unify struct sigcontext types between native 32-bit, compat
and 64-bit kernels.
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: Mikko Rapeli <mikko.rapeli@iki.fi>
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/include/asm/sigcontext.h | 104 +++++++++++++++++++-------------------
1 file changed, 52 insertions(+), 52 deletions(-)
diff --git a/arch/x86/include/asm/sigcontext.h b/arch/x86/include/asm/sigcontext.h
index 9dfce4e0417d..b9c2bd6402df 100644
--- a/arch/x86/include/asm/sigcontext.h
+++ b/arch/x86/include/asm/sigcontext.h
@@ -5,25 +5,25 @@
#ifdef __i386__
struct sigcontext {
- unsigned short gs, __gsh;
- unsigned short fs, __fsh;
- unsigned short es, __esh;
- unsigned short ds, __dsh;
- unsigned long di;
- unsigned long si;
- unsigned long bp;
- unsigned long sp;
- unsigned long bx;
- unsigned long dx;
- unsigned long cx;
- unsigned long ax;
- unsigned long trapno;
- unsigned long err;
- unsigned long ip;
- unsigned short cs, __csh;
- unsigned long flags;
- unsigned long sp_at_signal;
- unsigned short ss, __ssh;
+ __u16 gs, __gsh;
+ __u16 fs, __fsh;
+ __u16 es, __esh;
+ __u16 ds, __dsh;
+ __u32 di;
+ __u32 si;
+ __u32 bp;
+ __u32 sp;
+ __u32 bx;
+ __u32 dx;
+ __u32 cx;
+ __u32 ax;
+ __u32 trapno;
+ __u32 err;
+ __u32 ip;
+ __u16 cs, __csh;
+ __u32 flags;
+ __u32 sp_at_signal;
+ __u16 ss, __ssh;
/*
* fpstate is really (struct _fpstate *) or (struct _xstate *)
@@ -32,38 +32,38 @@ struct sigcontext {
* of extended memory layout. See comments at the definition of
* (struct _fpx_sw_bytes)
*/
- void __user *fpstate; /* zero when no FPU/extended context */
- unsigned long oldmask;
- unsigned long cr2;
+ void __user *fpstate; /* Zero when no FPU/extended context */
+ __u32 oldmask;
+ __u32 cr2;
};
-#else /* __i386__ */
+#else /* __x86_64__: */
struct sigcontext {
- unsigned long r8;
- unsigned long r9;
- unsigned long r10;
- unsigned long r11;
- unsigned long r12;
- unsigned long r13;
- unsigned long r14;
- unsigned long r15;
- unsigned long di;
- unsigned long si;
- unsigned long bp;
- unsigned long bx;
- unsigned long dx;
- unsigned long ax;
- unsigned long cx;
- unsigned long sp;
- unsigned long ip;
- unsigned long flags;
- unsigned short cs;
- unsigned short gs;
- unsigned short fs;
- unsigned short __pad0;
- unsigned long err;
- unsigned long trapno;
- unsigned long oldmask;
- unsigned long cr2;
+ __u64 r8;
+ __u64 r9;
+ __u64 r10;
+ __u64 r11;
+ __u64 r12;
+ __u64 r13;
+ __u64 r14;
+ __u64 r15;
+ __u64 di;
+ __u64 si;
+ __u64 bp;
+ __u64 bx;
+ __u64 dx;
+ __u64 ax;
+ __u64 cx;
+ __u64 sp;
+ __u64 ip;
+ __u64 flags;
+ __u16 cs;
+ __u16 gs;
+ __u16 fs;
+ __u16 __pad0;
+ __u64 err;
+ __u64 trapno;
+ __u64 oldmask;
+ __u64 cr2;
/*
* fpstate is really (struct _fpstate *) or (struct _xstate *)
@@ -72,8 +72,8 @@ struct sigcontext {
* of extended memory layout. See comments at the definition of
* (struct _fpx_sw_bytes)
*/
- void __user *fpstate; /* zero when no FPU/extended context */
- unsigned long reserved1[8];
+ void __user *fpstate; /* Zero when no FPU/extended context */
+ __u64 reserved1[8];
};
-#endif /* !__i386__ */
+#endif /* !__x86_64__ */
#endif /* _ASM_X86_SIGCONTEXT_H */
--
2.1.4
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 10/15] x86/headers: Move the 'struct sigcontext' definitions into the UAPI header
2015-09-05 7:32 [PATCH 00/15] x86/headers: Clean up sigcontext types and headers Ingo Molnar
` (8 preceding siblings ...)
2015-09-05 7:32 ` [PATCH 09/15] x86/headers: Clean up the kernel's struct sigcontext types to be ABI-clean Ingo Molnar
@ 2015-09-05 7:32 ` Ingo Molnar
2015-09-08 14:27 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 11/15] x86/headers: Make sigcontext pointers bit independent Ingo Molnar
` (4 subsequent siblings)
14 siblings, 1 reply; 41+ messages in thread
From: Ingo Molnar @ 2015-09-05 7:32 UTC (permalink / raw)
To: linux-kernel
Cc: Mikko Rapeli, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
Our goal is to eliminate the duplicate struct sigcontext_ia32 definition, so
move the kernel's primary sigcontext type into the UAPI header, defining
these two variants:
struct sigcontext_32
struct sigcontext_64
... and map them to 'struct sigcontext'.
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: Mikko Rapeli <mikko.rapeli@iki.fi>
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/include/asm/sigcontext.h | 73 ------------------------------
arch/x86/include/uapi/asm/sigcontext.h | 83 ++++++++++++++++++++++++++++++++++
2 files changed, 83 insertions(+), 73 deletions(-)
diff --git a/arch/x86/include/asm/sigcontext.h b/arch/x86/include/asm/sigcontext.h
index b9c2bd6402df..25815f00b4ff 100644
--- a/arch/x86/include/asm/sigcontext.h
+++ b/arch/x86/include/asm/sigcontext.h
@@ -3,77 +3,4 @@
#include <uapi/asm/sigcontext.h>
-#ifdef __i386__
-struct sigcontext {
- __u16 gs, __gsh;
- __u16 fs, __fsh;
- __u16 es, __esh;
- __u16 ds, __dsh;
- __u32 di;
- __u32 si;
- __u32 bp;
- __u32 sp;
- __u32 bx;
- __u32 dx;
- __u32 cx;
- __u32 ax;
- __u32 trapno;
- __u32 err;
- __u32 ip;
- __u16 cs, __csh;
- __u32 flags;
- __u32 sp_at_signal;
- __u16 ss, __ssh;
-
- /*
- * fpstate is really (struct _fpstate *) or (struct _xstate *)
- * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved
- * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end
- * of extended memory layout. See comments at the definition of
- * (struct _fpx_sw_bytes)
- */
- void __user *fpstate; /* Zero when no FPU/extended context */
- __u32 oldmask;
- __u32 cr2;
-};
-#else /* __x86_64__: */
-struct sigcontext {
- __u64 r8;
- __u64 r9;
- __u64 r10;
- __u64 r11;
- __u64 r12;
- __u64 r13;
- __u64 r14;
- __u64 r15;
- __u64 di;
- __u64 si;
- __u64 bp;
- __u64 bx;
- __u64 dx;
- __u64 ax;
- __u64 cx;
- __u64 sp;
- __u64 ip;
- __u64 flags;
- __u16 cs;
- __u16 gs;
- __u16 fs;
- __u16 __pad0;
- __u64 err;
- __u64 trapno;
- __u64 oldmask;
- __u64 cr2;
-
- /*
- * fpstate is really (struct _fpstate *) or (struct _xstate *)
- * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved
- * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end
- * of extended memory layout. See comments at the definition of
- * (struct _fpx_sw_bytes)
- */
- void __user *fpstate; /* Zero when no FPU/extended context */
- __u64 reserved1[8];
-};
-#endif /* !__x86_64__ */
#endif /* _ASM_X86_SIGCONTEXT_H */
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index ca542e37c783..3591cef6d7d2 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -190,6 +190,89 @@ struct _xstate {
/* New processor state extensions go here: */
};
+struct sigcontext_32 {
+ __u16 gs, __gsh;
+ __u16 fs, __fsh;
+ __u16 es, __esh;
+ __u16 ds, __dsh;
+ __u32 di;
+ __u32 si;
+ __u32 bp;
+ __u32 sp;
+ __u32 bx;
+ __u32 dx;
+ __u32 cx;
+ __u32 ax;
+ __u32 trapno;
+ __u32 err;
+ __u32 ip;
+ __u16 cs, __csh;
+ __u32 flags;
+ __u32 sp_at_signal;
+ __u16 ss, __ssh;
+
+ /*
+ * fpstate is really (struct _fpstate *) or (struct _xstate *)
+ * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved
+ * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end
+ * of extended memory layout. See comments at the definition of
+ * (struct _fpx_sw_bytes)
+ */
+ void __user *fpstate; /* Zero when no FPU/extended context */
+ __u32 oldmask;
+ __u32 cr2;
+};
+
+struct sigcontext_64 {
+ __u64 r8;
+ __u64 r9;
+ __u64 r10;
+ __u64 r11;
+ __u64 r12;
+ __u64 r13;
+ __u64 r14;
+ __u64 r15;
+ __u64 di;
+ __u64 si;
+ __u64 bp;
+ __u64 bx;
+ __u64 dx;
+ __u64 ax;
+ __u64 cx;
+ __u64 sp;
+ __u64 ip;
+ __u64 flags;
+ __u16 cs;
+ __u16 gs;
+ __u16 fs;
+ __u16 __pad0;
+ __u64 err;
+ __u64 trapno;
+ __u64 oldmask;
+ __u64 cr2;
+
+ /*
+ * fpstate is really (struct _fpstate *) or (struct _xstate *)
+ * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved
+ * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end
+ * of extended memory layout. See comments at the definition of
+ * (struct _fpx_sw_bytes)
+ */
+ void __user *fpstate; /* Zero when no FPU/extended context */
+ __u64 reserved1[8];
+};
+
+/*
+ * Create the real 'struct sigcontext' type:
+ */
+#ifdef __KERNEL__
+# ifdef __i386__
+# define sigcontext sigcontext_32
+# else
+# define sigcontext sigcontext_64
+# endif
+#endif
+
/*
* The old user-space sigcontext definition, just in case user-space still
* relies on it. The kernel definition (in asm/sigcontext.h) has unified
--
2.1.4
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 11/15] x86/headers: Make sigcontext pointers bit independent
2015-09-05 7:32 [PATCH 00/15] x86/headers: Clean up sigcontext types and headers Ingo Molnar
` (9 preceding siblings ...)
2015-09-05 7:32 ` [PATCH 10/15] x86/headers: Move the 'struct sigcontext' definitions into the UAPI header Ingo Molnar
@ 2015-09-05 7:32 ` Ingo Molnar
2015-09-08 14:28 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 12/15] x86/headers: Unify 'struct sigcontext_ia32' and 'struct sigcontext_32' Ingo Molnar
` (3 subsequent siblings)
14 siblings, 1 reply; 41+ messages in thread
From: Ingo Molnar @ 2015-09-05 7:32 UTC (permalink / raw)
To: linux-kernel
Cc: Mikko Rapeli, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
Before we can eliminate the duplication between 'struct sigcontext_32'
and 'struct sigcontext_ia32', make the 'fpstate' pointer field in
'struct sigcontext_32' bit independent.
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: Mikko Rapeli <mikko.rapeli@iki.fi>
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/include/uapi/asm/sigcontext.h | 4 ++--
arch/x86/kernel/signal.c | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index 3591cef6d7d2..d0def259d545 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -218,7 +218,7 @@ struct sigcontext_32 {
* of extended memory layout. See comments at the definition of
* (struct _fpx_sw_bytes)
*/
- void __user *fpstate; /* Zero when no FPU/extended context */
+ __u32 fpstate; /* Zero when no FPU/extended context */
__u32 oldmask;
__u32 cr2;
};
@@ -258,7 +258,7 @@ struct sigcontext_64 {
* of extended memory layout. See comments at the definition of
* (struct _fpx_sw_bytes)
*/
- void __user *fpstate; /* Zero when no FPU/extended context */
+ __u64 fpstate; /* Zero when no FPU/extended context */
__u64 reserved1[8];
};
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 71820c42b6ce..373f87cbbdf5 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -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));
--
2.1.4
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 12/15] x86/headers: Unify 'struct sigcontext_ia32' and 'struct sigcontext_32'
2015-09-05 7:32 [PATCH 00/15] x86/headers: Clean up sigcontext types and headers Ingo Molnar
` (10 preceding siblings ...)
2015-09-05 7:32 ` [PATCH 11/15] x86/headers: Make sigcontext pointers bit independent Ingo Molnar
@ 2015-09-05 7:32 ` Ingo Molnar
2015-09-08 14:28 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 13/15] x86/headers: Convert sigcontext_ia32 uses to sigcontext_32 Ingo Molnar
` (2 subsequent siblings)
14 siblings, 1 reply; 41+ messages in thread
From: Ingo Molnar @ 2015-09-05 7:32 UTC (permalink / raw)
To: linux-kernel
Cc: Mikko Rapeli, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
The two structures are identical - merge them and keep the legacy name
as a define.
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: Mikko Rapeli <mikko.rapeli@iki.fi>
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/include/asm/sigframe.h | 1 -
arch/x86/include/uapi/asm/sigcontext.h | 2 ++
arch/x86/include/uapi/asm/sigcontext32.h | 26 --------------------------
3 files changed, 2 insertions(+), 27 deletions(-)
diff --git a/arch/x86/include/asm/sigframe.h b/arch/x86/include/asm/sigframe.h
index 38ade7255a21..cfb22e3105f1 100644
--- a/arch/x86/include/asm/sigframe.h
+++ b/arch/x86/include/asm/sigframe.h
@@ -8,7 +8,6 @@
#ifdef CONFIG_X86_32
#define sigframe_ia32 sigframe
#define rt_sigframe_ia32 rt_sigframe
-#define sigcontext_ia32 sigcontext
#define ucontext_ia32 ucontext
#else /* !CONFIG_X86_32 */
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index d0def259d545..592bfafd5cb2 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -223,6 +223,8 @@ struct sigcontext_32 {
__u32 cr2;
};
+#define sigcontext_ia32 sigcontext_32
+
struct sigcontext_64 {
__u64 r8;
__u64 r9;
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
index 06c749b40263..257fbb3baaa7 100644
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -5,30 +5,4 @@
#include <asm/sigcontext.h>
-/* 32-bit compat sigcontext: */
-struct sigcontext_ia32 {
- __u16 gs, __gsh;
- __u16 fs, __fsh;
- __u16 es, __esh;
- __u16 ds, __dsh;
- __u32 di;
- __u32 si;
- __u32 bp;
- __u32 sp;
- __u32 bx;
- __u32 dx;
- __u32 cx;
- __u32 ax;
- __u32 trapno;
- __u32 err;
- __u32 ip;
- __u16 cs, __csh;
- __u32 flags;
- __u32 sp_at_signal;
- __u16 ss, __ssh;
- __u32 fpstate; /* Pointer to 'struct _fpstate_32' */
- __u32 oldmask;
- __u32 cr2;
-};
-
#endif /* _ASM_X86_SIGCONTEXT32_H */
--
2.1.4
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 13/15] x86/headers: Convert sigcontext_ia32 uses to sigcontext_32
2015-09-05 7:32 [PATCH 00/15] x86/headers: Clean up sigcontext types and headers Ingo Molnar
` (11 preceding siblings ...)
2015-09-05 7:32 ` [PATCH 12/15] x86/headers: Unify 'struct sigcontext_ia32' and 'struct sigcontext_32' Ingo Molnar
@ 2015-09-05 7:32 ` Ingo Molnar
2015-09-08 14:28 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 14/15] x86/headers: Remove direct sigcontext32.h uses Ingo Molnar
2015-09-05 7:32 ` [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> Ingo Molnar
14 siblings, 1 reply; 41+ messages in thread
From: Ingo Molnar @ 2015-09-05 7:32 UTC (permalink / raw)
To: linux-kernel
Cc: Mikko Rapeli, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
Use the new name in kernel code, and move the old name to the
user-space-only legacy section of the UAPI header.
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: Mikko Rapeli <mikko.rapeli@iki.fi>
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/ia32/ia32_signal.c | 4 ++--
arch/x86/include/asm/ia32.h | 2 +-
arch/x86/include/asm/sigframe.h | 2 +-
arch/x86/include/uapi/asm/sigcontext.h | 12 +++++++++---
arch/x86/kernel/asm-offsets.c | 18 +++++++++---------
5 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index 805d76b21d95..26d33633e2b1 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -161,7 +161,7 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)
}
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;
@@ -263,7 +263,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)
{
diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h
index d0e8e0141041..ace08ed8fee3 100644
--- a/arch/x86/include/asm/ia32.h
+++ b/arch/x86/include/asm/ia32.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 */
};
diff --git a/arch/x86/include/asm/sigframe.h b/arch/x86/include/asm/sigframe.h
index cfb22e3105f1..cb8f917248cb 100644
--- a/arch/x86/include/asm/sigframe.h
+++ b/arch/x86/include/asm/sigframe.h
@@ -21,7 +21,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
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index 592bfafd5cb2..4411e6a8f8e7 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -190,6 +190,9 @@ struct _xstate {
/* New processor state extensions go here: */
};
+/*
+ * The 32-bit signal frame:
+ */
struct sigcontext_32 {
__u16 gs, __gsh;
__u16 fs, __fsh;
@@ -223,8 +226,9 @@ struct sigcontext_32 {
__u32 cr2;
};
-#define sigcontext_ia32 sigcontext_32
-
+/*
+ * The 64-bit signal frame:
+ */
struct sigcontext_64 {
__u64 r8;
__u64 r9;
@@ -282,7 +286,9 @@ struct sigcontext_64 {
*/
#ifndef __KERNEL__
-#define _fpstate_ia32 _fpstate_32
+#define _fpstate_ia32 _fpstate_32
+#define sigcontext_ia32 sigcontext_32
+
# ifdef __i386__
struct sigcontext {
diff --git a/arch/x86/kernel/asm-offsets.c b/arch/x86/kernel/asm-offsets.c
index 8e3d22a1af94..bc9f4afa889a 100644
--- a/arch/x86/kernel/asm-offsets.c
+++ b/arch/x86/kernel/asm-offsets.c
@@ -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);
--
2.1.4
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 14/15] x86/headers: Remove direct sigcontext32.h uses
2015-09-05 7:32 [PATCH 00/15] x86/headers: Clean up sigcontext types and headers Ingo Molnar
` (12 preceding siblings ...)
2015-09-05 7:32 ` [PATCH 13/15] x86/headers: Convert sigcontext_ia32 uses to sigcontext_32 Ingo Molnar
@ 2015-09-05 7:32 ` Ingo Molnar
2015-09-08 14:29 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> Ingo Molnar
14 siblings, 1 reply; 41+ messages in thread
From: Ingo Molnar @ 2015-09-05 7:32 UTC (permalink / raw)
To: linux-kernel
Cc: Mikko Rapeli, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
Now that all sigcontext types are defined in asm/sigcontext.h, remove the
various sigcontext32.h uses in the kernel.
We still keep the header itself, which includes sigcontext.h, in case user-space
relies on it.
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: Mikko Rapeli <mikko.rapeli@iki.fi>
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/ia32/ia32_signal.c | 2 +-
arch/x86/include/asm/fpu/signal.h | 2 +-
arch/x86/include/asm/ia32.h | 2 +-
arch/x86/include/uapi/asm/sigcontext32.h | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index 26d33633e2b1..f49a4426ad1c 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -26,7 +26,7 @@
#include <asm/ptrace.h>
#include <asm/ia32_unistd.h>
#include <asm/user32.h>
-#include <asm/sigcontext32.h>
+#include <asm/sigcontext.h>
#include <asm/proto.h>
#include <asm/vdso.h>
#include <asm/sigframe.h>
diff --git a/arch/x86/include/asm/fpu/signal.h b/arch/x86/include/asm/fpu/signal.h
index 7358e9d61f1e..856f4b3cf1e3 100644
--- a/arch/x86/include/asm/fpu/signal.h
+++ b/arch/x86/include/asm/fpu/signal.h
@@ -5,7 +5,7 @@
#define _ASM_X86_FPU_SIGNAL_H
#ifdef CONFIG_X86_64
-# include <asm/sigcontext32.h>
+# include <asm/sigcontext.h>
# include <asm/user32.h>
struct ksignal;
int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h
index ace08ed8fee3..b47312447786 100644
--- a/arch/x86/include/asm/ia32.h
+++ b/arch/x86/include/asm/ia32.h
@@ -10,7 +10,7 @@
* 32 bit structures for IA32 support.
*/
-#include <asm/sigcontext32.h>
+#include <asm/sigcontext.h>
/* signal.h */
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
index 257fbb3baaa7..a92b0f0dc09e 100644
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -1,7 +1,7 @@
#ifndef _ASM_X86_SIGCONTEXT32_H
#define _ASM_X86_SIGCONTEXT32_H
-/* Signal context definitions for compat 32-bit programs: */
+/* This is a legacy file - all the type definitions are in sigcontext.h: */
#include <asm/sigcontext.h>
--
2.1.4
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h>
2015-09-05 7:32 [PATCH 00/15] x86/headers: Clean up sigcontext types and headers Ingo Molnar
` (13 preceding siblings ...)
2015-09-05 7:32 ` [PATCH 14/15] x86/headers: Remove direct sigcontext32.h uses Ingo Molnar
@ 2015-09-05 7:32 ` Ingo Molnar
2015-09-05 10:57 ` Mikko Rapeli
2015-09-08 14:29 ` [tip:x86/headers] x86/headers: Remove <asm/sigcontext.h> references on the kernel side tip-bot for Ingo Molnar
14 siblings, 2 replies; 41+ messages in thread
From: Ingo Molnar @ 2015-09-05 7:32 UTC (permalink / raw)
To: linux-kernel
Cc: Mikko Rapeli, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
Now that all type definitions are in the UAPI header, remove the <asm/sigcontext.h> wrapper.
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: Mikko Rapeli <mikko.rapeli@iki.fi>
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/ia32/ia32_signal.c | 2 +-
arch/x86/include/asm/fpu/signal.h | 2 +-
arch/x86/include/asm/ia32.h | 2 +-
arch/x86/include/asm/processor.h | 2 +-
arch/x86/include/asm/sigcontext.h | 6 ------
arch/x86/include/asm/sigframe.h | 2 +-
arch/x86/include/asm/signal.h | 2 +-
arch/x86/include/uapi/asm/sigcontext32.h | 2 +-
arch/x86/math-emu/fpu_emu.h | 2 +-
9 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index f49a4426ad1c..a5d32937acfd 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -26,7 +26,7 @@
#include <asm/ptrace.h>
#include <asm/ia32_unistd.h>
#include <asm/user32.h>
-#include <asm/sigcontext.h>
+#include <uapi/asm/sigcontext.h>
#include <asm/proto.h>
#include <asm/vdso.h>
#include <asm/sigframe.h>
diff --git a/arch/x86/include/asm/fpu/signal.h b/arch/x86/include/asm/fpu/signal.h
index 856f4b3cf1e3..0e970d00dfcd 100644
--- a/arch/x86/include/asm/fpu/signal.h
+++ b/arch/x86/include/asm/fpu/signal.h
@@ -5,7 +5,7 @@
#define _ASM_X86_FPU_SIGNAL_H
#ifdef CONFIG_X86_64
-# include <asm/sigcontext.h>
+# include <uapi/asm/sigcontext.h>
# include <asm/user32.h>
struct ksignal;
int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h
index b47312447786..fee07c70773a 100644
--- a/arch/x86/include/asm/ia32.h
+++ b/arch/x86/include/asm/ia32.h
@@ -10,7 +10,7 @@
* 32 bit structures for IA32 support.
*/
-#include <asm/sigcontext.h>
+#include <uapi/asm/sigcontext.h>
/* signal.h */
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 944f1785ed0d..3fded5308f29 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -11,7 +11,7 @@ struct mm_struct;
#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>
diff --git a/arch/x86/include/asm/sigcontext.h b/arch/x86/include/asm/sigcontext.h
deleted file mode 100644
index 25815f00b4ff..000000000000
--- a/arch/x86/include/asm/sigcontext.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _ASM_X86_SIGCONTEXT_H
-#define _ASM_X86_SIGCONTEXT_H
-
-#include <uapi/asm/sigcontext.h>
-
-#endif /* _ASM_X86_SIGCONTEXT_H */
diff --git a/arch/x86/include/asm/sigframe.h b/arch/x86/include/asm/sigframe.h
index cb8f917248cb..1adf8821bd5c 100644
--- a/arch/x86/include/asm/sigframe.h
+++ b/arch/x86/include/asm/sigframe.h
@@ -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>
diff --git a/arch/x86/include/asm/signal.h b/arch/x86/include/asm/signal.h
index 31eab867e6d3..2002c2e07649 100644
--- a/arch/x86/include/asm/signal.h
+++ b/arch/x86/include/asm/signal.h
@@ -34,7 +34,7 @@ extern void do_notify_resume(struct pt_regs *, void *, __u32);
#define __ARCH_HAS_SA_RESTORER
-#include <asm/sigcontext.h>
+#include <uapi/asm/sigcontext.h>
#ifdef __i386__
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
index a92b0f0dc09e..8b870175befa 100644
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -3,6 +3,6 @@
/* This is a legacy file - all the type definitions are in sigcontext.h: */
-#include <asm/sigcontext.h>
+#include <uapi/asm/sigcontext.h>
#endif /* _ASM_X86_SIGCONTEXT32_H */
diff --git a/arch/x86/math-emu/fpu_emu.h b/arch/x86/math-emu/fpu_emu.h
index 4dae511c85ad..afbc4d805d66 100644
--- a/arch/x86/math-emu/fpu_emu.h
+++ b/arch/x86/math-emu/fpu_emu.h
@@ -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>
--
2.1.4
^ permalink raw reply related [flat|nested] 41+ messages in thread
* Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h>
2015-09-05 7:32 ` [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> Ingo Molnar
@ 2015-09-05 10:57 ` Mikko Rapeli
2015-09-05 11:59 ` Ingo Molnar
2015-09-08 14:29 ` [tip:x86/headers] x86/headers: Remove <asm/sigcontext.h> references on the kernel side tip-bot for Ingo Molnar
1 sibling, 1 reply; 41+ messages in thread
From: Mikko Rapeli @ 2015-09-05 10:57 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
On Sat, Sep 05, 2015 at 09:32:43AM +0200, Ingo Molnar wrote:
> Now that all type definitions are in the UAPI header, remove the <asm/sigcontext.h> wrapper.
>
> 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: Mikko Rapeli <mikko.rapeli@iki.fi>
> 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/ia32/ia32_signal.c | 2 +-
> arch/x86/include/asm/fpu/signal.h | 2 +-
> arch/x86/include/asm/ia32.h | 2 +-
> arch/x86/include/asm/processor.h | 2 +-
> arch/x86/include/asm/sigcontext.h | 6 ------
> arch/x86/include/asm/sigframe.h | 2 +-
> arch/x86/include/asm/signal.h | 2 +-
> arch/x86/include/uapi/asm/sigcontext32.h | 2 +-
> arch/x86/math-emu/fpu_emu.h | 2 +-
> 9 files changed, 8 insertions(+), 14 deletions(-)
>
> diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
> index f49a4426ad1c..a5d32937acfd 100644
> --- a/arch/x86/ia32/ia32_signal.c
> +++ b/arch/x86/ia32/ia32_signal.c
> @@ -26,7 +26,7 @@
> #include <asm/ptrace.h>
> #include <asm/ia32_unistd.h>
> #include <asm/user32.h>
> -#include <asm/sigcontext.h>
> +#include <uapi/asm/sigcontext.h>
> #include <asm/proto.h>
> #include <asm/vdso.h>
> #include <asm/sigframe.h>
> diff --git a/arch/x86/include/asm/fpu/signal.h b/arch/x86/include/asm/fpu/signal.h
> index 856f4b3cf1e3..0e970d00dfcd 100644
> --- a/arch/x86/include/asm/fpu/signal.h
> +++ b/arch/x86/include/asm/fpu/signal.h
> @@ -5,7 +5,7 @@
> #define _ASM_X86_FPU_SIGNAL_H
>
> #ifdef CONFIG_X86_64
> -# include <asm/sigcontext.h>
> +# include <uapi/asm/sigcontext.h>
> # include <asm/user32.h>
> struct ksignal;
> int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
> diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h
> index b47312447786..fee07c70773a 100644
> --- a/arch/x86/include/asm/ia32.h
> +++ b/arch/x86/include/asm/ia32.h
> @@ -10,7 +10,7 @@
> * 32 bit structures for IA32 support.
> */
>
> -#include <asm/sigcontext.h>
> +#include <uapi/asm/sigcontext.h>
>
> /* signal.h */
>
> diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
> index 944f1785ed0d..3fded5308f29 100644
> --- a/arch/x86/include/asm/processor.h
> +++ b/arch/x86/include/asm/processor.h
> @@ -11,7 +11,7 @@ struct mm_struct;
> #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>
> diff --git a/arch/x86/include/asm/sigcontext.h b/arch/x86/include/asm/sigcontext.h
> deleted file mode 100644
> index 25815f00b4ff..000000000000
> --- a/arch/x86/include/asm/sigcontext.h
> +++ /dev/null
> @@ -1,6 +0,0 @@
> -#ifndef _ASM_X86_SIGCONTEXT_H
> -#define _ASM_X86_SIGCONTEXT_H
> -
> -#include <uapi/asm/sigcontext.h>
> -
> -#endif /* _ASM_X86_SIGCONTEXT_H */
> diff --git a/arch/x86/include/asm/sigframe.h b/arch/x86/include/asm/sigframe.h
> index cb8f917248cb..1adf8821bd5c 100644
> --- a/arch/x86/include/asm/sigframe.h
> +++ b/arch/x86/include/asm/sigframe.h
> @@ -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>
>
> diff --git a/arch/x86/include/asm/signal.h b/arch/x86/include/asm/signal.h
> index 31eab867e6d3..2002c2e07649 100644
> --- a/arch/x86/include/asm/signal.h
> +++ b/arch/x86/include/asm/signal.h
> @@ -34,7 +34,7 @@ extern void do_notify_resume(struct pt_regs *, void *, __u32);
>
> #define __ARCH_HAS_SA_RESTORER
>
> -#include <asm/sigcontext.h>
> +#include <uapi/asm/sigcontext.h>
>
> #ifdef __i386__
>
> diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
> index a92b0f0dc09e..8b870175befa 100644
> --- a/arch/x86/include/uapi/asm/sigcontext32.h
> +++ b/arch/x86/include/uapi/asm/sigcontext32.h
> @@ -3,6 +3,6 @@
>
> /* This is a legacy file - all the type definitions are in sigcontext.h: */
>
> -#include <asm/sigcontext.h>
> +#include <uapi/asm/sigcontext.h>
This needs to be without uapi directory in path.
-Mikko
> #endif /* _ASM_X86_SIGCONTEXT32_H */
> diff --git a/arch/x86/math-emu/fpu_emu.h b/arch/x86/math-emu/fpu_emu.h
> index 4dae511c85ad..afbc4d805d66 100644
> --- a/arch/x86/math-emu/fpu_emu.h
> +++ b/arch/x86/math-emu/fpu_emu.h
> @@ -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>
>
> --
> 2.1.4
>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h>
2015-09-05 10:57 ` Mikko Rapeli
@ 2015-09-05 11:59 ` Ingo Molnar
2015-09-05 12:11 ` Mikko Rapeli
0 siblings, 1 reply; 41+ messages in thread
From: Ingo Molnar @ 2015-09-05 11:59 UTC (permalink / raw)
To: Mikko Rapeli
Cc: linux-kernel, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
* Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
> > diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
> > index a92b0f0dc09e..8b870175befa 100644
> > --- a/arch/x86/include/uapi/asm/sigcontext32.h
> > +++ b/arch/x86/include/uapi/asm/sigcontext32.h
> > @@ -3,6 +3,6 @@
> >
> > /* This is a legacy file - all the type definitions are in sigcontext.h: */
> >
> > -#include <asm/sigcontext.h>
> > +#include <uapi/asm/sigcontext.h>
>
> This needs to be without uapi directory in path.
What do you mean?
Thanks,
Ingo
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h>
2015-09-05 11:59 ` Ingo Molnar
@ 2015-09-05 12:11 ` Mikko Rapeli
2015-09-06 6:41 ` Ingo Molnar
0 siblings, 1 reply; 41+ messages in thread
From: Mikko Rapeli @ 2015-09-05 12:11 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
On Sat, Sep 05, 2015 at 01:59:43PM +0200, Ingo Molnar wrote:
>
> * Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
>
> > > diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
> > > index a92b0f0dc09e..8b870175befa 100644
> > > --- a/arch/x86/include/uapi/asm/sigcontext32.h
> > > +++ b/arch/x86/include/uapi/asm/sigcontext32.h
> > > @@ -3,6 +3,6 @@
> > >
> > > /* This is a legacy file - all the type definitions are in sigcontext.h: */
> > >
> > > -#include <asm/sigcontext.h>
> > > +#include <uapi/asm/sigcontext.h>
> >
> > This needs to be without uapi directory in path.
>
> What do you mean?
There is not uapi in path in userspace so it fails to compile:
cc -Wall -c -nostdinc -I /usr/lib/gcc/i586-linux-gnu/5/include -I /usr/lib/gcc/i
586-linux-gnu/5/include-fixed -I . -I ../headers_compile_test_include -I ../head
ers_compile_test_include/i586-linux-gnu ./asm/sigcontext32.c
In file included from ./asm/sigcontext32.c:1:0:
./asm/sigcontext32.h:6:33: fatal error: uapi/asm/sigcontext.h: No such file or d
irectory
compilation terminated.
FAILED: ./asm/sigcontext32.h
This is the fix:
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -3,6 +3,6 @@
/* This is a legacy file - all the type definitions are in sigcontext.h: */
-#include <uapi/asm/sigcontext.h>
+#include <asm/sigcontext.h>
#endif /* _ASM_X86_SIGCONTEXT32_H */
-Mikko
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h>
2015-09-05 12:11 ` Mikko Rapeli
@ 2015-09-06 6:41 ` Ingo Molnar
2015-09-06 20:28 ` Mikko Rapeli
0 siblings, 1 reply; 41+ messages in thread
From: Ingo Molnar @ 2015-09-06 6:41 UTC (permalink / raw)
To: Mikko Rapeli
Cc: linux-kernel, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
* Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
> On Sat, Sep 05, 2015 at 01:59:43PM +0200, Ingo Molnar wrote:
> >
> > * Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
> >
> > > > diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
> > > > index a92b0f0dc09e..8b870175befa 100644
> > > > --- a/arch/x86/include/uapi/asm/sigcontext32.h
> > > > +++ b/arch/x86/include/uapi/asm/sigcontext32.h
> > > > @@ -3,6 +3,6 @@
> > > >
> > > > /* This is a legacy file - all the type definitions are in sigcontext.h: */
> > > >
> > > > -#include <asm/sigcontext.h>
> > > > +#include <uapi/asm/sigcontext.h>
> > >
> > > This needs to be without uapi directory in path.
> >
> > What do you mean?
>
> There is not uapi in path in userspace so it fails to compile:
Ok, I see. So it's not common, but I don't think there's an outright prohibition
for uapi headers to refer to each other:
arch/hexagon/include/uapi/asm/signal.h:#include <uapi/asm/registers.h>
arch/mips/include/uapi/asm/siginfo.h:#include <uapi/asm-generic/siginfo.h>
arch/x86/include/uapi/asm/sigcontext32.h:#include <uapi/asm/sigcontext.h>
There are a couple of solutions:
- copy the uapi/ directory if you take the kernel headers as-is
- adapt the headers to the old user-space layout when you import them.
(i.e. do a sed -i 's/<uapi/</' on them).
- create a symbolic link from asm/uapi to asm/ in user-space.
The kernel side solutions are uglier:
- We could create a symbolic link from asm/uapi/sigcontext32.h to
asm/uapi/sigcontext.h, although I'm not sure what the policy for that is in
the kernel repository - I think it's generally frowned upon.
- We could keep asm/sigcontext.h that includes asm/uapi/sigcontext.h - a
poor man's symbolic link.
OTOH the last option isn't all that ugly.
> This is the fix:
>
> --- a/arch/x86/include/uapi/asm/sigcontext32.h
> +++ b/arch/x86/include/uapi/asm/sigcontext32.h
> @@ -3,6 +3,6 @@
>
> /* This is a legacy file - all the type definitions are in sigcontext.h: */
>
> -#include <uapi/asm/sigcontext.h>
> +#include <asm/sigcontext.h>
There's no asm/sigcontext.h file anymore if you apply my patches - but we could
reintroduce it to make the copy of UAPI headers to user-space work as-is.
Thanks,
Ingo
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h>
2015-09-06 6:41 ` Ingo Molnar
@ 2015-09-06 20:28 ` Mikko Rapeli
2015-09-07 7:37 ` Ingo Molnar
0 siblings, 1 reply; 41+ messages in thread
From: Mikko Rapeli @ 2015-09-06 20:28 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
On Sun, Sep 06, 2015 at 08:41:45AM +0200, Ingo Molnar wrote:
>
> * Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
>
> > On Sat, Sep 05, 2015 at 01:59:43PM +0200, Ingo Molnar wrote:
> > >
> > > * Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
> > >
> > > > > diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
> > > > > index a92b0f0dc09e..8b870175befa 100644
> > > > > --- a/arch/x86/include/uapi/asm/sigcontext32.h
> > > > > +++ b/arch/x86/include/uapi/asm/sigcontext32.h
> > > > > @@ -3,6 +3,6 @@
> > > > >
> > > > > /* This is a legacy file - all the type definitions are in sigcontext.h: */
> > > > >
> > > > > -#include <asm/sigcontext.h>
> > > > > +#include <uapi/asm/sigcontext.h>
> > > >
> > > > This needs to be without uapi directory in path.
> > >
> > > What do you mean?
> >
> > There is not uapi in path in userspace so it fails to compile:
>
> Ok, I see. So it's not common, but I don't think there's an outright prohibition
> for uapi headers to refer to each other:
>
> arch/hexagon/include/uapi/asm/signal.h:#include <uapi/asm/registers.h>
> arch/mips/include/uapi/asm/siginfo.h:#include <uapi/asm-generic/siginfo.h>
> arch/x86/include/uapi/asm/sigcontext32.h:#include <uapi/asm/sigcontext.h>
>
> There are a couple of solutions:
>
> - copy the uapi/ directory if you take the kernel headers as-is
>
> - adapt the headers to the old user-space layout when you import them.
> (i.e. do a sed -i 's/<uapi/</' on them).
>
> - create a symbolic link from asm/uapi to asm/ in user-space.
>
> The kernel side solutions are uglier:
>
> - We could create a symbolic link from asm/uapi/sigcontext32.h to
> asm/uapi/sigcontext.h, although I'm not sure what the policy for that is in
> the kernel repository - I think it's generally frowned upon.
>
> - We could keep asm/sigcontext.h that includes asm/uapi/sigcontext.h - a
> poor man's symbolic link.
>
> OTOH the last option isn't all that ugly.
Yes, AFAIK it's a common patterns in kernel.
> > This is the fix:
> >
> > --- a/arch/x86/include/uapi/asm/sigcontext32.h
> > +++ b/arch/x86/include/uapi/asm/sigcontext32.h
> > @@ -3,6 +3,6 @@
> >
> > /* This is a legacy file - all the type definitions are in sigcontext.h: */
> >
> > -#include <uapi/asm/sigcontext.h>
> > +#include <asm/sigcontext.h>
>
> There's no asm/sigcontext.h file anymore if you apply my patches - but we could
> reintroduce it to make the copy of UAPI headers to user-space work as-is.
Actually there is, in user space :)
$ git show -s --pretty=one HEAD
bea04c5252803fa53dcc5366ae32357a0ab07b44 x86/headers: Remove <asm/sigcontext.h>
$ make headers_install
...
$ ls usr/include/asm/sigcontext.h
usr/include/asm/sigcontext.h
$ diff -up arch/x86/include/uapi/asm/sigcontext.h usr/include/asm/sigcontext.h
--- arch/x86/include/uapi/asm/sigcontext.h 2015-09-06 22:10:54.918303649 +0200
+++ usr/include/asm/sigcontext.h 2015-09-06 22:11:18.214835356 +0200
@@ -1,5 +1,5 @@
-#ifndef _UAPI_ASM_X86_SIGCONTEXT_H
-#define _UAPI_ASM_X86_SIGCONTEXT_H
+#ifndef _ASM_X86_SIGCONTEXT_H
+#define _ASM_X86_SIGCONTEXT_H
/*
* Linux signal context definitions. The sigcontext includes a complex hierarchy of CPU
@@ -14,7 +14,7 @@
* to grow new quirks for quite some time. Promise!
*/
-#include <linux/compiler.h>
+
#include <linux/types.h>
#define FP_XSTATE_MAGIC1 0x46505853U
@@ -271,20 +271,12 @@ struct sigcontext_64 {
/*
* Create the real 'struct sigcontext' type:
*/
-#ifdef __KERNEL__
-# ifdef __i386__
-# define sigcontext sigcontext_32
-# else
-# define sigcontext sigcontext_64
-# endif
-#endif
/*
* The old user-space sigcontext definition, just in case user-space still
* relies on it. The kernel definition (in asm/sigcontext.h) has unified
* field names but otherwise the same layout.
*/
-#ifndef __KERNEL__
#define _fpstate_ia32 _fpstate_32
#define sigcontext_ia32 sigcontext_32
@@ -311,7 +303,7 @@ struct sigcontext {
__u32 eflags;
__u32 esp_at_signal;
__u16 ss, __ssh;
- struct _fpstate __user *fpstate;
+ struct _fpstate *fpstate;
__u32 oldmask;
__u32 cr2;
};
@@ -343,13 +335,12 @@ struct sigcontext {
__u64 trapno;
__u64 oldmask;
__u64 cr2;
- struct _fpstate __user *fpstate; /* Zero when no FPU context */
+ struct _fpstate *fpstate; /* Zero when no FPU context */
# ifdef __ILP32__
__u32 __fpstate_pad;
# endif
__u64 reserved1[8];
};
# endif /* __x86_64__ */
-#endif /* !__KERNEL__ */
-#endif /* _UAPI_ASM_X86_SIGCONTEXT_H */
+#endif /* _ASM_X86_SIGCONTEXT_H */
So that's what changes when the file is exported for userspace together with
the path from which uapi is removed. So if, like you said kernel side has
problems with
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -3,6 +3,6 @@
/* This is a legacy file - all the type definitions are in sigcontext.h: */
-#include <uapi/asm/sigcontext.h>
+#include <asm/sigcontext.h>
#endif /* _ASM_X86_SIGCONTEXT32_H */
Then a nice solution would be for the kernel side wrapper to do like you
said (on top of your changes on master):
--- /dev/null
+++ b/arch/x86/include/asm/sigcontext.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_X86_SIGCONTEXT_H
+#define _ASM_X86_SIGCONTEXT_H
+
+#include <uapi/asm/sigcontext.h>
+
+#endif /* _ASM_X86_SIGCONTEXT_H */
And I guess logically this belongs to commit "x86/headers: Remove
<asm/sigcontext.h>".
-Mikko
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h>
2015-09-06 20:28 ` Mikko Rapeli
@ 2015-09-07 7:37 ` Ingo Molnar
2015-09-07 8:14 ` Mikko Rapeli
0 siblings, 1 reply; 41+ messages in thread
From: Ingo Molnar @ 2015-09-07 7:37 UTC (permalink / raw)
To: Mikko Rapeli
Cc: linux-kernel, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
* Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
> > > +++ b/arch/x86/include/uapi/asm/sigcontext32.h
> > > @@ -3,6 +3,6 @@
> > >
> > > /* This is a legacy file - all the type definitions are in sigcontext.h: */
> > >
> > > -#include <uapi/asm/sigcontext.h>
> > > +#include <asm/sigcontext.h>
> >
> > There's no asm/sigcontext.h file anymore if you apply my patches - but we could
> > reintroduce it to make the copy of UAPI headers to user-space work as-is.
>
> Actually there is, in user space :)
I mean in the kernel arch/x86/include/asm/sigcontext.h is gone (at least in that
series), we use the UAPI header directly.
> Then a nice solution would be for the kernel side wrapper to do like you
> said (on top of your changes on master):
>
> --- /dev/null
> +++ b/arch/x86/include/asm/sigcontext.h
> @@ -0,0 +1,6 @@
> +#ifndef _ASM_X86_SIGCONTEXT_H
> +#define _ASM_X86_SIGCONTEXT_H
> +
> +#include <uapi/asm/sigcontext.h>
> +
> +#endif /* _ASM_X86_SIGCONTEXT_H */
>
> And I guess logically this belongs to commit "x86/headers: Remove
> <asm/sigcontext.h>".
Yeah, will do this, plus some comments explaining that this is really just so that
we can keep the UAPI side compatible with a 'straight user-space copying of the
header files'.
This won't affect the kernel as we won't include asm/sigcontext.h directly. (And
even if we do, there's no harm done.)
Agreed?
Thanks,
Ingo
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h>
2015-09-07 7:37 ` Ingo Molnar
@ 2015-09-07 8:14 ` Mikko Rapeli
0 siblings, 0 replies; 41+ messages in thread
From: Mikko Rapeli @ 2015-09-07 8:14 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Andy Lutomirski, Andrew Morton, Denys Vlasenko,
Brian Gerst, Peter Zijlstra, Borislav Petkov, H. Peter Anvin,
Linus Torvalds, Oleg Nesterov, Thomas Gleixner
On Mon, Sep 07, 2015 at 09:37:50AM +0200, Ingo Molnar wrote:
>
> * Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
>
> > > > +++ b/arch/x86/include/uapi/asm/sigcontext32.h
> > > > @@ -3,6 +3,6 @@
> > > >
> > > > /* This is a legacy file - all the type definitions are in sigcontext.h: */
> > > >
> > > > -#include <uapi/asm/sigcontext.h>
> > > > +#include <asm/sigcontext.h>
> > >
> > > There's no asm/sigcontext.h file anymore if you apply my patches - but we could
> > > reintroduce it to make the copy of UAPI headers to user-space work as-is.
> >
> > Actually there is, in user space :)
>
> I mean in the kernel arch/x86/include/asm/sigcontext.h is gone (at least in that
> series), we use the UAPI header directly.
>
> > Then a nice solution would be for the kernel side wrapper to do like you
> > said (on top of your changes on master):
> >
> > --- /dev/null
> > +++ b/arch/x86/include/asm/sigcontext.h
> > @@ -0,0 +1,6 @@
> > +#ifndef _ASM_X86_SIGCONTEXT_H
> > +#define _ASM_X86_SIGCONTEXT_H
> > +
> > +#include <uapi/asm/sigcontext.h>
> > +
> > +#endif /* _ASM_X86_SIGCONTEXT_H */
> >
> > And I guess logically this belongs to commit "x86/headers: Remove
> > <asm/sigcontext.h>".
>
> Yeah, will do this, plus some comments explaining that this is really just so that
> we can keep the UAPI side compatible with a 'straight user-space copying of the
> header files'.
>
> This won't affect the kernel as we won't include asm/sigcontext.h directly. (And
> even if we do, there's no harm done.)
>
> Agreed?
Perfect. Thanks for takling this issue!
-Mikko
^ permalink raw reply [flat|nested] 41+ messages in thread
* [tip:x86/headers] x86/headers: Fix (old) header file dependency bug in uapi/asm/sigcontext32.h
2015-09-05 7:32 ` [PATCH 01/15] x86/headers: Fix (old) header file dependency bug in uapi/asm/sigcontext32.h Ingo Molnar
@ 2015-09-08 14:24 ` tip-bot for Ingo Molnar
0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Ingo Molnar @ 2015-09-08 14:24 UTC (permalink / raw)
To: linux-tip-commits
Cc: mikko.rapeli, hpa, linux-kernel, torvalds, peterz, dvlasenk, bp,
oleg, luto, brgerst, tglx, mingo
Commit-ID: b76cb6c869b966b4c991251136b45b3e1babc4e8
Gitweb: http://git.kernel.org/tip/b76cb6c869b966b4c991251136b45b3e1babc4e8
Author: Ingo Molnar <mingo@kernel.org>
AuthorDate: Sat, 5 Sep 2015 09:32:29 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 8 Sep 2015 10:03:55 +0200
x86/headers: Fix (old) header file dependency bug in uapi/asm/sigcontext32.h
Mikko Rapeli reported that the following standalone user-space
header does not compile:
#include <asm/sigcontext32.h>
Due to undefined 'struct __fpx_sw_bytes' which is defined in
asm/sigcontext.h.
The following header order works:
#include <asm/sigcontext.h>
#include <asm/sigcontext32.h>
and that's probably how everyone's been using these headers for
the past decade or so, but it's a legit header file dependency
bug, so include asm/sigcontext.h in sigcontext32.h to allow it
to be built standlone.
Reported-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi>
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: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/1441438363-9999-2-git-send-email-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/uapi/asm/sigcontext32.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
index ad1478c..ff7826c 100644
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -3,6 +3,8 @@
#include <linux/types.h>
+#include <asm/sigcontext.h>
+
/* signal context for 32bit programs. */
#define X86_FXSR_MAGIC 0x0000
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [tip:x86/headers] x86/headers: Clean up uapi/asm/sigcontext32.h
2015-09-05 7:32 ` [PATCH 02/15] x86/headers: Clean up uapi/asm/sigcontext32.h Ingo Molnar
@ 2015-09-08 14:25 ` tip-bot for Ingo Molnar
0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Ingo Molnar @ 2015-09-08 14:25 UTC (permalink / raw)
To: linux-tip-commits
Cc: peterz, luto, hpa, oleg, bp, mikko.rapeli, dvlasenk, tglx,
brgerst, linux-kernel, mingo, torvalds
Commit-ID: c3f4986fb0774bb13feb4bade1276bed2ba8a3db
Gitweb: http://git.kernel.org/tip/c3f4986fb0774bb13feb4bade1276bed2ba8a3db
Author: Ingo Molnar <mingo@kernel.org>
AuthorDate: Sat, 5 Sep 2015 09:32:30 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 8 Sep 2015 10:03:55 +0200
x86/headers: Clean up uapi/asm/sigcontext32.h
Clean up sigcontext32.h a bit:
- use consistent and readable vertical spacing
- fix, harmonize and extend comments
No field name has been changed, user-space might be relying on
them.
Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi>
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: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/1441438363-9999-3-git-send-email-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/uapi/asm/sigcontext32.h | 110 ++++++++++++++++---------------
1 file changed, 58 insertions(+), 52 deletions(-)
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
index ff7826c..6ff4fba 100644
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -1,79 +1,85 @@
#ifndef _ASM_X86_SIGCONTEXT32_H
#define _ASM_X86_SIGCONTEXT32_H
+/* Signal context definitions for compat 32-bit programs: */
+
#include <linux/types.h>
#include <asm/sigcontext.h>
-/* signal context for 32bit programs. */
-
-#define X86_FXSR_MAGIC 0x0000
-
+/* 10-byte legacy floating point register: */
struct _fpreg {
- unsigned short significand[4];
- unsigned short exponent;
+ unsigned short significand[4];
+ unsigned short exponent;
};
+/* 16-byte floating point register: */
struct _fpxreg {
- unsigned short significand[4];
- unsigned short exponent;
- unsigned short padding[3];
+ unsigned short significand[4];
+ unsigned short exponent;
+ unsigned short padding[3];
};
+/* 16-byte XMM vector register: */
struct _xmmreg {
__u32 element[4];
};
-/* FSAVE frame with extensions */
+#define X86_FXSR_MAGIC 0x0000
+
+/* FXSAVE frame: FSAVE frame with extensions */
struct _fpstate_ia32 {
- /* Regular FPU environment */
- __u32 cw;
- __u32 sw;
- __u32 tag; /* not compatible to 64bit twd */
- __u32 ipoff;
- __u32 cssel;
- __u32 dataoff;
- __u32 datasel;
- struct _fpreg _st[8];
- unsigned short status;
- unsigned short magic; /* 0xffff = regular FPU data only */
+ /* Regular FPU environment: */
+ __u32 cw;
+ __u32 sw;
+ __u32 tag; /* Not compatible with the 64-bit frame */
+ __u32 ipoff;
+ __u32 cssel;
+ __u32 dataoff;
+ __u32 datasel;
+ struct _fpreg _st[8];
+ unsigned short status;
+ unsigned short magic; /* 0xffff: regular FPU data only */
+ /* 0x0000: FXSR data */
- /* FXSR FPU environment */
- __u32 _fxsr_env[6];
- __u32 mxcsr;
- __u32 reserved;
- struct _fpxreg _fxsr_st[8];
- struct _xmmreg _xmm[8]; /* It's actually 16 */
- __u32 padding[44];
+ /* Extended FXSR FPU environment: */
+ __u32 _fxsr_env[6];
+ __u32 mxcsr;
+ __u32 reserved;
+ struct _fpxreg _fxsr_st[8];
+ struct _xmmreg _xmm[8]; /* The first 8 XMM registers */
+ __u32 padding[44]; /* The second 8 XMM registers plus padding */
union {
- __u32 padding2[12];
- struct _fpx_sw_bytes sw_reserved;
+ __u32 padding2[12];
+ /* Might encode xstate extensions, see asm/sigcontext.h: */
+ struct _fpx_sw_bytes sw_reserved;
};
};
+/* 32-bit compat sigcontext: */
struct sigcontext_ia32 {
- unsigned short gs, __gsh;
- unsigned short fs, __fsh;
- unsigned short es, __esh;
- unsigned short ds, __dsh;
- unsigned int di;
- unsigned int si;
- unsigned int bp;
- unsigned int sp;
- unsigned int bx;
- unsigned int dx;
- unsigned int cx;
- unsigned int ax;
- unsigned int trapno;
- unsigned int err;
- unsigned int ip;
- unsigned short cs, __csh;
- unsigned int flags;
- unsigned int sp_at_signal;
- unsigned short ss, __ssh;
- unsigned int fpstate; /* really (struct _fpstate_ia32 *) */
- unsigned int oldmask;
- unsigned int cr2;
+ unsigned short gs, __gsh;
+ unsigned short fs, __fsh;
+ unsigned short es, __esh;
+ unsigned short ds, __dsh;
+ unsigned int di;
+ unsigned int si;
+ unsigned int bp;
+ unsigned int sp;
+ unsigned int bx;
+ unsigned int dx;
+ unsigned int cx;
+ unsigned int ax;
+ unsigned int trapno;
+ unsigned int err;
+ unsigned int ip;
+ unsigned short cs, __csh;
+ unsigned int flags;
+ unsigned int sp_at_signal;
+ unsigned short ss, __ssh;
+ unsigned int fpstate; /* Pointer to 'struct _fpstate_ia32' */
+ unsigned int oldmask;
+ unsigned int cr2;
};
#endif /* _ASM_X86_SIGCONTEXT32_H */
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [tip:x86/headers] x86/headers: Clean up and better document uapi/ asm/sigcontext.h
2015-09-05 7:32 ` [PATCH 03/15] x86/headers: Clean up and better document uapi/asm/sigcontext.h Ingo Molnar
@ 2015-09-08 14:25 ` tip-bot for Ingo Molnar
2015-09-09 7:12 ` Peter Zijlstra
0 siblings, 1 reply; 41+ messages in thread
From: tip-bot for Ingo Molnar @ 2015-09-08 14:25 UTC (permalink / raw)
To: linux-tip-commits
Cc: mikko.rapeli, dvlasenk, torvalds, linux-kernel, luto, tglx, bp,
oleg, mingo, hpa, peterz, brgerst
Commit-ID: cbf5f4fbf435e871e59d49653d555266b8796efc
Gitweb: http://git.kernel.org/tip/cbf5f4fbf435e871e59d49653d555266b8796efc
Author: Ingo Molnar <mingo@kernel.org>
AuthorDate: Sat, 5 Sep 2015 09:32:31 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 8 Sep 2015 10:03:55 +0200
x86/headers: Clean up and better document uapi/asm/sigcontext.h
Clean up sigcontext.h:
- the explanations were full of typos and were hard to read in general
- use consistent and readable vertical spacing
- fix, harmonize and extend comments
No field name has been changed, user-space might be relying on
them.
Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi>
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: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/1441438363-9999-4-git-send-email-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/uapi/asm/sigcontext.h | 330 ++++++++++++++++++---------------
1 file changed, 182 insertions(+), 148 deletions(-)
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index 40836a9..f89b2f1 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -1,221 +1,255 @@
#ifndef _UAPI_ASM_X86_SIGCONTEXT_H
#define _UAPI_ASM_X86_SIGCONTEXT_H
+/*
+ * Linux signal context definitions. The sigcontext includes a complex hierarchy of CPU
+ * and FPU state, available to user-space (on the stack) when a signal handler is
+ * executed.
+ *
+ * As over the years this ABI grew from its very simple roots towards supporting more and
+ * more CPU state organically, some of the details (which were rather clever hacks back
+ * in the days) became a bit quirky by today.
+ *
+ * The current ABI includes flexible provisions for future extensions, so we won't have
+ * to grow new quirks for quite some time. Promise!
+ */
+
#include <linux/compiler.h>
#include <linux/types.h>
-#define FP_XSTATE_MAGIC1 0x46505853U
-#define FP_XSTATE_MAGIC2 0x46505845U
-#define FP_XSTATE_MAGIC2_SIZE sizeof(FP_XSTATE_MAGIC2)
+#define FP_XSTATE_MAGIC1 0x46505853U
+#define FP_XSTATE_MAGIC2 0x46505845U
+#define FP_XSTATE_MAGIC2_SIZE sizeof(FP_XSTATE_MAGIC2)
/*
- * bytes 464..511 in the current 512byte layout of fxsave/fxrstor frame
- * are reserved for SW usage. On cpu's supporting xsave/xrstor, these bytes
- * are used to extended the fpstate pointer in the sigcontext, which now
+ * Bytes 464..511 in the current 512-byte layout of the FXSAVE/FXRSTOR frame
+ * are reserved for SW usage. On CPUs supporting XSAVE/XRSTOR, these bytes
+ * are used to extend the fpstate pointer in the sigcontext, which now
* includes the extended state information along with fpstate information.
*
- * Presence of FP_XSTATE_MAGIC1 at the beginning of this SW reserved
- * area and FP_XSTATE_MAGIC2 at the end of memory layout
- * (extended_size - FP_XSTATE_MAGIC2_SIZE) indicates the presence of the
- * extended state information in the memory layout pointed by the fpstate
- * pointer in sigcontext.
+ * If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then there's a sw_reserved.extended_size
+ * bytes large extended context area present. (The last 32-bit word of this extended
+ * area (at the fpstate+extended_size-FP_XSTATE_MAGIC2_SIZE address) is set to
+ * FP_XSTATE_MAGIC2 so that you can sanity check your size calculations.)
+ *
+ * This extended area typically grows with newer CPUs that have larger and larger
+ * XSAVE areas.
*/
struct _fpx_sw_bytes {
- __u32 magic1; /* FP_XSTATE_MAGIC1 */
- __u32 extended_size; /* total size of the layout referred by
- * fpstate pointer in the sigcontext.
- */
- __u64 xfeatures;
- /* feature bit mask (including fp/sse/extended
- * state) that is present in the memory
- * layout.
- */
- __u32 xstate_size; /* actual xsave state size, based on the
- * features saved in the layout.
- * 'extended_size' will be greater than
- * 'xstate_size'.
- */
- __u32 padding[7]; /* for future use. */
+ /* If set to FP_XSTATE_MAGIC1 then this is an xstate context. 0 if a legacy frame. */
+ __u32 magic1;
+
+ /*
+ * Total size of the fpstate area:
+ *
+ * - if magic1 == 0 then it's sizeof(struct _fpstate)
+ * - if magic1 == FP_XSTATE_MAGIC1 then it's sizeof(struct _xstate) plus extensions (if any)
+ */
+ __u32 extended_size;
+
+ /*
+ * Feature bit mask (including FP/SSE/extended state) that is present
+ * in the memory layout:
+ */
+ __u64 xfeatures;
+
+ /*
+ * Actual XSAVE state size, based on the xfeatures saved in the layout.
+ * 'extended_size' is greater than 'xstate_size':
+ */
+ __u32 xstate_size;
+
+ /* For future use: */
+ __u32 padding[7];
};
#ifdef __i386__
/*
- * As documented in the iBCS2 standard..
+ * As documented in the iBCS2 standard:
*
* The first part of "struct _fpstate" is just the normal i387
* hardware setup, the extra "status" word is used to save the
* coprocessor status word before entering the handler.
*
- * Pentium III FXSR, SSE support
- * Gareth Hughes <gareth@valinux.com>, May 2000
- *
* The FPU state data structure has had to grow to accommodate the
* extended FPU state required by the Streaming SIMD Extensions.
* There is no documented standard to accomplish this at the moment.
*/
+
+/* 10-byte legacy floating point register: */
struct _fpreg {
- unsigned short significand[4];
- unsigned short exponent;
+ unsigned short significand[4];
+ unsigned short exponent;
};
+/* 16-byte floating point register: */
struct _fpxreg {
- unsigned short significand[4];
- unsigned short exponent;
- unsigned short padding[3];
+ unsigned short significand[4];
+ unsigned short exponent;
+ unsigned short padding[3];
};
+/* 16-byte XMM register: */
struct _xmmreg {
- unsigned long element[4];
+ unsigned long element[4];
};
+#define X86_FXSR_MAGIC 0x0000
+
struct _fpstate {
- /* Regular FPU environment */
- unsigned long cw;
- unsigned long sw;
- unsigned long tag;
- unsigned long ipoff;
- unsigned long cssel;
- unsigned long dataoff;
- unsigned long datasel;
- struct _fpreg _st[8];
- unsigned short status;
- unsigned short magic; /* 0xffff = regular FPU data only */
+ /* Legacy FPU environment: */
+ unsigned long cw;
+ unsigned long sw;
+ unsigned long tag;
+ unsigned long ipoff;
+ unsigned long cssel;
+ unsigned long dataoff;
+ unsigned long datasel;
+ struct _fpreg _st[8];
+ unsigned short status;
+ unsigned short magic; /* 0xffff: regular FPU data only */
+ /* 0x0000: FXSR FPU data */
/* FXSR FPU environment */
- unsigned long _fxsr_env[6]; /* FXSR FPU env is ignored */
- unsigned long mxcsr;
- unsigned long reserved;
- struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */
- struct _xmmreg _xmm[8];
- unsigned long padding1[44];
+ unsigned long _fxsr_env[6]; /* FXSR FPU env is ignored */
+ unsigned long mxcsr;
+ unsigned long reserved;
+ struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */
+ struct _xmmreg _xmm[8]; /* First 8 XMM registers */
+ unsigned long padding1[44]; /* Second 8 XMM registers plus padding */
union {
- unsigned long padding2[12];
- struct _fpx_sw_bytes sw_reserved; /* represents the extended
- * state info */
+ unsigned long padding2[12];
+ struct _fpx_sw_bytes sw_reserved; /* Potential extended state is encoded here */
};
};
-#define X86_FXSR_MAGIC 0x0000
-
-#ifndef __KERNEL__
+# ifndef __KERNEL__
/*
* User-space might still rely on the old definition:
*/
struct sigcontext {
- unsigned short gs, __gsh;
- unsigned short fs, __fsh;
- unsigned short es, __esh;
- unsigned short ds, __dsh;
- unsigned long edi;
- unsigned long esi;
- unsigned long ebp;
- unsigned long esp;
- unsigned long ebx;
- unsigned long edx;
- unsigned long ecx;
- unsigned long eax;
- unsigned long trapno;
- unsigned long err;
- unsigned long eip;
- unsigned short cs, __csh;
- unsigned long eflags;
- unsigned long esp_at_signal;
- unsigned short ss, __ssh;
- struct _fpstate __user *fpstate;
- unsigned long oldmask;
- unsigned long cr2;
+ unsigned short gs, __gsh;
+ unsigned short fs, __fsh;
+ unsigned short es, __esh;
+ unsigned short ds, __dsh;
+ unsigned long edi;
+ unsigned long esi;
+ unsigned long ebp;
+ unsigned long esp;
+ unsigned long ebx;
+ unsigned long edx;
+ unsigned long ecx;
+ unsigned long eax;
+ unsigned long trapno;
+ unsigned long err;
+ unsigned long eip;
+ unsigned short cs, __csh;
+ unsigned long eflags;
+ unsigned long esp_at_signal;
+ unsigned short ss, __ssh;
+ struct _fpstate __user *fpstate;
+ unsigned long oldmask;
+ unsigned long cr2;
};
-#endif /* !__KERNEL__ */
+# endif /* !__KERNEL__ */
-#else /* __i386__ */
+#else /* __x86_64__: */
-/* FXSAVE frame */
-/* Note: reserved1/2 may someday contain valuable data. Always save/restore
- them when you change signal frames. */
+/*
+ * The FXSAVE frame.
+ *
+ * Note1: If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then the structure is
+ * larger: 'struct _xstate'. Note that 'struct _xstate' embedds
+ * 'struct _fpstate' so that you can always assume the _fpstate portion
+ * exists so that you can check the magic value.
+ *
+ * Note2: Reserved fields may someday contain valuable data. Always save/restore
+ * them when you change signal frames.
+ */
struct _fpstate {
- __u16 cwd;
- __u16 swd;
- __u16 twd; /* Note this is not the same as the
- 32bit/x87/FSAVE twd */
- __u16 fop;
- __u64 rip;
- __u64 rdp;
- __u32 mxcsr;
- __u32 mxcsr_mask;
- __u32 st_space[32]; /* 8*16 bytes for each FP-reg */
- __u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg */
- __u32 reserved2[12];
+ __u16 cwd;
+ __u16 swd;
+ /* Note this is not the same as the 32-bit/x87/FSAVE twd: */
+ __u16 twd;
+ __u16 fop;
+ __u64 rip;
+ __u64 rdp;
+ __u32 mxcsr;
+ __u32 mxcsr_mask;
+ __u32 st_space[32]; /* 8x FP registers, 16 bytes each */
+ __u32 xmm_space[64]; /* 16x XMM registers, 16 bytes each */
+ __u32 reserved2[12];
union {
- __u32 reserved3[12];
- struct _fpx_sw_bytes sw_reserved; /* represents the extended
- * state information */
+ __u32 reserved3[12];
+ struct _fpx_sw_bytes sw_reserved; /* Potential extended state is encoded here */
};
};
-#ifndef __KERNEL__
+# ifndef __KERNEL__
/*
* User-space might still rely on the old definition:
*/
struct sigcontext {
- __u64 r8;
- __u64 r9;
- __u64 r10;
- __u64 r11;
- __u64 r12;
- __u64 r13;
- __u64 r14;
- __u64 r15;
- __u64 rdi;
- __u64 rsi;
- __u64 rbp;
- __u64 rbx;
- __u64 rdx;
- __u64 rax;
- __u64 rcx;
- __u64 rsp;
- __u64 rip;
- __u64 eflags; /* RFLAGS */
- __u16 cs;
- __u16 gs;
- __u16 fs;
- __u16 __pad0;
- __u64 err;
- __u64 trapno;
- __u64 oldmask;
- __u64 cr2;
- struct _fpstate __user *fpstate; /* zero when no FPU context */
-#ifdef __ILP32__
- __u32 __fpstate_pad;
-#endif
- __u64 reserved1[8];
+ __u64 r8;
+ __u64 r9;
+ __u64 r10;
+ __u64 r11;
+ __u64 r12;
+ __u64 r13;
+ __u64 r14;
+ __u64 r15;
+ __u64 rdi;
+ __u64 rsi;
+ __u64 rbp;
+ __u64 rbx;
+ __u64 rdx;
+ __u64 rax;
+ __u64 rcx;
+ __u64 rsp;
+ __u64 rip;
+ __u64 eflags; /* RFLAGS */
+ __u16 cs;
+ __u16 gs;
+ __u16 fs;
+ __u16 __pad0;
+ __u64 err;
+ __u64 trapno;
+ __u64 oldmask;
+ __u64 cr2;
+ struct _fpstate __user *fpstate; /* Zero when no FPU context */
+# ifdef __ILP32__
+ __u32 __fpstate_pad;
+# endif
+ __u64 reserved1[8];
};
-#endif /* !__KERNEL__ */
+# endif /* !__KERNEL__ */
-#endif /* !__i386__ */
+#endif /* __x86_64__ */
struct _header {
- __u64 xfeatures;
- __u64 reserved1[2];
- __u64 reserved2[5];
+ __u64 xfeatures;
+ __u64 reserved1[2];
+ __u64 reserved2[5];
};
struct _ymmh_state {
- /* 16 * 16 bytes for each YMMH-reg */
- __u32 ymmh_space[64];
+ /* 16x YMM registers, 16 bytes each: */
+ __u32 ymmh_space[64];
};
/*
- * Extended state pointed by the fpstate pointer in the sigcontext.
- * In addition to the fpstate, information encoded in the xstate_hdr
- * indicates the presence of other extended state information
- * supported by the processor and OS.
+ * Extended state pointed to by sigcontext::fpstate.
+ *
+ * In addition to the fpstate, information encoded in _xstate::xstate_hdr
+ * indicates the presence of other extended state information supported
+ * by the CPU and kernel:
*/
struct _xstate {
- struct _fpstate fpstate;
- struct _header xstate_hdr;
- struct _ymmh_state ymmh;
- /* new processor state extensions go here */
+ struct _fpstate fpstate;
+ struct _header xstate_hdr;
+ struct _ymmh_state ymmh;
+ /* New processor state extensions go here: */
};
#endif /* _UAPI_ASM_X86_SIGCONTEXT_H */
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [tip:x86/headers] x86/headers: Separate out legacy user-space structure definitions
2015-09-05 7:32 ` [PATCH 04/15] x86/headers: Separate out legacy user-space structure definitions Ingo Molnar
@ 2015-09-08 14:25 ` tip-bot for Ingo Molnar
0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Ingo Molnar @ 2015-09-08 14:25 UTC (permalink / raw)
To: linux-tip-commits
Cc: brgerst, luto, torvalds, mingo, mikko.rapeli, hpa, tglx, bp,
peterz, dvlasenk, linux-kernel, oleg
Commit-ID: 128f8257a17a47b9a40f550cc2f36458cd8c07b0
Gitweb: http://git.kernel.org/tip/128f8257a17a47b9a40f550cc2f36458cd8c07b0
Author: Ingo Molnar <mingo@kernel.org>
AuthorDate: Sat, 5 Sep 2015 09:32:32 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 8 Sep 2015 10:03:56 +0200
x86/headers: Separate out legacy user-space structure definitions
Better separate the user-space struct sigcontext definitions
from the kernel definitions, so that we can unify the kernel
definitions with sigcontext32.h.
Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi>
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: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/1441438363-9999-5-git-send-email-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/uapi/asm/sigcontext.h | 119 ++++++++++++++++-----------------
1 file changed, 59 insertions(+), 60 deletions(-)
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index f89b2f1..40d6cba 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -124,36 +124,6 @@ struct _fpstate {
};
};
-# ifndef __KERNEL__
-/*
- * User-space might still rely on the old definition:
- */
-struct sigcontext {
- unsigned short gs, __gsh;
- unsigned short fs, __fsh;
- unsigned short es, __esh;
- unsigned short ds, __dsh;
- unsigned long edi;
- unsigned long esi;
- unsigned long ebp;
- unsigned long esp;
- unsigned long ebx;
- unsigned long edx;
- unsigned long ecx;
- unsigned long eax;
- unsigned long trapno;
- unsigned long err;
- unsigned long eip;
- unsigned short cs, __csh;
- unsigned long eflags;
- unsigned long esp_at_signal;
- unsigned short ss, __ssh;
- struct _fpstate __user *fpstate;
- unsigned long oldmask;
- unsigned long cr2;
-};
-# endif /* !__KERNEL__ */
-
#else /* __x86_64__: */
/*
@@ -186,10 +156,65 @@ struct _fpstate {
};
};
-# ifndef __KERNEL__
+#endif /* __x86_64__ */
+
+struct _header {
+ __u64 xfeatures;
+ __u64 reserved1[2];
+ __u64 reserved2[5];
+};
+
+struct _ymmh_state {
+ /* 16x YMM registers, 16 bytes each: */
+ __u32 ymmh_space[64];
+};
+
/*
- * User-space might still rely on the old definition:
+ * Extended state pointed to by sigcontext::fpstate.
+ *
+ * In addition to the fpstate, information encoded in _xstate::xstate_hdr
+ * indicates the presence of other extended state information supported
+ * by the CPU and kernel:
*/
+struct _xstate {
+ struct _fpstate fpstate;
+ struct _header xstate_hdr;
+ struct _ymmh_state ymmh;
+ /* New processor state extensions go here: */
+};
+
+/*
+ * The old user-space sigcontext definition, just in case user-space still
+ * relies on it. The kernel definition (in asm/sigcontext.h) has unified
+ * field names but otherwise the same layout.
+ */
+#ifndef __KERNEL__
+# ifdef __i386__
+struct sigcontext {
+ unsigned short gs, __gsh;
+ unsigned short fs, __fsh;
+ unsigned short es, __esh;
+ unsigned short ds, __dsh;
+ unsigned long edi;
+ unsigned long esi;
+ unsigned long ebp;
+ unsigned long esp;
+ unsigned long ebx;
+ unsigned long edx;
+ unsigned long ecx;
+ unsigned long eax;
+ unsigned long trapno;
+ unsigned long err;
+ unsigned long eip;
+ unsigned short cs, __csh;
+ unsigned long eflags;
+ unsigned long esp_at_signal;
+ unsigned short ss, __ssh;
+ struct _fpstate __user *fpstate;
+ unsigned long oldmask;
+ unsigned long cr2;
+};
+# else /* __x86_64__: */
struct sigcontext {
__u64 r8;
__u64 r9;
@@ -223,33 +248,7 @@ struct sigcontext {
# endif
__u64 reserved1[8];
};
-# endif /* !__KERNEL__ */
-
-#endif /* __x86_64__ */
-
-struct _header {
- __u64 xfeatures;
- __u64 reserved1[2];
- __u64 reserved2[5];
-};
-
-struct _ymmh_state {
- /* 16x YMM registers, 16 bytes each: */
- __u32 ymmh_space[64];
-};
-
-/*
- * Extended state pointed to by sigcontext::fpstate.
- *
- * In addition to the fpstate, information encoded in _xstate::xstate_hdr
- * indicates the presence of other extended state information supported
- * by the CPU and kernel:
- */
-struct _xstate {
- struct _fpstate fpstate;
- struct _header xstate_hdr;
- struct _ymmh_state ymmh;
- /* New processor state extensions go here: */
-};
+# endif /* __x86_64__ */
+#endif /* !__KERNEL__ */
#endif /* _UAPI_ASM_X86_SIGCONTEXT_H */
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [tip:x86/headers] x86/headers: Use ABI types consistently in sigcontext*.h
2015-09-05 7:32 ` [PATCH 05/15] x86/headers: Use ABI types consistently in sigcontext*.h Ingo Molnar
@ 2015-09-08 14:26 ` tip-bot for Ingo Molnar
0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Ingo Molnar @ 2015-09-08 14:26 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, luto, torvalds, hpa, bp, brgerst, peterz,
mikko.rapeli, oleg, dvlasenk, tglx, mingo
Commit-ID: 3f623a5b27c150451387e358774131780dbd2407
Gitweb: http://git.kernel.org/tip/3f623a5b27c150451387e358774131780dbd2407
Author: Ingo Molnar <mingo@kernel.org>
AuthorDate: Sat, 5 Sep 2015 09:32:33 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 8 Sep 2015 10:03:56 +0200
x86/headers: Use ABI types consistently in sigcontext*.h
Use the __u16/32/64 types we standardized on in ABI definitions
- and which most of this header was already using.
This will allow us to more obviously unify the compat header
into the main header.
No change in functionality.
Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi>
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: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/1441438363-9999-6-git-send-email-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/uapi/asm/sigcontext.h | 82 ++++++++++++++++----------------
arch/x86/include/uapi/asm/sigcontext32.h | 58 +++++++++++-----------
2 files changed, 70 insertions(+), 70 deletions(-)
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index 40d6cba..07b0e32 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -78,48 +78,48 @@ struct _fpx_sw_bytes {
/* 10-byte legacy floating point register: */
struct _fpreg {
- unsigned short significand[4];
- unsigned short exponent;
+ __u16 significand[4];
+ __u16 exponent;
};
/* 16-byte floating point register: */
struct _fpxreg {
- unsigned short significand[4];
- unsigned short exponent;
- unsigned short padding[3];
+ __u16 significand[4];
+ __u16 exponent;
+ __u16 padding[3];
};
/* 16-byte XMM register: */
struct _xmmreg {
- unsigned long element[4];
+ __u32 element[4];
};
#define X86_FXSR_MAGIC 0x0000
struct _fpstate {
/* Legacy FPU environment: */
- unsigned long cw;
- unsigned long sw;
- unsigned long tag;
- unsigned long ipoff;
- unsigned long cssel;
- unsigned long dataoff;
- unsigned long datasel;
+ __u32 cw;
+ __u32 sw;
+ __u32 tag;
+ __u32 ipoff;
+ __u32 cssel;
+ __u32 dataoff;
+ __u32 datasel;
struct _fpreg _st[8];
- unsigned short status;
- unsigned short magic; /* 0xffff: regular FPU data only */
+ __u16 status;
+ __u16 magic; /* 0xffff: regular FPU data only */
/* 0x0000: FXSR FPU data */
/* FXSR FPU environment */
- unsigned long _fxsr_env[6]; /* FXSR FPU env is ignored */
- unsigned long mxcsr;
- unsigned long reserved;
+ __u32 _fxsr_env[6]; /* FXSR FPU env is ignored */
+ __u32 mxcsr;
+ __u32 reserved;
struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */
struct _xmmreg _xmm[8]; /* First 8 XMM registers */
- unsigned long padding1[44]; /* Second 8 XMM registers plus padding */
+ __u32 padding1[44]; /* Second 8 XMM registers plus padding */
union {
- unsigned long padding2[12];
+ __u32 padding2[12];
struct _fpx_sw_bytes sw_reserved; /* Potential extended state is encoded here */
};
};
@@ -191,28 +191,28 @@ struct _xstate {
#ifndef __KERNEL__
# ifdef __i386__
struct sigcontext {
- unsigned short gs, __gsh;
- unsigned short fs, __fsh;
- unsigned short es, __esh;
- unsigned short ds, __dsh;
- unsigned long edi;
- unsigned long esi;
- unsigned long ebp;
- unsigned long esp;
- unsigned long ebx;
- unsigned long edx;
- unsigned long ecx;
- unsigned long eax;
- unsigned long trapno;
- unsigned long err;
- unsigned long eip;
- unsigned short cs, __csh;
- unsigned long eflags;
- unsigned long esp_at_signal;
- unsigned short ss, __ssh;
+ __u16 gs, __gsh;
+ __u16 fs, __fsh;
+ __u16 es, __esh;
+ __u16 ds, __dsh;
+ __u32 edi;
+ __u32 esi;
+ __u32 ebp;
+ __u32 esp;
+ __u32 ebx;
+ __u32 edx;
+ __u32 ecx;
+ __u32 eax;
+ __u32 trapno;
+ __u32 err;
+ __u32 eip;
+ __u16 cs, __csh;
+ __u32 eflags;
+ __u32 esp_at_signal;
+ __u16 ss, __ssh;
struct _fpstate __user *fpstate;
- unsigned long oldmask;
- unsigned long cr2;
+ __u32 oldmask;
+ __u32 cr2;
};
# else /* __x86_64__: */
struct sigcontext {
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
index 6ff4fba..939a848 100644
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -9,15 +9,15 @@
/* 10-byte legacy floating point register: */
struct _fpreg {
- unsigned short significand[4];
- unsigned short exponent;
+ __u16 significand[4];
+ __u16 exponent;
};
/* 16-byte floating point register: */
struct _fpxreg {
- unsigned short significand[4];
- unsigned short exponent;
- unsigned short padding[3];
+ __u16 significand[4];
+ __u16 exponent;
+ __u16 padding[3];
};
/* 16-byte XMM vector register: */
@@ -38,8 +38,8 @@ struct _fpstate_ia32 {
__u32 dataoff;
__u32 datasel;
struct _fpreg _st[8];
- unsigned short status;
- unsigned short magic; /* 0xffff: regular FPU data only */
+ __u16 status;
+ __u16 magic; /* 0xffff: regular FPU data only */
/* 0x0000: FXSR data */
/* Extended FXSR FPU environment: */
@@ -58,28 +58,28 @@ struct _fpstate_ia32 {
/* 32-bit compat sigcontext: */
struct sigcontext_ia32 {
- unsigned short gs, __gsh;
- unsigned short fs, __fsh;
- unsigned short es, __esh;
- unsigned short ds, __dsh;
- unsigned int di;
- unsigned int si;
- unsigned int bp;
- unsigned int sp;
- unsigned int bx;
- unsigned int dx;
- unsigned int cx;
- unsigned int ax;
- unsigned int trapno;
- unsigned int err;
- unsigned int ip;
- unsigned short cs, __csh;
- unsigned int flags;
- unsigned int sp_at_signal;
- unsigned short ss, __ssh;
- unsigned int fpstate; /* Pointer to 'struct _fpstate_ia32' */
- unsigned int oldmask;
- unsigned int cr2;
+ __u16 gs, __gsh;
+ __u16 fs, __fsh;
+ __u16 es, __esh;
+ __u16 ds, __dsh;
+ __u32 di;
+ __u32 si;
+ __u32 bp;
+ __u32 sp;
+ __u32 bx;
+ __u32 dx;
+ __u32 cx;
+ __u32 ax;
+ __u32 trapno;
+ __u32 err;
+ __u32 ip;
+ __u16 cs, __csh;
+ __u32 flags;
+ __u32 sp_at_signal;
+ __u16 ss, __ssh;
+ __u32 fpstate; /* Pointer to 'struct _fpstate_ia32' */
+ __u32 oldmask;
+ __u32 cr2;
};
#endif /* _ASM_X86_SIGCONTEXT32_H */
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [tip:x86/headers] x86/headers: Unify register type definitions between 32-bit compat and i386
2015-09-05 7:32 ` [PATCH 06/15] x86/headers: Unify register type definitions between 32-bit compat and i386 Ingo Molnar
@ 2015-09-08 14:26 ` tip-bot for Ingo Molnar
0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Ingo Molnar @ 2015-09-08 14:26 UTC (permalink / raw)
To: linux-tip-commits
Cc: oleg, dvlasenk, brgerst, peterz, luto, linux-kernel, hpa,
torvalds, mikko.rapeli, mingo, bp, tglx
Commit-ID: 337a167d1a5b2704414679d1a993220a4613ec13
Gitweb: http://git.kernel.org/tip/337a167d1a5b2704414679d1a993220a4613ec13
Author: Ingo Molnar <mingo@kernel.org>
AuthorDate: Sat, 5 Sep 2015 09:32:34 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 8 Sep 2015 10:03:56 +0200
x86/headers: Unify register type definitions between 32-bit compat and i386
The following sigcontext related types were duplicated across
native 32-bit and compat 32-bit headers:
struct _fpreg;
struct _fpxreg;
struct _xmmreg;
X86_FXSR_MAGIC
Unify them.
Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi>
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: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/1441438363-9999-7-git-send-email-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/uapi/asm/sigcontext.h | 3 ++-
arch/x86/include/uapi/asm/sigcontext32.h | 22 ----------------------
2 files changed, 2 insertions(+), 23 deletions(-)
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index 07b0e32..9df4df3 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -63,7 +63,6 @@ struct _fpx_sw_bytes {
__u32 padding[7];
};
-#ifdef __i386__
/*
* As documented in the iBCS2 standard:
*
@@ -96,6 +95,8 @@ struct _xmmreg {
#define X86_FXSR_MAGIC 0x0000
+#ifdef __i386__
+
struct _fpstate {
/* Legacy FPU environment: */
__u32 cw;
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
index 939a848..356caab 100644
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -3,30 +3,8 @@
/* Signal context definitions for compat 32-bit programs: */
-#include <linux/types.h>
-
#include <asm/sigcontext.h>
-/* 10-byte legacy floating point register: */
-struct _fpreg {
- __u16 significand[4];
- __u16 exponent;
-};
-
-/* 16-byte floating point register: */
-struct _fpxreg {
- __u16 significand[4];
- __u16 exponent;
- __u16 padding[3];
-};
-
-/* 16-byte XMM vector register: */
-struct _xmmreg {
- __u32 element[4];
-};
-
-#define X86_FXSR_MAGIC 0x0000
-
/* FXSAVE frame: FSAVE frame with extensions */
struct _fpstate_ia32 {
/* Regular FPU environment: */
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [tip:x86/headers] x86/headers: Unify 'struct _fpstate_ia32' and i386 struct _fpstate
2015-09-05 7:32 ` [PATCH 07/15] x86/headers: Unify 'struct _fpstate_ia32' and i386 struct _fpstate Ingo Molnar
@ 2015-09-08 14:26 ` tip-bot for Ingo Molnar
0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Ingo Molnar @ 2015-09-08 14:26 UTC (permalink / raw)
To: linux-tip-commits
Cc: tglx, brgerst, mingo, oleg, mikko.rapeli, dvlasenk, hpa,
linux-kernel, bp, peterz, torvalds, luto
Commit-ID: 7bb0dc2222779b4cbf1ec9ad651e500e62fa5b11
Gitweb: http://git.kernel.org/tip/7bb0dc2222779b4cbf1ec9ad651e500e62fa5b11
Author: Ingo Molnar <mingo@kernel.org>
AuthorDate: Sat, 5 Sep 2015 09:32:35 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 8 Sep 2015 10:03:57 +0200
x86/headers: Unify 'struct _fpstate_ia32' and i386 struct _fpstate
'struct _fpstate_ia32' and 'struct _fpstate' on i386 are
identical in all fields, except 'padding1' being named
'padding'.
We unify the two structures and add a union that is both named
'padding1' and 'padding', in the (unlikely) case there's
user-space code that relies on the padding field name.
We rename the two main types to be:
struct _fpstate_32
struct _fpstate_64
for the 32-bit and 64-bit frame, and map them to the main and
compat structure names (_fpstate) depending on whether we are on
32-bit or on 64-bit kernels.
We also keep the old _fpstate_ia32 name as a legacy name.
Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi>
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: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/1441438363-9999-8-git-send-email-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/asm/sigframe.h | 1 -
arch/x86/include/uapi/asm/sigcontext.h | 26 +++++++++++++++++---------
arch/x86/include/uapi/asm/sigcontext32.h | 29 -----------------------------
3 files changed, 17 insertions(+), 39 deletions(-)
diff --git a/arch/x86/include/asm/sigframe.h b/arch/x86/include/asm/sigframe.h
index 1f3175b..a27c73d 100644
--- a/arch/x86/include/asm/sigframe.h
+++ b/arch/x86/include/asm/sigframe.h
@@ -10,7 +10,6 @@
#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 */
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index 9df4df3..8581116 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -95,9 +95,10 @@ struct _xmmreg {
#define X86_FXSR_MAGIC 0x0000
-#ifdef __i386__
-
-struct _fpstate {
+/*
+ * The 32-bit FPU frame:
+ */
+struct _fpstate_32 {
/* Legacy FPU environment: */
__u32 cw;
__u32 sw;
@@ -117,7 +118,10 @@ struct _fpstate {
__u32 reserved;
struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */
struct _xmmreg _xmm[8]; /* First 8 XMM registers */
- __u32 padding1[44]; /* Second 8 XMM registers plus padding */
+ union {
+ __u32 padding1[44]; /* Second 8 XMM registers plus padding */
+ __u32 padding[44]; /* Alias name for old user-space */
+ };
union {
__u32 padding2[12];
@@ -125,10 +129,8 @@ struct _fpstate {
};
};
-#else /* __x86_64__: */
-
/*
- * The FXSAVE frame.
+ * The 64-bit FPU frame. (FXSAVE format and later)
*
* Note1: If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then the structure is
* larger: 'struct _xstate'. Note that 'struct _xstate' embedds
@@ -138,7 +140,7 @@ struct _fpstate {
* Note2: Reserved fields may someday contain valuable data. Always save/restore
* them when you change signal frames.
*/
-struct _fpstate {
+struct _fpstate_64 {
__u16 cwd;
__u16 swd;
/* Note this is not the same as the 32-bit/x87/FSAVE twd: */
@@ -157,7 +159,13 @@ struct _fpstate {
};
};
-#endif /* __x86_64__ */
+#ifdef __i386__
+# define _fpstate _fpstate_32
+#else
+# define _fpstate _fpstate_64
+#endif
+
+#define _fpstate_ia32 _fpstate_32
struct _header {
__u64 xfeatures;
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
index 356caab..19a8916 100644
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -5,35 +5,6 @@
#include <asm/sigcontext.h>
-/* FXSAVE frame: FSAVE frame with extensions */
-struct _fpstate_ia32 {
- /* Regular FPU environment: */
- __u32 cw;
- __u32 sw;
- __u32 tag; /* Not compatible with the 64-bit frame */
- __u32 ipoff;
- __u32 cssel;
- __u32 dataoff;
- __u32 datasel;
- struct _fpreg _st[8];
- __u16 status;
- __u16 magic; /* 0xffff: regular FPU data only */
- /* 0x0000: FXSR data */
-
- /* Extended FXSR FPU environment: */
- __u32 _fxsr_env[6];
- __u32 mxcsr;
- __u32 reserved;
- struct _fpxreg _fxsr_st[8];
- struct _xmmreg _xmm[8]; /* The first 8 XMM registers */
- __u32 padding[44]; /* The second 8 XMM registers plus padding */
- union {
- __u32 padding2[12];
- /* Might encode xstate extensions, see asm/sigcontext.h: */
- struct _fpx_sw_bytes sw_reserved;
- };
-};
-
/* 32-bit compat sigcontext: */
struct sigcontext_ia32 {
__u16 gs, __gsh;
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [tip:x86/headers] x86/headers: Convert uses of _fpstate_ia32 to _fpstate_32
2015-09-05 7:32 ` [PATCH 08/15] x86/headers: Convert uses of _fpstate_ia32 to _fpstate_32 Ingo Molnar
@ 2015-09-08 14:27 ` tip-bot for Ingo Molnar
0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Ingo Molnar @ 2015-09-08 14:27 UTC (permalink / raw)
To: linux-tip-commits
Cc: hpa, oleg, luto, brgerst, torvalds, bp, peterz, mingo,
mikko.rapeli, tglx, linux-kernel, dvlasenk
Commit-ID: 86e9fc3a0ecdd3c21a938e325daf462ca1724f68
Gitweb: http://git.kernel.org/tip/86e9fc3a0ecdd3c21a938e325daf462ca1724f68
Author: Ingo Molnar <mingo@kernel.org>
AuthorDate: Sat, 5 Sep 2015 09:32:36 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 8 Sep 2015 10:03:57 +0200
x86/headers: Convert uses of _fpstate_ia32 to _fpstate_32
Remove uses of _fpstate_ia32 from the kernel, and move the
legacy _fpstate_ia32 definition to the user-space only portion
of the header.
Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi>
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: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/1441438363-9999-9-git-send-email-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/ia32/ia32_signal.c | 2 +-
arch/x86/include/asm/sigframe.h | 2 +-
arch/x86/include/uapi/asm/sigcontext.h | 5 +++--
arch/x86/include/uapi/asm/sigcontext32.h | 2 +-
arch/x86/kernel/fpu/signal.c | 4 ++--
5 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index a0a19b7..b22015e 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -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;
diff --git a/arch/x86/include/asm/sigframe.h b/arch/x86/include/asm/sigframe.h
index a27c73d..5ff020a 100644
--- a/arch/x86/include/asm/sigframe.h
+++ b/arch/x86/include/asm/sigframe.h
@@ -32,7 +32,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 */
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index 8581116..ca542e3 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -165,8 +165,6 @@ struct _fpstate_64 {
# define _fpstate _fpstate_64
#endif
-#define _fpstate_ia32 _fpstate_32
-
struct _header {
__u64 xfeatures;
__u64 reserved1[2];
@@ -198,6 +196,9 @@ struct _xstate {
* field names but otherwise the same layout.
*/
#ifndef __KERNEL__
+
+#define _fpstate_ia32 _fpstate_32
+
# ifdef __i386__
struct sigcontext {
__u16 gs, __gsh;
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
index 19a8916..06c749b 100644
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -26,7 +26,7 @@ struct sigcontext_ia32 {
__u32 flags;
__u32 sp_at_signal;
__u16 ss, __ssh;
- __u32 fpstate; /* Pointer to 'struct _fpstate_ia32' */
+ __u32 fpstate; /* Pointer to 'struct _fpstate_32' */
__u32 oldmask;
__u32 cr2;
};
diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c
index 50ec9af..24aac16 100644
--- a/arch/x86/kernel/fpu/signal.c
+++ b/arch/x86/kernel/fpu/signal.c
@@ -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. */
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [tip:x86/headers] x86/headers: Clean up the kernel' s struct sigcontext types to be ABI-clean
2015-09-05 7:32 ` [PATCH 09/15] x86/headers: Clean up the kernel's struct sigcontext types to be ABI-clean Ingo Molnar
@ 2015-09-08 14:27 ` tip-bot for Ingo Molnar
0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Ingo Molnar @ 2015-09-08 14:27 UTC (permalink / raw)
To: linux-tip-commits
Cc: tglx, bp, peterz, linux-kernel, torvalds, luto, oleg, dvlasenk,
brgerst, mikko.rapeli, hpa, mingo
Commit-ID: 2d057c69e743bfb88f1259ddbf1b1160bdd850e5
Gitweb: http://git.kernel.org/tip/2d057c69e743bfb88f1259ddbf1b1160bdd850e5
Author: Ingo Molnar <mingo@kernel.org>
AuthorDate: Sat, 5 Sep 2015 09:32:37 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 8 Sep 2015 10:03:57 +0200
x86/headers: Clean up the kernel's struct sigcontext types to be ABI-clean
Use the __u16/32/64 types we standardized on in ABI definitions
and which other sigcontext related types are already using.
This will help unify struct sigcontext types between native
32-bit, compat and 64-bit kernels.
Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi>
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: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/1441438363-9999-10-git-send-email-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/asm/sigcontext.h | 104 +++++++++++++++++++-------------------
1 file changed, 52 insertions(+), 52 deletions(-)
diff --git a/arch/x86/include/asm/sigcontext.h b/arch/x86/include/asm/sigcontext.h
index 9dfce4e..b9c2bd6 100644
--- a/arch/x86/include/asm/sigcontext.h
+++ b/arch/x86/include/asm/sigcontext.h
@@ -5,25 +5,25 @@
#ifdef __i386__
struct sigcontext {
- unsigned short gs, __gsh;
- unsigned short fs, __fsh;
- unsigned short es, __esh;
- unsigned short ds, __dsh;
- unsigned long di;
- unsigned long si;
- unsigned long bp;
- unsigned long sp;
- unsigned long bx;
- unsigned long dx;
- unsigned long cx;
- unsigned long ax;
- unsigned long trapno;
- unsigned long err;
- unsigned long ip;
- unsigned short cs, __csh;
- unsigned long flags;
- unsigned long sp_at_signal;
- unsigned short ss, __ssh;
+ __u16 gs, __gsh;
+ __u16 fs, __fsh;
+ __u16 es, __esh;
+ __u16 ds, __dsh;
+ __u32 di;
+ __u32 si;
+ __u32 bp;
+ __u32 sp;
+ __u32 bx;
+ __u32 dx;
+ __u32 cx;
+ __u32 ax;
+ __u32 trapno;
+ __u32 err;
+ __u32 ip;
+ __u16 cs, __csh;
+ __u32 flags;
+ __u32 sp_at_signal;
+ __u16 ss, __ssh;
/*
* fpstate is really (struct _fpstate *) or (struct _xstate *)
@@ -32,38 +32,38 @@ struct sigcontext {
* of extended memory layout. See comments at the definition of
* (struct _fpx_sw_bytes)
*/
- void __user *fpstate; /* zero when no FPU/extended context */
- unsigned long oldmask;
- unsigned long cr2;
+ void __user *fpstate; /* Zero when no FPU/extended context */
+ __u32 oldmask;
+ __u32 cr2;
};
-#else /* __i386__ */
+#else /* __x86_64__: */
struct sigcontext {
- unsigned long r8;
- unsigned long r9;
- unsigned long r10;
- unsigned long r11;
- unsigned long r12;
- unsigned long r13;
- unsigned long r14;
- unsigned long r15;
- unsigned long di;
- unsigned long si;
- unsigned long bp;
- unsigned long bx;
- unsigned long dx;
- unsigned long ax;
- unsigned long cx;
- unsigned long sp;
- unsigned long ip;
- unsigned long flags;
- unsigned short cs;
- unsigned short gs;
- unsigned short fs;
- unsigned short __pad0;
- unsigned long err;
- unsigned long trapno;
- unsigned long oldmask;
- unsigned long cr2;
+ __u64 r8;
+ __u64 r9;
+ __u64 r10;
+ __u64 r11;
+ __u64 r12;
+ __u64 r13;
+ __u64 r14;
+ __u64 r15;
+ __u64 di;
+ __u64 si;
+ __u64 bp;
+ __u64 bx;
+ __u64 dx;
+ __u64 ax;
+ __u64 cx;
+ __u64 sp;
+ __u64 ip;
+ __u64 flags;
+ __u16 cs;
+ __u16 gs;
+ __u16 fs;
+ __u16 __pad0;
+ __u64 err;
+ __u64 trapno;
+ __u64 oldmask;
+ __u64 cr2;
/*
* fpstate is really (struct _fpstate *) or (struct _xstate *)
@@ -72,8 +72,8 @@ struct sigcontext {
* of extended memory layout. See comments at the definition of
* (struct _fpx_sw_bytes)
*/
- void __user *fpstate; /* zero when no FPU/extended context */
- unsigned long reserved1[8];
+ void __user *fpstate; /* Zero when no FPU/extended context */
+ __u64 reserved1[8];
};
-#endif /* !__i386__ */
+#endif /* !__x86_64__ */
#endif /* _ASM_X86_SIGCONTEXT_H */
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [tip:x86/headers] x86/headers: Move the 'struct sigcontext' definitions into the UAPI header
2015-09-05 7:32 ` [PATCH 10/15] x86/headers: Move the 'struct sigcontext' definitions into the UAPI header Ingo Molnar
@ 2015-09-08 14:27 ` tip-bot for Ingo Molnar
0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Ingo Molnar @ 2015-09-08 14:27 UTC (permalink / raw)
To: linux-tip-commits
Cc: luto, bp, linux-kernel, brgerst, oleg, hpa, tglx, peterz,
mikko.rapeli, dvlasenk, torvalds, mingo
Commit-ID: f2c609bca0b6526810fa22330ce4d173cc023ef8
Gitweb: http://git.kernel.org/tip/f2c609bca0b6526810fa22330ce4d173cc023ef8
Author: Ingo Molnar <mingo@kernel.org>
AuthorDate: Sat, 5 Sep 2015 09:32:38 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 8 Sep 2015 10:03:58 +0200
x86/headers: Move the 'struct sigcontext' definitions into the UAPI header
Our goal is to eliminate the duplicate struct sigcontext_ia32
definition, so move the kernel's primary sigcontext type into
the UAPI header, defining these two variants:
struct sigcontext_32
struct sigcontext_64
... and map them to 'struct sigcontext'.
Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi>
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: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/1441438363-9999-11-git-send-email-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/asm/sigcontext.h | 73 ------------------------------
arch/x86/include/uapi/asm/sigcontext.h | 83 ++++++++++++++++++++++++++++++++++
2 files changed, 83 insertions(+), 73 deletions(-)
diff --git a/arch/x86/include/asm/sigcontext.h b/arch/x86/include/asm/sigcontext.h
index b9c2bd6..25815f0 100644
--- a/arch/x86/include/asm/sigcontext.h
+++ b/arch/x86/include/asm/sigcontext.h
@@ -3,77 +3,4 @@
#include <uapi/asm/sigcontext.h>
-#ifdef __i386__
-struct sigcontext {
- __u16 gs, __gsh;
- __u16 fs, __fsh;
- __u16 es, __esh;
- __u16 ds, __dsh;
- __u32 di;
- __u32 si;
- __u32 bp;
- __u32 sp;
- __u32 bx;
- __u32 dx;
- __u32 cx;
- __u32 ax;
- __u32 trapno;
- __u32 err;
- __u32 ip;
- __u16 cs, __csh;
- __u32 flags;
- __u32 sp_at_signal;
- __u16 ss, __ssh;
-
- /*
- * fpstate is really (struct _fpstate *) or (struct _xstate *)
- * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved
- * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end
- * of extended memory layout. See comments at the definition of
- * (struct _fpx_sw_bytes)
- */
- void __user *fpstate; /* Zero when no FPU/extended context */
- __u32 oldmask;
- __u32 cr2;
-};
-#else /* __x86_64__: */
-struct sigcontext {
- __u64 r8;
- __u64 r9;
- __u64 r10;
- __u64 r11;
- __u64 r12;
- __u64 r13;
- __u64 r14;
- __u64 r15;
- __u64 di;
- __u64 si;
- __u64 bp;
- __u64 bx;
- __u64 dx;
- __u64 ax;
- __u64 cx;
- __u64 sp;
- __u64 ip;
- __u64 flags;
- __u16 cs;
- __u16 gs;
- __u16 fs;
- __u16 __pad0;
- __u64 err;
- __u64 trapno;
- __u64 oldmask;
- __u64 cr2;
-
- /*
- * fpstate is really (struct _fpstate *) or (struct _xstate *)
- * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved
- * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end
- * of extended memory layout. See comments at the definition of
- * (struct _fpx_sw_bytes)
- */
- void __user *fpstate; /* Zero when no FPU/extended context */
- __u64 reserved1[8];
-};
-#endif /* !__x86_64__ */
#endif /* _ASM_X86_SIGCONTEXT_H */
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index ca542e3..3591cef 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -190,6 +190,89 @@ struct _xstate {
/* New processor state extensions go here: */
};
+struct sigcontext_32 {
+ __u16 gs, __gsh;
+ __u16 fs, __fsh;
+ __u16 es, __esh;
+ __u16 ds, __dsh;
+ __u32 di;
+ __u32 si;
+ __u32 bp;
+ __u32 sp;
+ __u32 bx;
+ __u32 dx;
+ __u32 cx;
+ __u32 ax;
+ __u32 trapno;
+ __u32 err;
+ __u32 ip;
+ __u16 cs, __csh;
+ __u32 flags;
+ __u32 sp_at_signal;
+ __u16 ss, __ssh;
+
+ /*
+ * fpstate is really (struct _fpstate *) or (struct _xstate *)
+ * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved
+ * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end
+ * of extended memory layout. See comments at the definition of
+ * (struct _fpx_sw_bytes)
+ */
+ void __user *fpstate; /* Zero when no FPU/extended context */
+ __u32 oldmask;
+ __u32 cr2;
+};
+
+struct sigcontext_64 {
+ __u64 r8;
+ __u64 r9;
+ __u64 r10;
+ __u64 r11;
+ __u64 r12;
+ __u64 r13;
+ __u64 r14;
+ __u64 r15;
+ __u64 di;
+ __u64 si;
+ __u64 bp;
+ __u64 bx;
+ __u64 dx;
+ __u64 ax;
+ __u64 cx;
+ __u64 sp;
+ __u64 ip;
+ __u64 flags;
+ __u16 cs;
+ __u16 gs;
+ __u16 fs;
+ __u16 __pad0;
+ __u64 err;
+ __u64 trapno;
+ __u64 oldmask;
+ __u64 cr2;
+
+ /*
+ * fpstate is really (struct _fpstate *) or (struct _xstate *)
+ * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved
+ * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end
+ * of extended memory layout. See comments at the definition of
+ * (struct _fpx_sw_bytes)
+ */
+ void __user *fpstate; /* Zero when no FPU/extended context */
+ __u64 reserved1[8];
+};
+
+/*
+ * Create the real 'struct sigcontext' type:
+ */
+#ifdef __KERNEL__
+# ifdef __i386__
+# define sigcontext sigcontext_32
+# else
+# define sigcontext sigcontext_64
+# endif
+#endif
+
/*
* The old user-space sigcontext definition, just in case user-space still
* relies on it. The kernel definition (in asm/sigcontext.h) has unified
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [tip:x86/headers] x86/headers: Make sigcontext pointers bit independent
2015-09-05 7:32 ` [PATCH 11/15] x86/headers: Make sigcontext pointers bit independent Ingo Molnar
@ 2015-09-08 14:28 ` tip-bot for Ingo Molnar
0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Ingo Molnar @ 2015-09-08 14:28 UTC (permalink / raw)
To: linux-tip-commits
Cc: oleg, mikko.rapeli, peterz, luto, tglx, torvalds, brgerst, bp,
linux-kernel, hpa, dvlasenk, mingo
Commit-ID: 530e5c827182a7a5322c55276b0617fd06874c24
Gitweb: http://git.kernel.org/tip/530e5c827182a7a5322c55276b0617fd06874c24
Author: Ingo Molnar <mingo@kernel.org>
AuthorDate: Sat, 5 Sep 2015 09:32:39 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 8 Sep 2015 10:03:58 +0200
x86/headers: Make sigcontext pointers bit independent
Before we can eliminate the duplication between 'struct
sigcontext_32' and 'struct sigcontext_ia32', make the 'fpstate'
pointer field in 'struct sigcontext_32' bit independent.
Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi>
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: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/1441438363-9999-12-git-send-email-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/uapi/asm/sigcontext.h | 4 ++--
arch/x86/kernel/signal.c | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index 3591cef..d0def25 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -218,7 +218,7 @@ struct sigcontext_32 {
* of extended memory layout. See comments at the definition of
* (struct _fpx_sw_bytes)
*/
- void __user *fpstate; /* Zero when no FPU/extended context */
+ __u32 fpstate; /* Zero when no FPU/extended context */
__u32 oldmask;
__u32 cr2;
};
@@ -258,7 +258,7 @@ struct sigcontext_64 {
* of extended memory layout. See comments at the definition of
* (struct _fpx_sw_bytes)
*/
- void __user *fpstate; /* Zero when no FPU/extended context */
+ __u64 fpstate; /* Zero when no FPU/extended context */
__u64 reserved1[8];
};
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index da52e6b..3724ff3 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -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));
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [tip:x86/headers] x86/headers: Unify 'struct sigcontext_ia32' and 'struct sigcontext_32'
2015-09-05 7:32 ` [PATCH 12/15] x86/headers: Unify 'struct sigcontext_ia32' and 'struct sigcontext_32' Ingo Molnar
@ 2015-09-08 14:28 ` tip-bot for Ingo Molnar
0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Ingo Molnar @ 2015-09-08 14:28 UTC (permalink / raw)
To: linux-tip-commits
Cc: mikko.rapeli, oleg, mingo, dvlasenk, peterz, torvalds, tglx, hpa,
linux-kernel, brgerst, luto, bp
Commit-ID: db1e031401c6abab983919e882916d028f3b385e
Gitweb: http://git.kernel.org/tip/db1e031401c6abab983919e882916d028f3b385e
Author: Ingo Molnar <mingo@kernel.org>
AuthorDate: Sat, 5 Sep 2015 09:32:40 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 8 Sep 2015 10:03:58 +0200
x86/headers: Unify 'struct sigcontext_ia32' and 'struct sigcontext_32'
The two structures are identical - merge them and keep the
legacy name as a define.
Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi>
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: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/1441438363-9999-13-git-send-email-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/asm/sigframe.h | 1 -
arch/x86/include/uapi/asm/sigcontext.h | 2 ++
arch/x86/include/uapi/asm/sigcontext32.h | 26 --------------------------
3 files changed, 2 insertions(+), 27 deletions(-)
diff --git a/arch/x86/include/asm/sigframe.h b/arch/x86/include/asm/sigframe.h
index 5ff020a..98f0401 100644
--- a/arch/x86/include/asm/sigframe.h
+++ b/arch/x86/include/asm/sigframe.h
@@ -9,7 +9,6 @@
#ifdef CONFIG_X86_32
#define sigframe_ia32 sigframe
#define rt_sigframe_ia32 rt_sigframe
-#define sigcontext_ia32 sigcontext
#define ucontext_ia32 ucontext
#else /* !CONFIG_X86_32 */
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index d0def25..592bfaf 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -223,6 +223,8 @@ struct sigcontext_32 {
__u32 cr2;
};
+#define sigcontext_ia32 sigcontext_32
+
struct sigcontext_64 {
__u64 r8;
__u64 r9;
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
index 06c749b..257fbb3 100644
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -5,30 +5,4 @@
#include <asm/sigcontext.h>
-/* 32-bit compat sigcontext: */
-struct sigcontext_ia32 {
- __u16 gs, __gsh;
- __u16 fs, __fsh;
- __u16 es, __esh;
- __u16 ds, __dsh;
- __u32 di;
- __u32 si;
- __u32 bp;
- __u32 sp;
- __u32 bx;
- __u32 dx;
- __u32 cx;
- __u32 ax;
- __u32 trapno;
- __u32 err;
- __u32 ip;
- __u16 cs, __csh;
- __u32 flags;
- __u32 sp_at_signal;
- __u16 ss, __ssh;
- __u32 fpstate; /* Pointer to 'struct _fpstate_32' */
- __u32 oldmask;
- __u32 cr2;
-};
-
#endif /* _ASM_X86_SIGCONTEXT32_H */
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [tip:x86/headers] x86/headers: Convert sigcontext_ia32 uses to sigcontext_32
2015-09-05 7:32 ` [PATCH 13/15] x86/headers: Convert sigcontext_ia32 uses to sigcontext_32 Ingo Molnar
@ 2015-09-08 14:28 ` tip-bot for Ingo Molnar
0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Ingo Molnar @ 2015-09-08 14:28 UTC (permalink / raw)
To: linux-tip-commits
Cc: peterz, dvlasenk, mingo, mikko.rapeli, hpa, tglx, brgerst,
linux-kernel, torvalds, bp, oleg, luto
Commit-ID: 8fcb346b910e860d2525457742ae984c4ddc64b5
Gitweb: http://git.kernel.org/tip/8fcb346b910e860d2525457742ae984c4ddc64b5
Author: Ingo Molnar <mingo@kernel.org>
AuthorDate: Sat, 5 Sep 2015 09:32:41 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 8 Sep 2015 10:03:59 +0200
x86/headers: Convert sigcontext_ia32 uses to sigcontext_32
Use the new name in kernel code, and move the old name to the
user-space-only legacy section of the UAPI header.
Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi>
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: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/1441438363-9999-14-git-send-email-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/ia32/ia32_signal.c | 4 ++--
arch/x86/include/asm/ia32.h | 2 +-
arch/x86/include/asm/sigframe.h | 2 +-
arch/x86/include/uapi/asm/sigcontext.h | 12 +++++++++---
arch/x86/kernel/asm-offsets.c | 18 +++++++++---------
5 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index b22015e..b421030 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -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 @@ badframe:
* 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)
{
diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h
index 2801976..3173b48 100644
--- a/arch/x86/include/asm/ia32.h
+++ b/arch/x86/include/asm/ia32.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 */
};
diff --git a/arch/x86/include/asm/sigframe.h b/arch/x86/include/asm/sigframe.h
index 98f0401..867a757 100644
--- a/arch/x86/include/asm/sigframe.h
+++ b/arch/x86/include/asm/sigframe.h
@@ -22,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
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index 592bfaf..4411e6a 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -190,6 +190,9 @@ struct _xstate {
/* New processor state extensions go here: */
};
+/*
+ * The 32-bit signal frame:
+ */
struct sigcontext_32 {
__u16 gs, __gsh;
__u16 fs, __fsh;
@@ -223,8 +226,9 @@ struct sigcontext_32 {
__u32 cr2;
};
-#define sigcontext_ia32 sigcontext_32
-
+/*
+ * The 64-bit signal frame:
+ */
struct sigcontext_64 {
__u64 r8;
__u64 r9;
@@ -282,7 +286,9 @@ struct sigcontext_64 {
*/
#ifndef __KERNEL__
-#define _fpstate_ia32 _fpstate_32
+#define _fpstate_ia32 _fpstate_32
+#define sigcontext_ia32 sigcontext_32
+
# ifdef __i386__
struct sigcontext {
diff --git a/arch/x86/kernel/asm-offsets.c b/arch/x86/kernel/asm-offsets.c
index 8e3d22a1..bc9f4af 100644
--- a/arch/x86/kernel/asm-offsets.c
+++ b/arch/x86/kernel/asm-offsets.c
@@ -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);
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [tip:x86/headers] x86/headers: Remove direct sigcontext32.h uses
2015-09-05 7:32 ` [PATCH 14/15] x86/headers: Remove direct sigcontext32.h uses Ingo Molnar
@ 2015-09-08 14:29 ` tip-bot for Ingo Molnar
0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Ingo Molnar @ 2015-09-08 14:29 UTC (permalink / raw)
To: linux-tip-commits
Cc: tglx, oleg, dvlasenk, luto, brgerst, linux-kernel, peterz, hpa,
mikko.rapeli, bp, torvalds, mingo
Commit-ID: 711531f4f3cb881f4598cddfcc36663101dee411
Gitweb: http://git.kernel.org/tip/711531f4f3cb881f4598cddfcc36663101dee411
Author: Ingo Molnar <mingo@kernel.org>
AuthorDate: Sat, 5 Sep 2015 09:32:42 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 8 Sep 2015 10:03:59 +0200
x86/headers: Remove direct sigcontext32.h uses
Now that all sigcontext types are defined in asm/sigcontext.h,
remove the various sigcontext32.h uses in the kernel.
We still keep the header itself, which includes sigcontext.h, in
case user-space relies on it.
Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi>
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: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/1441438363-9999-15-git-send-email-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/ia32/ia32_signal.c | 2 +-
arch/x86/include/asm/fpu/signal.h | 2 +-
arch/x86/include/asm/ia32.h | 2 +-
arch/x86/include/uapi/asm/sigcontext32.h | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index b421030..955ca03 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -26,7 +26,7 @@
#include <asm/ptrace.h>
#include <asm/ia32_unistd.h>
#include <asm/user32.h>
-#include <asm/sigcontext32.h>
+#include <asm/sigcontext.h>
#include <asm/proto.h>
#include <asm/vdso.h>
#include <asm/sigframe.h>
diff --git a/arch/x86/include/asm/fpu/signal.h b/arch/x86/include/asm/fpu/signal.h
index 7358e9d..856f4b3c 100644
--- a/arch/x86/include/asm/fpu/signal.h
+++ b/arch/x86/include/asm/fpu/signal.h
@@ -5,7 +5,7 @@
#define _ASM_X86_FPU_SIGNAL_H
#ifdef CONFIG_X86_64
-# include <asm/sigcontext32.h>
+# include <asm/sigcontext.h>
# include <asm/user32.h>
struct ksignal;
int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h
index 3173b48..16edda2 100644
--- a/arch/x86/include/asm/ia32.h
+++ b/arch/x86/include/asm/ia32.h
@@ -10,7 +10,7 @@
* 32 bit structures for IA32 support.
*/
-#include <asm/sigcontext32.h>
+#include <asm/sigcontext.h>
/* signal.h */
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
index 257fbb3..a92b0f0 100644
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -1,7 +1,7 @@
#ifndef _ASM_X86_SIGCONTEXT32_H
#define _ASM_X86_SIGCONTEXT32_H
-/* Signal context definitions for compat 32-bit programs: */
+/* This is a legacy file - all the type definitions are in sigcontext.h: */
#include <asm/sigcontext.h>
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [tip:x86/headers] x86/headers: Remove <asm/sigcontext.h> references on the kernel side
2015-09-05 7:32 ` [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> Ingo Molnar
2015-09-05 10:57 ` Mikko Rapeli
@ 2015-09-08 14:29 ` tip-bot for Ingo Molnar
2015-09-08 20:17 ` Mikko Rapeli
1 sibling, 1 reply; 41+ messages in thread
From: tip-bot for Ingo Molnar @ 2015-09-08 14:29 UTC (permalink / raw)
To: linux-tip-commits
Cc: luto, oleg, hpa, brgerst, linux-kernel, dvlasenk, mikko.rapeli,
torvalds, mingo, peterz, bp, tglx
Commit-ID: decb4c41159e1511197f2964da758fa7f2eeb741
Gitweb: http://git.kernel.org/tip/decb4c41159e1511197f2964da758fa7f2eeb741
Author: Ingo Molnar <mingo@kernel.org>
AuthorDate: Sat, 5 Sep 2015 09:32:43 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 8 Sep 2015 10:06:05 +0200
x86/headers: Remove <asm/sigcontext.h> references on the kernel side
Now that all type definitions are in the UAPI header, include it
directly, instead of through <asm/sigcontext.h>.
[ We still keep asm/sigcontext.h, so that uapi/asm/sigcontext32.h
can include <asm/sigcontext.h>. ]
Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi>
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: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/1441438363-9999-16-git-send-email-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/ia32/ia32_signal.c | 2 +-
arch/x86/include/asm/fpu/signal.h | 2 +-
arch/x86/include/asm/ia32.h | 2 +-
arch/x86/include/asm/processor.h | 2 +-
arch/x86/include/asm/sigcontext.h | 2 ++
arch/x86/include/asm/sigframe.h | 2 +-
arch/x86/include/asm/signal.h | 2 +-
arch/x86/math-emu/fpu_emu.h | 2 +-
8 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index 955ca03..5959042 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -26,7 +26,7 @@
#include <asm/ptrace.h>
#include <asm/ia32_unistd.h>
#include <asm/user32.h>
-#include <asm/sigcontext.h>
+#include <uapi/asm/sigcontext.h>
#include <asm/proto.h>
#include <asm/vdso.h>
#include <asm/sigframe.h>
diff --git a/arch/x86/include/asm/fpu/signal.h b/arch/x86/include/asm/fpu/signal.h
index 856f4b3c..0e970d0 100644
--- a/arch/x86/include/asm/fpu/signal.h
+++ b/arch/x86/include/asm/fpu/signal.h
@@ -5,7 +5,7 @@
#define _ASM_X86_FPU_SIGNAL_H
#ifdef CONFIG_X86_64
-# include <asm/sigcontext.h>
+# include <uapi/asm/sigcontext.h>
# include <asm/user32.h>
struct ksignal;
int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h
index 16edda2..a9bdf55 100644
--- a/arch/x86/include/asm/ia32.h
+++ b/arch/x86/include/asm/ia32.h
@@ -10,7 +10,7 @@
* 32 bit structures for IA32 support.
*/
-#include <asm/sigcontext.h>
+#include <uapi/asm/sigcontext.h>
/* signal.h */
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 19577dd..bb911e7 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -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>
diff --git a/arch/x86/include/asm/sigcontext.h b/arch/x86/include/asm/sigcontext.h
index 25815f0..e6cd2c4 100644
--- a/arch/x86/include/asm/sigcontext.h
+++ b/arch/x86/include/asm/sigcontext.h
@@ -1,6 +1,8 @@
#ifndef _ASM_X86_SIGCONTEXT_H
#define _ASM_X86_SIGCONTEXT_H
+/* This is a legacy header - all kernel code includes <uapi/asm/sigcontext.h> directly. */
+
#include <uapi/asm/sigcontext.h>
#endif /* _ASM_X86_SIGCONTEXT_H */
diff --git a/arch/x86/include/asm/sigframe.h b/arch/x86/include/asm/sigframe.h
index 867a757..34edd16 100644
--- a/arch/x86/include/asm/sigframe.h
+++ b/arch/x86/include/asm/sigframe.h
@@ -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>
diff --git a/arch/x86/include/asm/signal.h b/arch/x86/include/asm/signal.h
index c481be7..2138c9a 100644
--- a/arch/x86/include/asm/signal.h
+++ b/arch/x86/include/asm/signal.h
@@ -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__
diff --git a/arch/x86/math-emu/fpu_emu.h b/arch/x86/math-emu/fpu_emu.h
index 4dae511..afbc4d8 100644
--- a/arch/x86/math-emu/fpu_emu.h
+++ b/arch/x86/math-emu/fpu_emu.h
@@ -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>
^ permalink raw reply related [flat|nested] 41+ messages in thread
* Re: [tip:x86/headers] x86/headers: Remove <asm/sigcontext.h> references on the kernel side
2015-09-08 14:29 ` [tip:x86/headers] x86/headers: Remove <asm/sigcontext.h> references on the kernel side tip-bot for Ingo Molnar
@ 2015-09-08 20:17 ` Mikko Rapeli
0 siblings, 0 replies; 41+ messages in thread
From: Mikko Rapeli @ 2015-09-08 20:17 UTC (permalink / raw)
To: tglx, peterz, mingo, bp, dvlasenk, torvalds, linux-kernel,
brgerst, oleg, hpa, luto
Cc: linux-tip-commits
Hi,
Tested these changes on top of my uapi headers fix branch and
they compile without problems in userspace and thus fix the original issue.
Also abi-compliance-checker reports that these changes don't break anything
in i386 ABI (details at [2]):
"Test Info
Library Name kernel
Version #1 headers_test_v04
Version #2 headers_test_v04+test_ingo_x86_cleanup
CPU Type x86
GCC Version 5.2.1
Subject Binary Compatibility
Test Results
Total Header Files 767
Total Shared Libraries 0 (not analyzed)
Total Symbols / Types 62 / 67
Verdict Compatible"
or API:
"Test Info
Library Name kernel
Version #1 headers_test_v04
Version #2 headers_test_v04+test_ingo_x86_cleanup
CPU Type x86
GCC Version 5.2.1
Subject Source Compatibility
Test Results
Total Header Files 767
Total Shared Libraries 0 (not analyzed)
Total Symbols / Types 96 / 101
Verdict Compatible"
While abi-compliance-checker is still quite broken with kernel header files[3]
addition of new constants was correctly detected:
"Other Changes in Constants (3)
sigcontext.h
[−] _fpstate
Change Effect
1 The constant _fpstate with value _fpstate_32 has been added. No effect.
[−] _fpstate_ia32
Change Effect
1 The constant _fpstate_ia32 with value _fpstate_32 has been added. No effect.
[−] sigcontext_ia32
Change Effect
1 The constant sigcontext_ia32 with value sigcontext_32 has been added. No effect."
So for 32 bit userspace side
Tested-by: Mikko Rapeli <mikko.rapeli@iki.fi>
-Mikko
[1] http://lvc.github.io/abi-compliance-checker/
[2] API/ABI check results
https://mcfrisk.kapsi.fi/temp/headers_test_v04_to_headers_test_v04+test_ingo_x86_cleanup/
[3] abi checker still has some issues with kernel headers:
https://mcfrisk.kapsi.fi/temp/headers_test_v04+test_ingo_x86_cleanup/log.txt
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [tip:x86/headers] x86/headers: Clean up and better document uapi/ asm/sigcontext.h
2015-09-08 14:25 ` [tip:x86/headers] x86/headers: Clean up and better document uapi/ asm/sigcontext.h tip-bot for Ingo Molnar
@ 2015-09-09 7:12 ` Peter Zijlstra
2015-09-14 9:12 ` [tip:x86/headers] x86/headers: Clean up too long lines tip-bot for Peter Zijlstra
0 siblings, 1 reply; 41+ messages in thread
From: Peter Zijlstra @ 2015-09-09 7:12 UTC (permalink / raw)
To: mikko.rapeli, dvlasenk, linux-kernel, torvalds, tglx, luto,
mingo, oleg, bp, brgerst, hpa
Cc: linux-tip-commits
On Tue, Sep 08, 2015 at 07:25:35AM -0700, tip-bot for Ingo Molnar wrote:
> +++ b/arch/x86/include/uapi/asm/sigcontext.h
> @@ -1,221 +1,255 @@
> #ifndef _UAPI_ASM_X86_SIGCONTEXT_H
> #define _UAPI_ASM_X86_SIGCONTEXT_H
>
> +/*
> + * Linux signal context definitions. The sigcontext includes a complex hierarchy of CPU
> + * and FPU state, available to user-space (on the stack) when a signal handler is
> + * executed.
> + *
> + * As over the years this ABI grew from its very simple roots towards supporting more and
> + * more CPU state organically, some of the details (which were rather clever hacks back
> + * in the days) became a bit quirky by today.
> + *
> + * The current ABI includes flexible provisions for future extensions, so we won't have
> + * to grow new quirks for quite some time. Promise!
> + */
I don't mind the occasional long line, but this seems gratuitous.
---
arch/x86/include/uapi/asm/sigcontext.h | 57 ++++++++++++++++++----------------
1 file changed, 31 insertions(+), 26 deletions(-)
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index 4411e6a8f8e7..d485232f1e9f 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -2,16 +2,16 @@
#define _UAPI_ASM_X86_SIGCONTEXT_H
/*
- * Linux signal context definitions. The sigcontext includes a complex hierarchy of CPU
- * and FPU state, available to user-space (on the stack) when a signal handler is
- * executed.
+ * Linux signal context definitions. The sigcontext includes a complex
+ * hierarchy of CPU and FPU state, available to user-space (on the stack) when
+ * a signal handler is executed.
*
- * As over the years this ABI grew from its very simple roots towards supporting more and
- * more CPU state organically, some of the details (which were rather clever hacks back
- * in the days) became a bit quirky by today.
+ * As over the years this ABI grew from its very simple roots towards
+ * supporting more and more CPU state organically, some of the details (which
+ * were rather clever hacks back in the days) became a bit quirky by today.
*
- * The current ABI includes flexible provisions for future extensions, so we won't have
- * to grow new quirks for quite some time. Promise!
+ * The current ABI includes flexible provisions for future extensions, so we
+ * won't have to grow new quirks for quite some time. Promise!
*/
#include <linux/compiler.h>
@@ -23,27 +23,32 @@
/*
* Bytes 464..511 in the current 512-byte layout of the FXSAVE/FXRSTOR frame
- * are reserved for SW usage. On CPUs supporting XSAVE/XRSTOR, these bytes
- * are used to extend the fpstate pointer in the sigcontext, which now
- * includes the extended state information along with fpstate information.
+ * are reserved for SW usage. On CPUs supporting XSAVE/XRSTOR, these bytes are
+ * used to extend the fpstate pointer in the sigcontext, which now includes the
+ * extended state information along with fpstate information.
*
- * If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then there's a sw_reserved.extended_size
- * bytes large extended context area present. (The last 32-bit word of this extended
- * area (at the fpstate+extended_size-FP_XSTATE_MAGIC2_SIZE address) is set to
+ * If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then there's a
+ * sw_reserved.extended_size bytes large extended context area present. (The
+ * last 32-bit word of this extended area (at the
+ * fpstate+extended_size-FP_XSTATE_MAGIC2_SIZE address) is set to
* FP_XSTATE_MAGIC2 so that you can sanity check your size calculations.)
*
- * This extended area typically grows with newer CPUs that have larger and larger
- * XSAVE areas.
+ * This extended area typically grows with newer CPUs that have larger and
+ * larger XSAVE areas.
*/
struct _fpx_sw_bytes {
- /* If set to FP_XSTATE_MAGIC1 then this is an xstate context. 0 if a legacy frame. */
+ /*
+ * If set to FP_XSTATE_MAGIC1 then this is an xstate context.
+ * 0 if a legacy frame.
+ */
__u32 magic1;
/*
* Total size of the fpstate area:
*
* - if magic1 == 0 then it's sizeof(struct _fpstate)
- * - if magic1 == FP_XSTATE_MAGIC1 then it's sizeof(struct _xstate) plus extensions (if any)
+ * - if magic1 == FP_XSTATE_MAGIC1 then it's sizeof(struct _xstate)
+ * plus extensions (if any)
*/
__u32 extended_size;
@@ -66,13 +71,13 @@ struct _fpx_sw_bytes {
/*
* As documented in the iBCS2 standard:
*
- * The first part of "struct _fpstate" is just the normal i387
- * hardware setup, the extra "status" word is used to save the
- * coprocessor status word before entering the handler.
+ * The first part of "struct _fpstate" is just the normal i387 hardware setup,
+ * the extra "status" word is used to save the coprocessor status word before
+ * entering the handler.
*
- * The FPU state data structure has had to grow to accommodate the
- * extended FPU state required by the Streaming SIMD Extensions.
- * There is no documented standard to accomplish this at the moment.
+ * The FPU state data structure has had to grow to accommodate the extended FPU
+ * state required by the Streaming SIMD Extensions. There is no documented
+ * standard to accomplish this at the moment.
*/
/* 10-byte legacy floating point register: */
@@ -137,8 +142,8 @@ struct _fpstate_32 {
* 'struct _fpstate' so that you can always assume the _fpstate portion
* exists so that you can check the magic value.
*
- * Note2: Reserved fields may someday contain valuable data. Always save/restore
- * them when you change signal frames.
+ * Note2: Reserved fields may someday contain valuable data. Always
+ * save/restore them when you change signal frames.
*/
struct _fpstate_64 {
__u16 cwd;
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [tip:x86/headers] x86/headers: Clean up too long lines
2015-09-09 7:12 ` Peter Zijlstra
@ 2015-09-14 9:12 ` tip-bot for Peter Zijlstra
0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Peter Zijlstra @ 2015-09-14 9:12 UTC (permalink / raw)
To: linux-tip-commits; +Cc: peterz, torvalds, linux-kernel, mingo, hpa, tglx
Commit-ID: 0e2815de552a638295cfdaf0865e575573bf263e
Gitweb: http://git.kernel.org/tip/0e2815de552a638295cfdaf0865e575573bf263e
Author: Peter Zijlstra <peterz@infradead.org>
AuthorDate: Wed, 9 Sep 2015 09:12:44 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 14 Sep 2015 11:09:33 +0200
x86/headers: Clean up too long lines
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: bp@alien8.de
Cc: brgerst@gmail.com
Cc: dvlasenk@redhat.com
Cc: luto@amacapital.net
Cc: mikko.rapeli@iki.fi
Cc: oleg@redhat.com
Link: http://lkml.kernel.org/r/20150909071244.GM3644@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/uapi/asm/sigcontext.h | 57 ++++++++++++++++++----------------
1 file changed, 31 insertions(+), 26 deletions(-)
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index 4411e6a..d485232 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -2,16 +2,16 @@
#define _UAPI_ASM_X86_SIGCONTEXT_H
/*
- * Linux signal context definitions. The sigcontext includes a complex hierarchy of CPU
- * and FPU state, available to user-space (on the stack) when a signal handler is
- * executed.
+ * Linux signal context definitions. The sigcontext includes a complex
+ * hierarchy of CPU and FPU state, available to user-space (on the stack) when
+ * a signal handler is executed.
*
- * As over the years this ABI grew from its very simple roots towards supporting more and
- * more CPU state organically, some of the details (which were rather clever hacks back
- * in the days) became a bit quirky by today.
+ * As over the years this ABI grew from its very simple roots towards
+ * supporting more and more CPU state organically, some of the details (which
+ * were rather clever hacks back in the days) became a bit quirky by today.
*
- * The current ABI includes flexible provisions for future extensions, so we won't have
- * to grow new quirks for quite some time. Promise!
+ * The current ABI includes flexible provisions for future extensions, so we
+ * won't have to grow new quirks for quite some time. Promise!
*/
#include <linux/compiler.h>
@@ -23,27 +23,32 @@
/*
* Bytes 464..511 in the current 512-byte layout of the FXSAVE/FXRSTOR frame
- * are reserved for SW usage. On CPUs supporting XSAVE/XRSTOR, these bytes
- * are used to extend the fpstate pointer in the sigcontext, which now
- * includes the extended state information along with fpstate information.
+ * are reserved for SW usage. On CPUs supporting XSAVE/XRSTOR, these bytes are
+ * used to extend the fpstate pointer in the sigcontext, which now includes the
+ * extended state information along with fpstate information.
*
- * If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then there's a sw_reserved.extended_size
- * bytes large extended context area present. (The last 32-bit word of this extended
- * area (at the fpstate+extended_size-FP_XSTATE_MAGIC2_SIZE address) is set to
+ * If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then there's a
+ * sw_reserved.extended_size bytes large extended context area present. (The
+ * last 32-bit word of this extended area (at the
+ * fpstate+extended_size-FP_XSTATE_MAGIC2_SIZE address) is set to
* FP_XSTATE_MAGIC2 so that you can sanity check your size calculations.)
*
- * This extended area typically grows with newer CPUs that have larger and larger
- * XSAVE areas.
+ * This extended area typically grows with newer CPUs that have larger and
+ * larger XSAVE areas.
*/
struct _fpx_sw_bytes {
- /* If set to FP_XSTATE_MAGIC1 then this is an xstate context. 0 if a legacy frame. */
+ /*
+ * If set to FP_XSTATE_MAGIC1 then this is an xstate context.
+ * 0 if a legacy frame.
+ */
__u32 magic1;
/*
* Total size of the fpstate area:
*
* - if magic1 == 0 then it's sizeof(struct _fpstate)
- * - if magic1 == FP_XSTATE_MAGIC1 then it's sizeof(struct _xstate) plus extensions (if any)
+ * - if magic1 == FP_XSTATE_MAGIC1 then it's sizeof(struct _xstate)
+ * plus extensions (if any)
*/
__u32 extended_size;
@@ -66,13 +71,13 @@ struct _fpx_sw_bytes {
/*
* As documented in the iBCS2 standard:
*
- * The first part of "struct _fpstate" is just the normal i387
- * hardware setup, the extra "status" word is used to save the
- * coprocessor status word before entering the handler.
+ * The first part of "struct _fpstate" is just the normal i387 hardware setup,
+ * the extra "status" word is used to save the coprocessor status word before
+ * entering the handler.
*
- * The FPU state data structure has had to grow to accommodate the
- * extended FPU state required by the Streaming SIMD Extensions.
- * There is no documented standard to accomplish this at the moment.
+ * The FPU state data structure has had to grow to accommodate the extended FPU
+ * state required by the Streaming SIMD Extensions. There is no documented
+ * standard to accomplish this at the moment.
*/
/* 10-byte legacy floating point register: */
@@ -137,8 +142,8 @@ struct _fpstate_32 {
* 'struct _fpstate' so that you can always assume the _fpstate portion
* exists so that you can check the magic value.
*
- * Note2: Reserved fields may someday contain valuable data. Always save/restore
- * them when you change signal frames.
+ * Note2: Reserved fields may someday contain valuable data. Always
+ * save/restore them when you change signal frames.
*/
struct _fpstate_64 {
__u16 cwd;
^ permalink raw reply related [flat|nested] 41+ messages in thread
end of thread, other threads:[~2015-09-14 9:13 UTC | newest]
Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-05 7:32 [PATCH 00/15] x86/headers: Clean up sigcontext types and headers Ingo Molnar
2015-09-05 7:32 ` [PATCH 01/15] x86/headers: Fix (old) header file dependency bug in uapi/asm/sigcontext32.h Ingo Molnar
2015-09-08 14:24 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 02/15] x86/headers: Clean up uapi/asm/sigcontext32.h Ingo Molnar
2015-09-08 14:25 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 03/15] x86/headers: Clean up and better document uapi/asm/sigcontext.h Ingo Molnar
2015-09-08 14:25 ` [tip:x86/headers] x86/headers: Clean up and better document uapi/ asm/sigcontext.h tip-bot for Ingo Molnar
2015-09-09 7:12 ` Peter Zijlstra
2015-09-14 9:12 ` [tip:x86/headers] x86/headers: Clean up too long lines tip-bot for Peter Zijlstra
2015-09-05 7:32 ` [PATCH 04/15] x86/headers: Separate out legacy user-space structure definitions Ingo Molnar
2015-09-08 14:25 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 05/15] x86/headers: Use ABI types consistently in sigcontext*.h Ingo Molnar
2015-09-08 14:26 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 06/15] x86/headers: Unify register type definitions between 32-bit compat and i386 Ingo Molnar
2015-09-08 14:26 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 07/15] x86/headers: Unify 'struct _fpstate_ia32' and i386 struct _fpstate Ingo Molnar
2015-09-08 14:26 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 08/15] x86/headers: Convert uses of _fpstate_ia32 to _fpstate_32 Ingo Molnar
2015-09-08 14:27 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 09/15] x86/headers: Clean up the kernel's struct sigcontext types to be ABI-clean Ingo Molnar
2015-09-08 14:27 ` [tip:x86/headers] x86/headers: Clean up the kernel' s " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 10/15] x86/headers: Move the 'struct sigcontext' definitions into the UAPI header Ingo Molnar
2015-09-08 14:27 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 11/15] x86/headers: Make sigcontext pointers bit independent Ingo Molnar
2015-09-08 14:28 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 12/15] x86/headers: Unify 'struct sigcontext_ia32' and 'struct sigcontext_32' Ingo Molnar
2015-09-08 14:28 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 13/15] x86/headers: Convert sigcontext_ia32 uses to sigcontext_32 Ingo Molnar
2015-09-08 14:28 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 14/15] x86/headers: Remove direct sigcontext32.h uses Ingo Molnar
2015-09-08 14:29 ` [tip:x86/headers] " tip-bot for Ingo Molnar
2015-09-05 7:32 ` [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> Ingo Molnar
2015-09-05 10:57 ` Mikko Rapeli
2015-09-05 11:59 ` Ingo Molnar
2015-09-05 12:11 ` Mikko Rapeli
2015-09-06 6:41 ` Ingo Molnar
2015-09-06 20:28 ` Mikko Rapeli
2015-09-07 7:37 ` Ingo Molnar
2015-09-07 8:14 ` Mikko Rapeli
2015-09-08 14:29 ` [tip:x86/headers] x86/headers: Remove <asm/sigcontext.h> references on the kernel side tip-bot for Ingo Molnar
2015-09-08 20:17 ` Mikko Rapeli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).