Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1219444 > unrolled thread
| Started by | Ingo Molnar <mingo@kernel.org> |
|---|---|
| First post | 2015-09-05 09:40 +0200 |
| Last post | 2015-09-05 09:40 +0200 |
| Articles | 18 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 00/15] x86/headers: Clean up sigcontext types and headers Ingo Molnar <mingo@kernel.org> - 2015-09-05 09:40 +0200
[PATCH 07/15] x86/headers: Unify 'struct _fpstate_ia32' and i386 struct _fpstate Ingo Molnar <mingo@kernel.org> - 2015-09-05 09:40 +0200
[PATCH 08/15] x86/headers: Convert uses of _fpstate_ia32 to _fpstate_32 Ingo Molnar <mingo@kernel.org> - 2015-09-05 09:40 +0200
[PATCH 06/15] x86/headers: Unify register type definitions between 32-bit compat and i386 Ingo Molnar <mingo@kernel.org> - 2015-09-05 09:40 +0200
[PATCH 12/15] x86/headers: Unify 'struct sigcontext_ia32' and 'struct sigcontext_32' Ingo Molnar <mingo@kernel.org> - 2015-09-05 09:40 +0200
[PATCH 05/15] x86/headers: Use ABI types consistently in sigcontext*.h Ingo Molnar <mingo@kernel.org> - 2015-09-05 09:40 +0200
[PATCH 10/15] x86/headers: Move the 'struct sigcontext' definitions into the UAPI header Ingo Molnar <mingo@kernel.org> - 2015-09-05 09:40 +0200
[PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> Ingo Molnar <mingo@kernel.org> - 2015-09-05 09:40 +0200
Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> Mikko Rapeli <mikko.rapeli@iki.fi> - 2015-09-05 13:00 +0200
Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> Ingo Molnar <mingo@kernel.org> - 2015-09-05 14:10 +0200
Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> Mikko Rapeli <mikko.rapeli@iki.fi> - 2015-09-05 14:20 +0200
Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> Ingo Molnar <mingo@kernel.org> - 2015-09-06 08:50 +0200
Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> Mikko Rapeli <mikko.rapeli@iki.fi> - 2015-09-06 22:30 +0200
Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> Ingo Molnar <mingo@kernel.org> - 2015-09-07 09:40 +0200
Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> Mikko Rapeli <mikko.rapeli@iki.fi> - 2015-09-07 10:20 +0200
[PATCH 04/15] x86/headers: Separate out legacy user-space structure definitions Ingo Molnar <mingo@kernel.org> - 2015-09-05 09:40 +0200
[PATCH 01/15] x86/headers: Fix (old) header file dependency bug in uapi/asm/sigcontext32.h Ingo Molnar <mingo@kernel.org> - 2015-09-05 09:40 +0200
[PATCH 09/15] x86/headers: Clean up the kernel's struct sigcontext types to be ABI-clean Ingo Molnar <mingo@kernel.org> - 2015-09-05 09:40 +0200
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-09-05 09:40 +0200 |
| Subject | [PATCH 00/15] x86/headers: Clean up sigcontext types and headers |
| Message-ID | <q5geR-2go-3@gated-at.bofh.it> |
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-09-05 09:40 +0200 |
| Subject | [PATCH 07/15] x86/headers: Unify 'struct _fpstate_ia32' and i386 struct _fpstate |
| Message-ID | <q5geR-2go-13@gated-at.bofh.it> |
| In reply to | #1219444 |
'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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-09-05 09:40 +0200 |
| Subject | [PATCH 08/15] x86/headers: Convert uses of _fpstate_ia32 to _fpstate_32 |
| Message-ID | <q5geS-2go-19@gated-at.bofh.it> |
| In reply to | #1219444 |
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-09-05 09:40 +0200 |
| Subject | [PATCH 06/15] x86/headers: Unify register type definitions between 32-bit compat and i386 |
| Message-ID | <q5geS-2go-23@gated-at.bofh.it> |
| In reply to | #1219444 |
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-09-05 09:40 +0200 |
| Subject | [PATCH 12/15] x86/headers: Unify 'struct sigcontext_ia32' and 'struct sigcontext_32' |
| Message-ID | <q5geS-2go-21@gated-at.bofh.it> |
| In reply to | #1219444 |
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-09-05 09:40 +0200 |
| Subject | [PATCH 05/15] x86/headers: Use ABI types consistently in sigcontext*.h |
| Message-ID | <q5geS-2go-29@gated-at.bofh.it> |
| In reply to | #1219444 |
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-09-05 09:40 +0200 |
| Subject | [PATCH 10/15] x86/headers: Move the 'struct sigcontext' definitions into the UAPI header |
| Message-ID | <q5geS-2go-31@gated-at.bofh.it> |
| In reply to | #1219444 |
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-09-05 09:40 +0200 |
| Subject | [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> |
| Message-ID | <q5geS-2go-35@gated-at.bofh.it> |
| In reply to | #1219444 |
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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Mikko Rapeli <mikko.rapeli@iki.fi> |
|---|---|
| Date | 2015-09-05 13:00 +0200 |
| Subject | Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> |
| Message-ID | <q5jmq-6Gh-7@gated-at.bofh.it> |
| In reply to | #1219451 |
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 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-09-05 14:10 +0200 |
| Subject | Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> |
| Message-ID | <q5ksa-8rE-15@gated-at.bofh.it> |
| In reply to | #1219515 |
* 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Mikko Rapeli <mikko.rapeli@iki.fi> |
|---|---|
| Date | 2015-09-05 14:20 +0200 |
| Subject | Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> |
| Message-ID | <q5kBQ-bb-11@gated-at.bofh.it> |
| In reply to | #1219519 |
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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-09-06 08:50 +0200 |
| Subject | Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> |
| Message-ID | <q5BW1-7SJ-1@gated-at.bofh.it> |
| In reply to | #1219521 |
* 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Mikko Rapeli <mikko.rapeli@iki.fi> |
|---|---|
| Date | 2015-09-06 22:30 +0200 |
| Subject | Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> |
| Message-ID | <q5OJz-Ua-5@gated-at.bofh.it> |
| In reply to | #1219736 |
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-09-07 09:40 +0200 |
| Subject | Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> |
| Message-ID | <q5ZbY-7oS-15@gated-at.bofh.it> |
| In reply to | #1219856 |
* 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Mikko Rapeli <mikko.rapeli@iki.fi> |
|---|---|
| Date | 2015-09-07 10:20 +0200 |
| Subject | Re: [PATCH 15/15] x86/headers: Remove <asm/sigcontext.h> |
| Message-ID | <q5ZOF-8nj-7@gated-at.bofh.it> |
| In reply to | #1219967 |
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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-09-05 09:40 +0200 |
| Subject | [PATCH 04/15] x86/headers: Separate out legacy user-space structure definitions |
| Message-ID | <q5geT-2go-39@gated-at.bofh.it> |
| In reply to | #1219444 |
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-09-05 09:40 +0200 |
| Subject | [PATCH 01/15] x86/headers: Fix (old) header file dependency bug in uapi/asm/sigcontext32.h |
| Message-ID | <q5geS-2go-27@gated-at.bofh.it> |
| In reply to | #1219444 |
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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-09-05 09:40 +0200 |
| Subject | [PATCH 09/15] x86/headers: Clean up the kernel's struct sigcontext types to be ABI-clean |
| Message-ID | <q5geT-2go-37@gated-at.bofh.it> |
| In reply to | #1219444 |
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web