linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/30] RFC: x32 support
@ 2012-02-20  0:07 H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 01/30] x86: Factor out TIF_IA32 from 32-bit address space H. Peter Anvin
                   ` (36 more replies)
  0 siblings, 37 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

This is an initial RFC patchset for x32 support.  This is largely
complete and should be able to boot an x32 userspace.

The patch authors are assigned to myself and H. J. in a somewhat
haphazard fashion; the kernel side of x32 was very much a
collaborative effort, although H. J. ended up doing most of the latter
coding due to my being occupied with kernel.org in late 2011.

This patchset applies on top of tip:core/types which in turn is based
on v3.3-rc3; there may be some trivially resolved conflicts with -rc4.
I am planning to push this out as tip:x86/x32 after the RFC.

Controversial issue in this patchset:

There are a lot of ABIs that expose "long" or "unsigned long"; the
traditional way to deal with that is compat, but we don't want to use
that in most cases for x32.  As a result, I have introduced
__kernel_[u]long_t as an additional type in posix_types.h.

This type largely duplicates __kernel_[s]size_t, but the latter is
defined as [unsigned] int on a lot of platforms, so changing types
over to __kernel_[s]size_t would have changed the type, if not the
size, on a lot of platforms.  I have personally no strong opinion on
which way is preferrable.

The use of a flag to signal x32 rather than using a completely new set
of system call numbers.  This was discussed back in August.

Incompleteness:

There are a number of (especially) ioctl paths which don't yet handle
a 64-bit time_t in the compat path.  This is necessary because of
Linus' (quite correct) dictat that new ABIs should use a 64-bit
time_t, but this also means this is the first 32-bit ABI with a 64-bit
time_t, and some problems are expected to crop up.

The header-exported ABI is not correct everywhere yet.


The total diffstat is attached.

 arch/x86/Kconfig                       |   21 +-
 arch/x86/ia32/ia32_signal.c            |   12 +-
 arch/x86/ia32/sys_ia32.c               |   40 ---
 arch/x86/include/asm/Kbuild            |    2 +
 arch/x86/include/asm/compat.h          |   39 ++-
 arch/x86/include/asm/elf.h             |   29 ++-
 arch/x86/include/asm/ia32.h            |    9 +
 arch/x86/include/asm/posix_types.h     |    4 +-
 arch/x86/include/asm/posix_types_x32.h |   19 +
 arch/x86/include/asm/processor.h       |   10 +-
 arch/x86/include/asm/ptrace.h          |    1 -
 arch/x86/include/asm/sigcontext.h      |   57 ++--
 arch/x86/include/asm/sigframe.h        |   13 +
 arch/x86/include/asm/sighandling.h     |   24 ++
 arch/x86/include/asm/sys_ia32.h        |    7 +-
 arch/x86/include/asm/syscall.h         |    5 +-
 arch/x86/include/asm/thread_info.h     |    6 +-
 arch/x86/include/asm/unistd.h          |   15 +-
 arch/x86/kernel/asm-offsets_64.c       |    6 +
 arch/x86/kernel/cpu/perf_event.c       |    4 +-
 arch/x86/kernel/entry_64.S             |   44 +++
 arch/x86/kernel/process_64.c           |   25 +-
 arch/x86/kernel/signal.c               |  138 +++++++-
 arch/x86/kernel/sys_x86_64.c           |    6 +-
 arch/x86/kernel/syscall_64.c           |    8 +
 arch/x86/oprofile/backtrace.c          |    2 +-
 arch/x86/syscalls/Makefile             |   19 +-
 arch/x86/syscalls/syscall_32.tbl       |    2 +-
 arch/x86/syscalls/syscall_64.tbl       |  579 +++++++++++++++++---------------
 arch/x86/um/sys_call_table_64.c        |    3 +
 arch/x86/um/user-offsets.c             |    2 +
 arch/x86/vdso/.gitignore               |    2 +
 arch/x86/vdso/Makefile                 |   46 +++-
 arch/x86/vdso/vdso32-setup.c           |    6 +
 arch/x86/vdso/vdsox32.S                |   22 ++
 arch/x86/vdso/vdsox32.lds.S            |   32 ++
 arch/x86/vdso/vma.c                    |   78 ++++-
 drivers/char/lp.c                      |   20 +-
 drivers/input/input-compat.c           |    4 +-
 drivers/input/input-compat.h           |    2 +-
 fs/binfmt_elf.c                        |   24 ++-
 fs/compat.c                            |   26 ++-
 include/asm-generic/posix_types.h      |   23 +-
 include/linux/Kbuild                   |    1 +
 include/linux/aio_abi.h                |    2 +-
 include/linux/compat.h                 |    4 +
 include/linux/kernel.h                 |   21 +-
 include/linux/sysinfo.h                |   24 ++
 net/bluetooth/hci_sock.c               |    3 +-
 49 files changed, 1027 insertions(+), 464 deletions(-)
 
It is probably worth noting that this work directly spawned the
x86/syscall and core/types cleanups:

 33 files changed, 1075 insertions(+), 1978 deletions(-)
 22 files changed, 190 insertions(+), 1588 deletions(-)

^ permalink raw reply	[flat|nested] 106+ messages in thread

* [PATCH 01/30] x86: Factor out TIF_IA32 from 32-bit address space
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 02/30] x86-64: Use explicit sizes in sigcontext.h, prepare for x32 H. Peter Anvin
                   ` (35 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. Peter Anvin" <hpa@zytor.com>

Factor out IA32 (compatibility instruction set) from 32-bit address
space in the thread_info flags; this is a precondition patch for x32
support.

Originally-by: H. J. Lu <hjl.tools@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Link: http://lkml.kernel.org/n/tip-4pr1xnnksprt7t0h3w5fw4rv@git.kernel.org
---
 arch/x86/include/asm/elf.h         |    4 ++--
 arch/x86/include/asm/processor.h   |    4 ++--
 arch/x86/include/asm/thread_info.h |    4 +++-
 arch/x86/kernel/process_64.c       |    2 ++
 arch/x86/kernel/sys_x86_64.c       |    6 +++---
 arch/x86/oprofile/backtrace.c      |    2 +-
 6 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index 5f962df..410fa6a 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -287,7 +287,7 @@ do {									\
 #define VDSO_HIGH_BASE		0xffffe000U /* CONFIG_COMPAT_VDSO address */
 
 /* 1GB for 64bit, 8MB for 32bit */
-#define STACK_RND_MASK (test_thread_flag(TIF_IA32) ? 0x7ff : 0x3fffff)
+#define STACK_RND_MASK (test_thread_flag(TIF_ADDR32) ? 0x7ff : 0x3fffff)
 
 #define ARCH_DLINFO							\
 do {									\
@@ -330,7 +330,7 @@ static inline int mmap_is_ia32(void)
 	return 1;
 #endif
 #ifdef CONFIG_IA32_EMULATION
-	if (test_thread_flag(TIF_IA32))
+	if (test_thread_flag(TIF_ADDR32))
 		return 1;
 #endif
 	return 0;
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index aa9088c..9f748b5 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -924,9 +924,9 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
 #define IA32_PAGE_OFFSET	((current->personality & ADDR_LIMIT_3GB) ? \
 					0xc0000000 : 0xFFFFe000)
 
-#define TASK_SIZE		(test_thread_flag(TIF_IA32) ? \
+#define TASK_SIZE		(test_thread_flag(TIF_ADDR32) ? \
 					IA32_PAGE_OFFSET : TASK_SIZE_MAX)
-#define TASK_SIZE_OF(child)	((test_tsk_thread_flag(child, TIF_IA32)) ? \
+#define TASK_SIZE_OF(child)	((test_tsk_thread_flag(child, TIF_ADDR32)) ? \
 					IA32_PAGE_OFFSET : TASK_SIZE_MAX)
 
 #define STACK_TOP		TASK_SIZE
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index bc817cd..d1803a4 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -86,7 +86,7 @@ struct thread_info {
 #define TIF_MCE_NOTIFY		10	/* notify userspace of an MCE */
 #define TIF_USER_RETURN_NOTIFY	11	/* notify kernel of userspace return */
 #define TIF_NOTSC		16	/* TSC is not accessible in userland */
-#define TIF_IA32		17	/* 32bit process */
+#define TIF_IA32		17	/* IA32 compatibility process */
 #define TIF_FORK		18	/* ret_from_fork */
 #define TIF_MEMDIE		20	/* is terminating due to OOM killer */
 #define TIF_DEBUG		21	/* uses debug registers */
@@ -95,6 +95,7 @@ struct thread_info {
 #define TIF_BLOCKSTEP		25	/* set when we want DEBUGCTLMSR_BTF */
 #define TIF_LAZY_MMU_UPDATES	27	/* task is updating the mmu lazily */
 #define TIF_SYSCALL_TRACEPOINT	28	/* syscall tracepoint instrumentation */
+#define TIF_ADDR32		29	/* 32-bit address space on 64 bits */
 
 #define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
 #define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
@@ -116,6 +117,7 @@ struct thread_info {
 #define _TIF_BLOCKSTEP		(1 << TIF_BLOCKSTEP)
 #define _TIF_LAZY_MMU_UPDATES	(1 << TIF_LAZY_MMU_UPDATES)
 #define _TIF_SYSCALL_TRACEPOINT	(1 << TIF_SYSCALL_TRACEPOINT)
+#define _TIF_ADDR32		(1 << TIF_ADDR32)
 
 /* work to do in syscall_trace_enter() */
 #define _TIF_WORK_SYSCALL_ENTRY	\
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 9b9fe4a..0e900d0 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -508,6 +508,7 @@ void set_personality_64bit(void)
 
 	/* Make sure to be in 64bit mode */
 	clear_thread_flag(TIF_IA32);
+	clear_thread_flag(TIF_ADDR32);
 
 	/* Ensure the corresponding mm is not marked. */
 	if (current->mm)
@@ -526,6 +527,7 @@ void set_personality_ia32(void)
 
 	/* Make sure to be in 32bit mode */
 	set_thread_flag(TIF_IA32);
+	set_thread_flag(TIF_ADDR32);
 	current->personality |= force_personality32;
 
 	/* Mark the associated mm as containing 32-bit tasks. */
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
index 0514890..f921df8 100644
--- a/arch/x86/kernel/sys_x86_64.c
+++ b/arch/x86/kernel/sys_x86_64.c
@@ -98,7 +98,7 @@ out:
 static void find_start_end(unsigned long flags, unsigned long *begin,
 			   unsigned long *end)
 {
-	if (!test_thread_flag(TIF_IA32) && (flags & MAP_32BIT)) {
+	if (!test_thread_flag(TIF_ADDR32) && (flags & MAP_32BIT)) {
 		unsigned long new_begin;
 		/* This is usually used needed to map code in small
 		   model, so it needs to be in the first 31bit. Limit
@@ -144,7 +144,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
 		    (!vma || addr + len <= vma->vm_start))
 			return addr;
 	}
-	if (((flags & MAP_32BIT) || test_thread_flag(TIF_IA32))
+	if (((flags & MAP_32BIT) || test_thread_flag(TIF_ADDR32))
 	    && len <= mm->cached_hole_size) {
 		mm->cached_hole_size = 0;
 		mm->free_area_cache = begin;
@@ -205,7 +205,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
 		return addr;
 
 	/* for MAP_32BIT mappings we force the legact mmap base */
-	if (!test_thread_flag(TIF_IA32) && (flags & MAP_32BIT))
+	if (!test_thread_flag(TIF_ADDR32) && (flags & MAP_32BIT))
 		goto bottomup;
 
 	/* requesting a specific address */
diff --git a/arch/x86/oprofile/backtrace.c b/arch/x86/oprofile/backtrace.c
index bff89df..d6aa6e8 100644
--- a/arch/x86/oprofile/backtrace.c
+++ b/arch/x86/oprofile/backtrace.c
@@ -67,7 +67,7 @@ x86_backtrace_32(struct pt_regs * const regs, unsigned int depth)
 {
 	struct stack_frame_ia32 *head;
 
-	/* User process is 32-bit */
+	/* User process is IA32 */
 	if (!current || !test_thread_flag(TIF_IA32))
 		return 0;
 
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 02/30] x86-64: Use explicit sizes in sigcontext.h, prepare for x32
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 01/30] x86: Factor out TIF_IA32 from 32-bit address space H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20  0:51   ` Linus Torvalds
  2012-02-20  0:07 ` [PATCH 03/30] sysinfo: Move struct sysinfo to a separate header file H. Peter Anvin
                   ` (34 subsequent siblings)
  36 siblings, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. Peter Anvin" <hpa@zytor.com>

Use explicit sizes (__u64) instead of implicit sizes (unsigned long)
in the definition for sigcontext.h; this will allow this structure to
be shared between the x86-64 native ABI and the x32 ABI.

Originally-by: H. J. Lu <hjl.tools@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Link: http://lkml.kernel.org/n/tip-4pr1xnnksprt7t0h3w5fw4rv@git.kernel.org
---
 arch/x86/include/asm/sigcontext.h |   57 +++++++++++++++++++-----------------
 1 files changed, 30 insertions(+), 27 deletions(-)

diff --git a/arch/x86/include/asm/sigcontext.h b/arch/x86/include/asm/sigcontext.h
index 04459d2..4a08538 100644
--- a/arch/x86/include/asm/sigcontext.h
+++ b/arch/x86/include/asm/sigcontext.h
@@ -230,34 +230,37 @@ struct sigcontext {
  * User-space might still rely on the old definition:
  */
 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 rdi;
-	unsigned long rsi;
-	unsigned long rbp;
-	unsigned long rbx;
-	unsigned long rdx;
-	unsigned long rax;
-	unsigned long rcx;
-	unsigned long rsp;
-	unsigned long rip;
-	unsigned long eflags;		/* RFLAGS */
-	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 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 */
-	unsigned long reserved1[8];
+#ifndef __LP64__
+	__u32 __fpstate_pad;
+#endif
+	__u64 reserved1[8];
 };
 #endif /* !__KERNEL__ */
 
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 03/30] sysinfo: Move struct sysinfo to a separate header file
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 01/30] x86: Factor out TIF_IA32 from 32-bit address space H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 02/30] x86-64: Use explicit sizes in sigcontext.h, prepare for x32 H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 04/30] posix_types: Introduce __kernel_[u]long_t H. Peter Anvin
                   ` (33 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. Peter Anvin" <hpa@zytor.com>

struct sysinfo is just about the only thing exported to userspace from
<linux/kernel.h>, so move it into a separate header file with a
residual #include in <linux/kernel.h>.

Originally-by: H. J. Lu <hjl.tools@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Link: http://lkml.kernel.org/n/tip-4pr1xnnksprt7t0h3w5fw4rv@git.kernel.org
---
 include/linux/Kbuild    |    1 +
 include/linux/kernel.h  |   21 ++-------------------
 include/linux/sysinfo.h |   22 ++++++++++++++++++++++
 3 files changed, 25 insertions(+), 19 deletions(-)
 create mode 100644 include/linux/sysinfo.h

diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index c94e717..8446086 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -355,6 +355,7 @@ header-y += suspend_ioctls.h
 header-y += swab.h
 header-y += synclink.h
 header-y += sysctl.h
+header-y += sysinfo.h
 header-y += taskstats.h
 header-y += tcp.h
 header-y += telephony.h
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e834342..dc6a50f 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -1,6 +1,8 @@
 #ifndef _LINUX_KERNEL_H
 #define _LINUX_KERNEL_H
 
+#include <linux/sysinfo.h>
+
 /*
  * 'kernel.h' contains some often-used function prototypes etc
  */
@@ -745,27 +747,8 @@ extern int __build_bug_on_failed;
 # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
 #endif
 
-struct sysinfo;
 extern int do_sysinfo(struct sysinfo *info);
 
 #endif /* __KERNEL__ */
 
-#define SI_LOAD_SHIFT	16
-struct sysinfo {
-	long uptime;			/* Seconds since boot */
-	unsigned long loads[3];		/* 1, 5, and 15 minute load averages */
-	unsigned long totalram;		/* Total usable main memory size */
-	unsigned long freeram;		/* Available memory size */
-	unsigned long sharedram;	/* Amount of shared memory */
-	unsigned long bufferram;	/* Memory used by buffers */
-	unsigned long totalswap;	/* Total swap space size */
-	unsigned long freeswap;		/* swap space still available */
-	unsigned short procs;		/* Number of current processes */
-	unsigned short pad;		/* explicit padding for m68k */
-	unsigned long totalhigh;	/* Total high memory size */
-	unsigned long freehigh;		/* Available high memory size */
-	unsigned int mem_unit;		/* Memory unit size in bytes */
-	char _f[20-2*sizeof(long)-sizeof(int)];	/* Padding: libc5 uses this.. */
-};
-
 #endif
diff --git a/include/linux/sysinfo.h b/include/linux/sysinfo.h
new file mode 100644
index 0000000..ec4fc22
--- /dev/null
+++ b/include/linux/sysinfo.h
@@ -0,0 +1,22 @@
+#ifndef _LINUX_SYSINFO_H
+#define _LINUX_SYSINFO_H
+
+#define SI_LOAD_SHIFT	16
+struct sysinfo {
+	long uptime;			/* Seconds since boot */
+	unsigned long loads[3];		/* 1, 5, and 15 minute load averages */
+	unsigned long totalram;		/* Total usable main memory size */
+	unsigned long freeram;		/* Available memory size */
+	unsigned long sharedram;	/* Amount of shared memory */
+	unsigned long bufferram;	/* Memory used by buffers */
+	unsigned long totalswap;	/* Total swap space size */
+	unsigned long freeswap;		/* swap space still available */
+	unsigned short procs;		/* Number of current processes */
+	unsigned short pad;		/* explicit padding for m68k */
+	unsigned long totalhigh;	/* Total high memory size */
+	unsigned long freehigh;		/* Available high memory size */
+	unsigned int mem_unit;		/* Memory unit size in bytes */
+	char _f[20-2*sizeof(long)-sizeof(int)];	/* Padding: libc5 uses this.. */
+};
+
+#endif /* _LINUX_SYSINFO_H */
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 04/30] posix_types: Introduce __kernel_[u]long_t
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (2 preceding siblings ...)
  2012-02-20  0:07 ` [PATCH 03/30] sysinfo: Move struct sysinfo to a separate header file H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 05/30] x32: Create posix_types_x32.h H. Peter Anvin
                   ` (32 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. Peter Anvin" <hpa@zytor.com>

Introduce __kernel_[u]long_t, which allows an ABI to override all
defaults of type [unsigned] long.

This enables x32 and potentially other 32-bit userspace on 64-bit
kernel ABIs.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 include/asm-generic/posix_types.h |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/include/asm-generic/posix_types.h b/include/asm-generic/posix_types.h
index e294fe6..91d44bd 100644
--- a/include/asm-generic/posix_types.h
+++ b/include/asm-generic/posix_types.h
@@ -10,8 +10,13 @@
  * architectures, so that you can override them.
  */
 
+#ifndef __kernel_long_t
+typedef long		__kernel_long_t;
+typedef unsigned long	__kernel_ulong_t;
+#endif
+
 #ifndef __kernel_ino_t
-typedef unsigned long	__kernel_ino_t;
+typedef __kernel_ulong_t __kernel_ino_t;
 #endif
 
 #ifndef __kernel_mode_t
@@ -19,7 +24,7 @@ typedef unsigned int	__kernel_mode_t;
 #endif
 
 #ifndef __kernel_nlink_t
-typedef unsigned long	__kernel_nlink_t;
+typedef __kernel_ulong_t __kernel_nlink_t;
 #endif
 
 #ifndef __kernel_pid_t
@@ -36,7 +41,7 @@ typedef unsigned int	__kernel_gid_t;
 #endif
 
 #ifndef __kernel_suseconds_t
-typedef long		__kernel_suseconds_t;
+typedef __kernel_long_t		__kernel_suseconds_t;
 #endif
 
 #ifndef __kernel_daddr_t
@@ -67,9 +72,9 @@ typedef unsigned int	__kernel_size_t;
 typedef int		__kernel_ssize_t;
 typedef int		__kernel_ptrdiff_t;
 #else
-typedef unsigned long	__kernel_size_t;
-typedef long		__kernel_ssize_t;
-typedef long		__kernel_ptrdiff_t;
+typedef __kernel_ulong_t __kernel_size_t;
+typedef __kernel_long_t	__kernel_ssize_t;
+typedef __kernel_long_t	__kernel_ptrdiff_t;
 #endif
 #endif
 
@@ -82,10 +87,10 @@ typedef struct {
 /*
  * anything below here should be completely generic
  */
-typedef long		__kernel_off_t;
+typedef __kernel_long_t	__kernel_off_t;
 typedef long long	__kernel_loff_t;
-typedef long		__kernel_time_t;
-typedef long		__kernel_clock_t;
+typedef __kernel_long_t	__kernel_time_t;
+typedef __kernel_long_t	__kernel_clock_t;
 typedef int		__kernel_timer_t;
 typedef int		__kernel_clockid_t;
 typedef char *		__kernel_caddr_t;
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 05/30] x32: Create posix_types_x32.h
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (3 preceding siblings ...)
  2012-02-20  0:07 ` [PATCH 04/30] posix_types: Introduce __kernel_[u]long_t H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 06/30] sysinfo: Use explicit types in <linux/sysinfo.h> H. Peter Anvin
                   ` (31 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. Peter Anvin" <hpa@zytor.com>

This is the same as the 64-bit posix_types.h, except that
__kernel_[u]long_t is defined to be [unsigned] long long and therefore
64 bits.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/include/asm/Kbuild            |    1 +
 arch/x86/include/asm/posix_types.h     |    4 +++-
 arch/x86/include/asm/posix_types_x32.h |   19 +++++++++++++++++++
 3 files changed, 23 insertions(+), 1 deletions(-)
 create mode 100644 arch/x86/include/asm/posix_types_x32.h

diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild
index b57e6a4..986954f 100644
--- a/arch/x86/include/asm/Kbuild
+++ b/arch/x86/include/asm/Kbuild
@@ -14,6 +14,7 @@ header-y += msr.h
 header-y += mtrr.h
 header-y += posix_types_32.h
 header-y += posix_types_64.h
+header-y += posix_types_x32.h
 header-y += prctl.h
 header-y += processor-flags.h
 header-y += ptrace-abi.h
diff --git a/arch/x86/include/asm/posix_types.h b/arch/x86/include/asm/posix_types.h
index bb7133d..3427b77 100644
--- a/arch/x86/include/asm/posix_types.h
+++ b/arch/x86/include/asm/posix_types.h
@@ -7,7 +7,9 @@
 #else
 # ifdef __i386__
 #  include "posix_types_32.h"
-# else
+# elif defined(__LP64__)
 #  include "posix_types_64.h"
+# else
+#  include "posix_types_x32.h"
 # endif
 #endif
diff --git a/arch/x86/include/asm/posix_types_x32.h b/arch/x86/include/asm/posix_types_x32.h
new file mode 100644
index 0000000..85f9bda
--- /dev/null
+++ b/arch/x86/include/asm/posix_types_x32.h
@@ -0,0 +1,19 @@
+#ifndef _ASM_X86_POSIX_TYPES_X32_H
+#define _ASM_X86_POSIX_TYPES_X32_H
+
+/*
+ * This file is only used by user-level software, so you need to
+ * be a little careful about namespace pollution etc.  Also, we cannot
+ * assume GCC is being used.
+ *
+ * These types should generally match the ones used by the 64-bit kernel,
+ *
+ */
+
+typedef long long __kernel_long_t;
+typedef unsigned long long __kernel_ulong_t;
+#define __kernel_long_t __kernel_long_t
+
+#include <asm/posix_types_64.h>
+
+#endif /* _ASM_X86_POSIX_TYPES_X32_H */
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 06/30] sysinfo: Use explicit types in <linux/sysinfo.h>
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (4 preceding siblings ...)
  2012-02-20  0:07 ` [PATCH 05/30] x32: Create posix_types_x32.h H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20 12:12   ` Geert Uytterhoeven
  2012-02-20  0:07 ` [PATCH 07/30] compat: Introduce COMPAT_USE_64BIT_TIME H. Peter Anvin
                   ` (30 subsequent siblings)
  36 siblings, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. Peter Anvin" <hpa@zytor.com>

Change <linux/sysinfo.h> to use explicitly sized types.  Replace
long/unsigned long with __kernel_[u]long_t so that a non-legacy 32-bit
ABI running on a 64-bit kernel can export those as 64-bit types.

Originally-by: H. J. Lu <hjl.tools@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 include/linux/sysinfo.h |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/include/linux/sysinfo.h b/include/linux/sysinfo.h
index ec4fc22..934335a 100644
--- a/include/linux/sysinfo.h
+++ b/include/linux/sysinfo.h
@@ -1,22 +1,24 @@
 #ifndef _LINUX_SYSINFO_H
 #define _LINUX_SYSINFO_H
 
+#include <linux/types.h>
+
 #define SI_LOAD_SHIFT	16
 struct sysinfo {
-	long uptime;			/* Seconds since boot */
-	unsigned long loads[3];		/* 1, 5, and 15 minute load averages */
-	unsigned long totalram;		/* Total usable main memory size */
-	unsigned long freeram;		/* Available memory size */
-	unsigned long sharedram;	/* Amount of shared memory */
-	unsigned long bufferram;	/* Memory used by buffers */
-	unsigned long totalswap;	/* Total swap space size */
-	unsigned long freeswap;		/* swap space still available */
-	unsigned short procs;		/* Number of current processes */
-	unsigned short pad;		/* explicit padding for m68k */
-	unsigned long totalhigh;	/* Total high memory size */
-	unsigned long freehigh;		/* Available high memory size */
-	unsigned int mem_unit;		/* Memory unit size in bytes */
-	char _f[20-2*sizeof(long)-sizeof(int)];	/* Padding: libc5 uses this.. */
+	__kernel_long_t uptime;		/* Seconds since boot */
+	__kernel_ulong_t loads[3];	/* 1, 5, and 15 minute load averages */
+	__kernel_ulong_t totalram;	/* Total usable main memory size */
+	__kernel_ulong_t freeram;	/* Available memory size */
+	__kernel_ulong_t sharedram;	/* Amount of shared memory */
+	__kernel_ulong_t bufferram;	/* Memory used by buffers */
+	__kernel_ulong_t totalswap;	/* Total swap space size */
+	__kernel_ulong_t freeswap;	/* swap space still available */
+	__u16 procs;		   	/* Number of current processes */
+	__u16 pad;		   	/* Explicit padding for m68k */
+	__kernel_ulong_t totalhigh;	/* Total high memory size */
+	__kernel_ulong_t freehigh;	/* Available high memory size */
+	__u32 mem_unit;			/* Memory unit size in bytes */
+	char _f[20-2*sizeof(__kernel_ulong_t)-sizeof(__u32)];	/* Padding: libc5 uses this.. */
 };
 
 #endif /* _LINUX_SYSINFO_H */
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 07/30] compat: Introduce COMPAT_USE_64BIT_TIME
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (5 preceding siblings ...)
  2012-02-20  0:07 ` [PATCH 06/30] sysinfo: Use explicit types in <linux/sysinfo.h> H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 08/30] compat: Use COMPAT_USE_64BIT_TIME in the lp driver H. Peter Anvin
                   ` (29 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. J. Lu" <hjl.tools@gmail.com>

Allow a compatibility ABI to use a 64-bit time_t and 64-bit members in
struct timeval and struct timespec to avoid the Y2038 problem.

This will be used for the x32 ABI.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 include/linux/compat.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/linux/compat.h b/include/linux/compat.h
index 41c9f65..1be91c0 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -19,6 +19,10 @@
 #include <asm/siginfo.h>
 #include <asm/signal.h>
 
+#ifndef COMPAT_USE_64BIT_TIME
+#define COMPAT_USE_64BIT_TIME 0
+#endif
+
 #define compat_jiffies_to_clock_t(x)	\
 		(((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
 
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 08/30] compat: Use COMPAT_USE_64BIT_TIME in the lp driver
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (6 preceding siblings ...)
  2012-02-20  0:07 ` [PATCH 07/30] compat: Introduce COMPAT_USE_64BIT_TIME H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20  0:56   ` Linus Torvalds
  2012-02-20  0:07 ` [PATCH 09/30] compat: Use COMPAT_USE_64BIT_TIME in the input subsystem H. Peter Anvin
                   ` (28 subsequent siblings)
  36 siblings, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch
  Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools, Arnd Bergmann,
	Greg Kroah-Hartman

From: "H. J. Lu" <hjl.tools@gmail.com>

Enable the lp driver to be used with a compat ABI with 64-bit time.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <greg@kroah.com>
---
 drivers/char/lp.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index f434856..a111ff2 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -706,18 +706,26 @@ static long lp_compat_ioctl(struct file *file, unsigned int cmd,
 {
 	unsigned int minor;
 	struct timeval par_timeout;
-	struct compat_timeval __user *tc;
 	int ret;
 
 	minor = iminor(file->f_path.dentry->d_inode);
 	mutex_lock(&lp_mutex);
 	switch (cmd) {
 	case LPSETTIMEOUT:
-		tc = compat_ptr(arg);
-		if (get_user(par_timeout.tv_sec, &tc->tv_sec) ||
-		    get_user(par_timeout.tv_usec, &tc->tv_usec)) {
-			ret = -EFAULT;
-			break;
+		if (COMPAT_USE_64BIT_TIME) {
+			if (copy_from_user(&par_timeout, (void __user *)arg,
+						sizeof (struct timeval))) {
+				ret = -EFAULT;
+				break;
+			}
+		} else {
+			struct compat_timeval __user *tc;
+			tc = compat_ptr(arg);
+			if (get_user(par_timeout.tv_sec, &tc->tv_sec) ||
+			    get_user(par_timeout.tv_usec, &tc->tv_usec)) {
+				ret = -EFAULT;
+				break;
+			}
 		}
 		ret = lp_set_timeout(minor, &par_timeout);
 		break;
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 09/30] compat: Use COMPAT_USE_64BIT_TIME in the input subsystem
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (7 preceding siblings ...)
  2012-02-20  0:07 ` [PATCH 08/30] compat: Use COMPAT_USE_64BIT_TIME in the lp driver H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 10/30] compat: Use COMPAT_USE_64BIT_TIME in the Bluetooth subsystem H. Peter Anvin
                   ` (27 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch
  Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools, Dmitry Torokhov

From: "H. J. Lu" <hjl.tools@gmail.com>

Enable the input system to be used with a compat ABI with 64-bit time.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/input-compat.c |    4 ++--
 drivers/input/input-compat.h |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/input/input-compat.c b/drivers/input/input-compat.c
index e46a867..64ca711 100644
--- a/drivers/input/input-compat.c
+++ b/drivers/input/input-compat.c
@@ -17,7 +17,7 @@
 int input_event_from_user(const char __user *buffer,
 			  struct input_event *event)
 {
-	if (INPUT_COMPAT_TEST) {
+	if (INPUT_COMPAT_TEST && !COMPAT_USE_64BIT_TIME) {
 		struct input_event_compat compat_event;
 
 		if (copy_from_user(&compat_event, buffer,
@@ -41,7 +41,7 @@ int input_event_from_user(const char __user *buffer,
 int input_event_to_user(char __user *buffer,
 			const struct input_event *event)
 {
-	if (INPUT_COMPAT_TEST) {
+	if (INPUT_COMPAT_TEST && !COMPAT_USE_64BIT_TIME) {
 		struct input_event_compat compat_event;
 
 		compat_event.time.tv_sec = event->time.tv_sec;
diff --git a/drivers/input/input-compat.h b/drivers/input/input-compat.h
index 22be27b..148f66f 100644
--- a/drivers/input/input-compat.h
+++ b/drivers/input/input-compat.h
@@ -67,7 +67,7 @@ struct ff_effect_compat {
 
 static inline size_t input_event_size(void)
 {
-	return INPUT_COMPAT_TEST ?
+	return (INPUT_COMPAT_TEST && !COMPAT_USE_64BIT_TIME) ?
 		sizeof(struct input_event_compat) : sizeof(struct input_event);
 }
 
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 10/30] compat: Use COMPAT_USE_64BIT_TIME in the Bluetooth subsystem
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (8 preceding siblings ...)
  2012-02-20  0:07 ` [PATCH 09/30] compat: Use COMPAT_USE_64BIT_TIME in the input subsystem H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-21 19:05   ` Gustavo Padovan
  2012-02-20  0:07 ` [PATCH 11/30] aio: Use __kernel_ulong_t to define aio_context_t H. Peter Anvin
                   ` (26 subsequent siblings)
  36 siblings, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch
  Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools, Marcel Holtmann,
	Gustavo F. Padovan, David S. Miller

From: "H. J. Lu" <hjl.tools@gmail.com>

Enable the Bluetooth subsystem to be used with a compat ABI with
64-bit time.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Gustavo F. Padovan <padovan@profusion.mobi>
Cc: David S. Miller <davem@davemloft.net>
---
 net/bluetooth/hci_sock.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 0dcc962..b2eb2b9 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -418,7 +418,8 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_
 		data = &tv;
 		len = sizeof(tv);
 #ifdef CONFIG_COMPAT
-		if (msg->msg_flags & MSG_CMSG_COMPAT) {
+		if (!COMPAT_USE_64BIT_TIME &&
+		    (msg->msg_flags & MSG_CMSG_COMPAT)) {
 			ctv.tv_sec = tv.tv_sec;
 			ctv.tv_usec = tv.tv_usec;
 			data = &ctv;
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 11/30] aio: Use __kernel_ulong_t to define aio_context_t
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (9 preceding siblings ...)
  2012-02-20  0:07 ` [PATCH 10/30] compat: Use COMPAT_USE_64BIT_TIME in the Bluetooth subsystem H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 12/30] compat: Create compat_sys_p{read,write}v64 H. Peter Anvin
                   ` (25 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch
  Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools, Benjamin LaHaise

From: "H. Peter Anvin" <hpa@zytor.com>

Rather than using "unsigned long" which is ABI-dependent, use
__kernel_ulong_t to define the externally visible type aio_context_t.

Note: the change in this form will cause unsigned long/unsigned int
differences on existing ABIs.  If that is unacceptable we may have to
define a new type.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Benjamin LaHaise <bcrl@kvack.org>
---
 include/linux/aio_abi.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/aio_abi.h b/include/linux/aio_abi.h
index 2c87316..86fa7a7 100644
--- a/include/linux/aio_abi.h
+++ b/include/linux/aio_abi.h
@@ -30,7 +30,7 @@
 #include <linux/types.h>
 #include <asm/byteorder.h>
 
-typedef unsigned long	aio_context_t;
+typedef __kernel_ulong_t aio_context_t;
 
 enum {
 	IOCB_CMD_PREAD = 0,
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 12/30] compat: Create compat_sys_p{read,write}v64
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (10 preceding siblings ...)
  2012-02-20  0:07 ` [PATCH 11/30] aio: Use __kernel_ulong_t to define aio_context_t H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 13/30] elf: Allow core dump-related fields to be overridden H. Peter Anvin
                   ` (24 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. J. Lu" <hjl.tools@gmail.com>

For 32-bit ABIs which have real 64-bit registers, we don't want to
break the position argument into two.  However, we still need compat
support to deal with 32-bit pointers, so we can't just use
sys_p{read,write} directly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 fs/compat.c |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/fs/compat.c b/fs/compat.c
index fa9d721..83d751c 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1177,10 +1177,9 @@ compat_sys_readv(unsigned long fd, const struct compat_iovec __user *vec,
 }
 
 asmlinkage ssize_t
-compat_sys_preadv(unsigned long fd, const struct compat_iovec __user *vec,
-		  unsigned long vlen, u32 pos_low, u32 pos_high)
+compat_sys_preadv64(unsigned long fd, const struct compat_iovec __user *vec,
+		    unsigned long vlen, loff_t pos)
 {
-	loff_t pos = ((loff_t)pos_high << 32) | pos_low;
 	struct file *file;
 	int fput_needed;
 	ssize_t ret;
@@ -1197,6 +1196,14 @@ compat_sys_preadv(unsigned long fd, const struct compat_iovec __user *vec,
 	return ret;
 }
 
+asmlinkage ssize_t
+compat_sys_preadv(unsigned long fd, const struct compat_iovec __user *vec,
+		  unsigned long vlen, u32 pos_low, u32 pos_high)
+{
+	loff_t pos = ((loff_t)pos_high << 32) | pos_low;
+	return compat_sys_preadv64(fd, vec, vlen, pos);
+}
+
 static size_t compat_writev(struct file *file,
 			    const struct compat_iovec __user *vec,
 			    unsigned long vlen, loff_t *pos)
@@ -1236,10 +1243,9 @@ compat_sys_writev(unsigned long fd, const struct compat_iovec __user *vec,
 }
 
 asmlinkage ssize_t
-compat_sys_pwritev(unsigned long fd, const struct compat_iovec __user *vec,
-		   unsigned long vlen, u32 pos_low, u32 pos_high)
+compat_sys_pwritev64(unsigned long fd, const struct compat_iovec __user *vec,
+		     unsigned long vlen, loff_t pos)
 {
-	loff_t pos = ((loff_t)pos_high << 32) | pos_low;
 	struct file *file;
 	int fput_needed;
 	ssize_t ret;
@@ -1256,6 +1262,14 @@ compat_sys_pwritev(unsigned long fd, const struct compat_iovec __user *vec,
 	return ret;
 }
 
+asmlinkage ssize_t
+compat_sys_pwritev(unsigned long fd, const struct compat_iovec __user *vec,
+		   unsigned long vlen, u32 pos_low, u32 pos_high)
+{
+	loff_t pos = ((loff_t)pos_high << 32) | pos_low;
+	return compat_sys_pwritev64(fd, vec, vlen, pos);
+}
+
 asmlinkage long
 compat_sys_vmsplice(int fd, const struct compat_iovec __user *iov32,
 		    unsigned int nr_segs, unsigned int flags)
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 13/30] elf: Allow core dump-related fields to be overridden
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (11 preceding siblings ...)
  2012-02-20  0:07 ` [PATCH 12/30] compat: Create compat_sys_p{read,write}v64 H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 14/30] x86-64: Add prototype for old_rsp to a header file H. Peter Anvin
                   ` (23 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch
  Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools, Alexander Viro,
	Roland McGrath, Oleg Nesterov

From: "H. J. Lu" <hjl.tools@gmail.com>

Allow some core dump-related fields to be overridden.  This allows
core dumps to work correctly for x32.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Roland McGrath <roland@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>
---
 fs/binfmt_elf.c |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index bcb884e..43ba478 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1390,6 +1390,22 @@ static void do_thread_regset_writeback(struct task_struct *task,
 		regset->writeback(task, regset, 1);
 }
 
+#ifndef PR_REG_SIZE
+#define PR_REG_SIZE(S) sizeof(S)
+#endif
+
+#ifndef PRSTATUS_SIZE
+#define PRSTATUS_SIZE(S) sizeof(S)
+#endif
+
+#ifndef PR_REG_PTR
+#define PR_REG_PTR(S) (&((S)->pr_reg))
+#endif
+
+#ifndef SET_PR_FPVALID
+#define SET_PR_FPVALID(S, V) ((S)->pr_fpvalid = (V))
+#endif
+
 static int fill_thread_core_info(struct elf_thread_core_info *t,
 				 const struct user_regset_view *view,
 				 long signr, size_t *total)
@@ -1404,11 +1420,11 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
 	 */
 	fill_prstatus(&t->prstatus, t->task, signr);
 	(void) view->regsets[0].get(t->task, &view->regsets[0],
-				    0, sizeof(t->prstatus.pr_reg),
-				    &t->prstatus.pr_reg, NULL);
+				    0, PR_REG_SIZE(t->prstatus.pr_reg),
+				    PR_REG_PTR(&t->prstatus), NULL);
 
 	fill_note(&t->notes[0], "CORE", NT_PRSTATUS,
-		  sizeof(t->prstatus), &t->prstatus);
+		  PRSTATUS_SIZE(t->prstatus), &t->prstatus);
 	*total += notesize(&t->notes[0]);
 
 	do_thread_regset_writeback(t->task, &view->regsets[0]);
@@ -1438,7 +1454,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
 						  regset->core_note_type,
 						  size, data);
 				else {
-					t->prstatus.pr_fpvalid = 1;
+					SET_PR_FPVALID(&t->prstatus, 1);
 					fill_note(&t->notes[i], "CORE",
 						  NT_PRFPREG, size, data);
 				}
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 14/30] x86-64: Add prototype for old_rsp to a header file
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (12 preceding siblings ...)
  2012-02-20  0:07 ` [PATCH 13/30] elf: Allow core dump-related fields to be overridden H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 15/30] x32: Add a thread flag for x32 processes H. Peter Anvin
                   ` (22 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. J. Lu" <hjl.tools@gmail.com>

So far this has only been used in process_64.c, but the x32 code will
need it in additional code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/include/asm/processor.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 9f748b5..e34f951 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -948,6 +948,12 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
 
 #define task_pt_regs(tsk)	((struct pt_regs *)(tsk)->thread.sp0 - 1)
 extern unsigned long KSTK_ESP(struct task_struct *task);
+
+/*
+ * User space RSP while inside the SYSCALL fast path
+ */
+DECLARE_PER_CPU(unsigned long, old_rsp);
+
 #endif /* CONFIG_X86_64 */
 
 extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 15/30] x32: Add a thread flag for x32 processes
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (13 preceding siblings ...)
  2012-02-20  0:07 ` [PATCH 14/30] x86-64: Add prototype for old_rsp to a header file H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 16/30] x86-64, ia32: Drop sys32_rt_sigprocmask H. Peter Anvin
                   ` (21 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. Peter Anvin" <hpa@zytor.com>

An x32 process is *almost* the same thing as a 64-bit process with a
32-bit address limit, but there are a few minor differences -- in
particular core dumps are 32 bits and signal handling is different.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/include/asm/thread_info.h |    2 ++
 arch/x86/kernel/process_64.c       |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index d1803a4..912e935 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -96,6 +96,7 @@ struct thread_info {
 #define TIF_LAZY_MMU_UPDATES	27	/* task is updating the mmu lazily */
 #define TIF_SYSCALL_TRACEPOINT	28	/* syscall tracepoint instrumentation */
 #define TIF_ADDR32		29	/* 32-bit address space on 64 bits */
+#define TIF_X32			30	/* 32-bit native x86-64 binary */
 
 #define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
 #define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
@@ -118,6 +119,7 @@ struct thread_info {
 #define _TIF_LAZY_MMU_UPDATES	(1 << TIF_LAZY_MMU_UPDATES)
 #define _TIF_SYSCALL_TRACEPOINT	(1 << TIF_SYSCALL_TRACEPOINT)
 #define _TIF_ADDR32		(1 << TIF_ADDR32)
+#define _TIF_X32		(1 << TIF_X32)
 
 /* work to do in syscall_trace_enter() */
 #define _TIF_WORK_SYSCALL_ENTRY	\
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 0e900d0..5fe2fba 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -509,6 +509,7 @@ void set_personality_64bit(void)
 	/* Make sure to be in 64bit mode */
 	clear_thread_flag(TIF_IA32);
 	clear_thread_flag(TIF_ADDR32);
+	clear_thread_flag(TIF_X32);
 
 	/* Ensure the corresponding mm is not marked. */
 	if (current->mm)
@@ -528,6 +529,7 @@ void set_personality_ia32(void)
 	/* Make sure to be in 32bit mode */
 	set_thread_flag(TIF_IA32);
 	set_thread_flag(TIF_ADDR32);
+	clear_thread_flag(TIF_X32);
 	current->personality |= force_personality32;
 
 	/* Mark the associated mm as containing 32-bit tasks. */
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 16/30] x86-64, ia32: Drop sys32_rt_sigprocmask
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (14 preceding siblings ...)
  2012-02-20  0:07 ` [PATCH 15/30] x32: Add a thread flag for x32 processes H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 17/30] x32: Add x32 system calls to syscall/syscall_64.tbl H. Peter Anvin
                   ` (20 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. Peter Anvin" <hpa@zytor.com>

On x86, the only difference between sys_rt_sigprocmask and
sys32_rt_sigprocmask is the alignment of the data structures.
However, x86 allows data accesses with arbitrary alignment, and
therefore there is no reason for this code to be different.

Reported-by: Gregory M. Lueck <gregory.m.lueck@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/ia32/sys_ia32.c         |   40 --------------------------------------
 arch/x86/include/asm/sys_ia32.h  |    2 -
 arch/x86/syscalls/syscall_32.tbl |    2 +-
 3 files changed, 1 insertions(+), 43 deletions(-)

diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index f6f5c53..aec2202 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -287,46 +287,6 @@ asmlinkage long sys32_sigaction(int sig, struct old_sigaction32 __user *act,
 	return ret;
 }
 
-asmlinkage long sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
-				     compat_sigset_t __user *oset,
-				     unsigned int sigsetsize)
-{
-	sigset_t s;
-	compat_sigset_t s32;
-	int ret;
-	mm_segment_t old_fs = get_fs();
-
-	if (set) {
-		if (copy_from_user(&s32, set, sizeof(compat_sigset_t)))
-			return -EFAULT;
-		switch (_NSIG_WORDS) {
-		case 4: s.sig[3] = s32.sig[6] | (((long)s32.sig[7]) << 32);
-		case 3: s.sig[2] = s32.sig[4] | (((long)s32.sig[5]) << 32);
-		case 2: s.sig[1] = s32.sig[2] | (((long)s32.sig[3]) << 32);
-		case 1: s.sig[0] = s32.sig[0] | (((long)s32.sig[1]) << 32);
-		}
-	}
-	set_fs(KERNEL_DS);
-	ret = sys_rt_sigprocmask(how,
-				 set ? (sigset_t __user *)&s : NULL,
-				 oset ? (sigset_t __user *)&s : NULL,
-				 sigsetsize);
-	set_fs(old_fs);
-	if (ret)
-		return ret;
-	if (oset) {
-		switch (_NSIG_WORDS) {
-		case 4: s32.sig[7] = (s.sig[3] >> 32); s32.sig[6] = s.sig[3];
-		case 3: s32.sig[5] = (s.sig[2] >> 32); s32.sig[4] = s.sig[2];
-		case 2: s32.sig[3] = (s.sig[1] >> 32); s32.sig[2] = s.sig[1];
-		case 1: s32.sig[1] = (s.sig[0] >> 32); s32.sig[0] = s.sig[0];
-		}
-		if (copy_to_user(oset, &s32, sizeof(compat_sigset_t)))
-			return -EFAULT;
-	}
-	return 0;
-}
-
 asmlinkage long sys32_alarm(unsigned int seconds)
 {
 	return alarm_setitimer(seconds);
diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h
index cb23852..68da87b 100644
--- a/arch/x86/include/asm/sys_ia32.h
+++ b/arch/x86/include/asm/sys_ia32.h
@@ -36,8 +36,6 @@ asmlinkage long sys32_rt_sigaction(int, struct sigaction32 __user *,
 				   struct sigaction32 __user *, unsigned int);
 asmlinkage long sys32_sigaction(int, struct old_sigaction32 __user *,
 				struct old_sigaction32 __user *);
-asmlinkage long sys32_rt_sigprocmask(int, compat_sigset_t __user *,
-				     compat_sigset_t __user *, unsigned int);
 asmlinkage long sys32_alarm(unsigned int);
 
 asmlinkage long sys32_waitpid(compat_pid_t, unsigned int *, int);
diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl
index ce98e28..031cef8 100644
--- a/arch/x86/syscalls/syscall_32.tbl
+++ b/arch/x86/syscalls/syscall_32.tbl
@@ -181,7 +181,7 @@
 172	i386	prctl			sys_prctl
 173	i386	rt_sigreturn		ptregs_rt_sigreturn		stub32_rt_sigreturn
 174	i386	rt_sigaction		sys_rt_sigaction		sys32_rt_sigaction
-175	i386	rt_sigprocmask		sys_rt_sigprocmask		sys32_rt_sigprocmask
+175	i386	rt_sigprocmask		sys_rt_sigprocmask
 176	i386	rt_sigpending		sys_rt_sigpending		sys32_rt_sigpending
 177	i386	rt_sigtimedwait		sys_rt_sigtimedwait		compat_sys_rt_sigtimedwait
 178	i386	rt_sigqueueinfo		sys_rt_sigqueueinfo		sys32_rt_sigqueueinfo
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 17/30] x32: Add x32 system calls to syscall/syscall_64.tbl
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (15 preceding siblings ...)
  2012-02-20  0:07 ` [PATCH 16/30] x86-64, ia32: Drop sys32_rt_sigprocmask H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 18/30] x32: Generate <asm/unistd_x32.h> H. Peter Anvin
                   ` (19 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. Peter Anvin" <hpa@zytor.com>

Split the 64-bit system calls into "64" (64-bit only) and "common"
(64-bit or x32) and add the x32 system call numbers.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/kernel/asm-offsets_64.c |    2 +
 arch/x86/kernel/syscall_64.c     |    3 +
 arch/x86/syscalls/Makefile       |    2 +-
 arch/x86/syscalls/syscall_64.tbl |  579 ++++++++++++++++++++------------------
 arch/x86/um/sys_call_table_64.c  |    3 +
 arch/x86/um/user-offsets.c       |    2 +
 6 files changed, 317 insertions(+), 274 deletions(-)

diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index 834e897..c3354f7 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
@@ -1,6 +1,8 @@
 #include <asm/ia32.h>
 
 #define __SYSCALL_64(nr, sym, compat) [nr] = 1,
+#define __SYSCALL_COMMON(nr, sym, compat) [nr] = 1,
+#define __SYSCALL_X32(nr, sym, compat) /* Not yet */
 static char syscalls_64[] = {
 #include <asm/syscalls_64.h>
 };
diff --git a/arch/x86/kernel/syscall_64.c b/arch/x86/kernel/syscall_64.c
index 7ac7943..26c4ca1 100644
--- a/arch/x86/kernel/syscall_64.c
+++ b/arch/x86/kernel/syscall_64.c
@@ -5,6 +5,9 @@
 #include <linux/cache.h>
 #include <asm/asm-offsets.h>
 
+#define __SYSCALL_COMMON(nr, sym, compat) __SYSCALL_64(nr, sym, compat)
+#define __SYSCALL_X32(nr, sym, compat) /* Not yet */
+
 #define __SYSCALL_64(nr, sym, compat) extern asmlinkage void sym(void) ;
 #include <asm/syscalls_64.h>
 #undef __SYSCALL_64
diff --git a/arch/x86/syscalls/Makefile b/arch/x86/syscalls/Makefile
index 564b247..89dd958 100644
--- a/arch/x86/syscalls/Makefile
+++ b/arch/x86/syscalls/Makefile
@@ -24,7 +24,7 @@ syshdr_pfx_unistd_32_ia32 := ia32_
 $(out)/unistd_32_ia32.h: $(syscall32) $(syshdr)
 	$(call if_changed,syshdr)
 
-syshdr_abi_unistd_64 := 64
+syshdr_abi_unistd_64 := common,64
 $(out)/unistd_64.h: $(syscall64) $(syshdr)
 	$(call if_changed,syshdr)
 
diff --git a/arch/x86/syscalls/syscall_64.tbl b/arch/x86/syscalls/syscall_64.tbl
index b440a8f..4aecc7e 100644
--- a/arch/x86/syscalls/syscall_64.tbl
+++ b/arch/x86/syscalls/syscall_64.tbl
@@ -4,317 +4,350 @@
 # The format is:
 # <number> <abi> <name> <entry point>
 #
-# The abi is always "64" for this file (for now.)
+# The abi is "common", "64" or "x32" for this file.
 #
-0	64	read			sys_read
-1	64	write			sys_write
-2	64	open			sys_open
-3	64	close			sys_close
-4	64	stat			sys_newstat
-5	64	fstat			sys_newfstat
-6	64	lstat			sys_newlstat
-7	64	poll			sys_poll
-8	64	lseek			sys_lseek
-9	64	mmap			sys_mmap
-10	64	mprotect		sys_mprotect
-11	64	munmap			sys_munmap
-12	64	brk			sys_brk
+0	common	read			sys_read
+1	common	write			sys_write
+2	common	open			sys_open
+3	common	close			sys_close
+4	common	stat			sys_newstat
+5	common	fstat			sys_newfstat
+6	common	lstat			sys_newlstat
+7	common	poll			sys_poll
+8	common	lseek			sys_lseek
+9	common	mmap			sys_mmap
+10	common	mprotect		sys_mprotect
+11	common	munmap			sys_munmap
+12	common	brk			sys_brk
 13	64	rt_sigaction		sys_rt_sigaction
-14	64	rt_sigprocmask		sys_rt_sigprocmask
+14	common	rt_sigprocmask		sys_rt_sigprocmask
 15	64	rt_sigreturn		stub_rt_sigreturn
 16	64	ioctl			sys_ioctl
-17	64	pread64			sys_pread64
-18	64	pwrite64		sys_pwrite64
+17	common	pread64			sys_pread64
+18	common	pwrite64		sys_pwrite64
 19	64	readv			sys_readv
 20	64	writev			sys_writev
-21	64	access			sys_access
-22	64	pipe			sys_pipe
-23	64	select			sys_select
-24	64	sched_yield		sys_sched_yield
-25	64	mremap			sys_mremap
-26	64	msync			sys_msync
-27	64	mincore			sys_mincore
-28	64	madvise			sys_madvise
-29	64	shmget			sys_shmget
-30	64	shmat			sys_shmat
-31	64	shmctl			sys_shmctl
-32	64	dup			sys_dup
-33	64	dup2			sys_dup2
-34	64	pause			sys_pause
-35	64	nanosleep		sys_nanosleep
-36	64	getitimer		sys_getitimer
-37	64	alarm			sys_alarm
-38	64	setitimer		sys_setitimer
-39	64	getpid			sys_getpid
-40	64	sendfile		sys_sendfile64
-41	64	socket			sys_socket
-42	64	connect			sys_connect
-43	64	accept			sys_accept
-44	64	sendto			sys_sendto
+21	common	access			sys_access
+22	common	pipe			sys_pipe
+23	common	select			sys_select
+24	common	sched_yield		sys_sched_yield
+25	common	mremap			sys_mremap
+26	common	msync			sys_msync
+27	common	mincore			sys_mincore
+28	common	madvise			sys_madvise
+29	common	shmget			sys_shmget
+30	common	shmat			sys_shmat
+31	common	shmctl			sys_shmctl
+32	common	dup			sys_dup
+33	common	dup2			sys_dup2
+34	common	pause			sys_pause
+35	common	nanosleep		sys_nanosleep
+36	common	getitimer		sys_getitimer
+37	common	alarm			sys_alarm
+38	common	setitimer		sys_setitimer
+39	common	getpid			sys_getpid
+40	common	sendfile		sys_sendfile64
+41	common	socket			sys_socket
+42	common	connect			sys_connect
+43	common	accept			sys_accept
+44	common	sendto			sys_sendto
 45	64	recvfrom		sys_recvfrom
 46	64	sendmsg			sys_sendmsg
 47	64	recvmsg			sys_recvmsg
-48	64	shutdown		sys_shutdown
-49	64	bind			sys_bind
-50	64	listen			sys_listen
-51	64	getsockname		sys_getsockname
-52	64	getpeername		sys_getpeername
-53	64	socketpair		sys_socketpair
-54	64	setsockopt		sys_setsockopt
-55	64	getsockopt		sys_getsockopt
-56	64	clone			stub_clone
-57	64	fork			stub_fork
-58	64	vfork			stub_vfork
+48	common	shutdown		sys_shutdown
+49	common	bind			sys_bind
+50	common	listen			sys_listen
+51	common	getsockname		sys_getsockname
+52	common	getpeername		sys_getpeername
+53	common	socketpair		sys_socketpair
+54	common	setsockopt		sys_setsockopt
+55	common	getsockopt		sys_getsockopt
+56	common	clone			stub_clone
+57	common	fork			stub_fork
+58	common	vfork			stub_vfork
 59	64	execve			stub_execve
-60	64	exit			sys_exit
-61	64	wait4			sys_wait4
-62	64	kill			sys_kill
-63	64	uname			sys_newuname
-64	64	semget			sys_semget
-65	64	semop			sys_semop
-66	64	semctl			sys_semctl
-67	64	shmdt			sys_shmdt
-68	64	msgget			sys_msgget
-69	64	msgsnd			sys_msgsnd
-70	64	msgrcv			sys_msgrcv
-71	64	msgctl			sys_msgctl
-72	64	fcntl			sys_fcntl
-73	64	flock			sys_flock
-74	64	fsync			sys_fsync
-75	64	fdatasync		sys_fdatasync
-76	64	truncate		sys_truncate
-77	64	ftruncate		sys_ftruncate
-78	64	getdents		sys_getdents
-79	64	getcwd			sys_getcwd
-80	64	chdir			sys_chdir
-81	64	fchdir			sys_fchdir
-82	64	rename			sys_rename
-83	64	mkdir			sys_mkdir
-84	64	rmdir			sys_rmdir
-85	64	creat			sys_creat
-86	64	link			sys_link
-87	64	unlink			sys_unlink
-88	64	symlink			sys_symlink
-89	64	readlink		sys_readlink
-90	64	chmod			sys_chmod
-91	64	fchmod			sys_fchmod
-92	64	chown			sys_chown
-93	64	fchown			sys_fchown
-94	64	lchown			sys_lchown
-95	64	umask			sys_umask
-96	64	gettimeofday		sys_gettimeofday
-97	64	getrlimit		sys_getrlimit
-98	64	getrusage		sys_getrusage
-99	64	sysinfo			sys_sysinfo
+60	common	exit			sys_exit
+61	common	wait4			sys_wait4
+62	common	kill			sys_kill
+63	common	uname			sys_newuname
+64	common	semget			sys_semget
+65	common	semop			sys_semop
+66	common	semctl			sys_semctl
+67	common	shmdt			sys_shmdt
+68	common	msgget			sys_msgget
+69	common	msgsnd			sys_msgsnd
+70	common	msgrcv			sys_msgrcv
+71	common	msgctl			sys_msgctl
+72	common	fcntl			sys_fcntl
+73	common	flock			sys_flock
+74	common	fsync			sys_fsync
+75	common	fdatasync		sys_fdatasync
+76	common	truncate		sys_truncate
+77	common	ftruncate		sys_ftruncate
+78	common	getdents		sys_getdents
+79	common	getcwd			sys_getcwd
+80	common	chdir			sys_chdir
+81	common	fchdir			sys_fchdir
+82	common	rename			sys_rename
+83	common	mkdir			sys_mkdir
+84	common	rmdir			sys_rmdir
+85	common	creat			sys_creat
+86	common	link			sys_link
+87	common	unlink			sys_unlink
+88	common	symlink			sys_symlink
+89	common	readlink		sys_readlink
+90	common	chmod			sys_chmod
+91	common	fchmod			sys_fchmod
+92	common	chown			sys_chown
+93	common	fchown			sys_fchown
+94	common	lchown			sys_lchown
+95	common	umask			sys_umask
+96	common	gettimeofday		sys_gettimeofday
+97	common	getrlimit		sys_getrlimit
+98	common	getrusage		sys_getrusage
+99	common	sysinfo			sys_sysinfo
 100	64	times			sys_times
-101	64	ptrace			sys_ptrace
-102	64	getuid			sys_getuid
-103	64	syslog			sys_syslog
-104	64	getgid			sys_getgid
-105	64	setuid			sys_setuid
-106	64	setgid			sys_setgid
-107	64	geteuid			sys_geteuid
-108	64	getegid			sys_getegid
-109	64	setpgid			sys_setpgid
-110	64	getppid			sys_getppid
-111	64	getpgrp			sys_getpgrp
-112	64	setsid			sys_setsid
-113	64	setreuid		sys_setreuid
-114	64	setregid		sys_setregid
-115	64	getgroups		sys_getgroups
-116	64	setgroups		sys_setgroups
-117	64	setresuid		sys_setresuid
-118	64	getresuid		sys_getresuid
-119	64	setresgid		sys_setresgid
-120	64	getresgid		sys_getresgid
-121	64	getpgid			sys_getpgid
-122	64	setfsuid		sys_setfsuid
-123	64	setfsgid		sys_setfsgid
-124	64	getsid			sys_getsid
-125	64	capget			sys_capget
-126	64	capset			sys_capset
+101	common	ptrace			sys_ptrace
+102	common	getuid			sys_getuid
+103	common	syslog			sys_syslog
+104	common	getgid			sys_getgid
+105	common	setuid			sys_setuid
+106	common	setgid			sys_setgid
+107	common	geteuid			sys_geteuid
+108	common	getegid			sys_getegid
+109	common	setpgid			sys_setpgid
+110	common	getppid			sys_getppid
+111	common	getpgrp			sys_getpgrp
+112	common	setsid			sys_setsid
+113	common	setreuid		sys_setreuid
+114	common	setregid		sys_setregid
+115	common	getgroups		sys_getgroups
+116	common	setgroups		sys_setgroups
+117	common	setresuid		sys_setresuid
+118	common	getresuid		sys_getresuid
+119	common	setresgid		sys_setresgid
+120	common	getresgid		sys_getresgid
+121	common	getpgid			sys_getpgid
+122	common	setfsuid		sys_setfsuid
+123	common	setfsgid		sys_setfsgid
+124	common	getsid			sys_getsid
+125	common	capget			sys_capget
+126	common	capset			sys_capset
 127	64	rt_sigpending		sys_rt_sigpending
 128	64	rt_sigtimedwait		sys_rt_sigtimedwait
 129	64	rt_sigqueueinfo		sys_rt_sigqueueinfo
-130	64	rt_sigsuspend		sys_rt_sigsuspend
+130	common	rt_sigsuspend		sys_rt_sigsuspend
 131	64	sigaltstack		stub_sigaltstack
-132	64	utime			sys_utime
-133	64	mknod			sys_mknod
+132	common	utime			sys_utime
+133	common	mknod			sys_mknod
 134	64	uselib
-135	64	personality		sys_personality
-136	64	ustat			sys_ustat
-137	64	statfs			sys_statfs
-138	64	fstatfs			sys_fstatfs
-139	64	sysfs			sys_sysfs
-140	64	getpriority		sys_getpriority
-141	64	setpriority		sys_setpriority
-142	64	sched_setparam		sys_sched_setparam
-143	64	sched_getparam		sys_sched_getparam
-144	64	sched_setscheduler	sys_sched_setscheduler
-145	64	sched_getscheduler	sys_sched_getscheduler
-146	64	sched_get_priority_max	sys_sched_get_priority_max
-147	64	sched_get_priority_min	sys_sched_get_priority_min
-148	64	sched_rr_get_interval	sys_sched_rr_get_interval
-149	64	mlock			sys_mlock
-150	64	munlock			sys_munlock
-151	64	mlockall		sys_mlockall
-152	64	munlockall		sys_munlockall
-153	64	vhangup			sys_vhangup
-154	64	modify_ldt		sys_modify_ldt
-155	64	pivot_root		sys_pivot_root
+135	common	personality		sys_personality
+136	common	ustat			sys_ustat
+137	common	statfs			sys_statfs
+138	common	fstatfs			sys_fstatfs
+139	common	sysfs			sys_sysfs
+140	common	getpriority		sys_getpriority
+141	common	setpriority		sys_setpriority
+142	common	sched_setparam		sys_sched_setparam
+143	common	sched_getparam		sys_sched_getparam
+144	common	sched_setscheduler	sys_sched_setscheduler
+145	common	sched_getscheduler	sys_sched_getscheduler
+146	common	sched_get_priority_max	sys_sched_get_priority_max
+147	common	sched_get_priority_min	sys_sched_get_priority_min
+148	common	sched_rr_get_interval	sys_sched_rr_get_interval
+149	common	mlock			sys_mlock
+150	common	munlock			sys_munlock
+151	common	mlockall		sys_mlockall
+152	common	munlockall		sys_munlockall
+153	common	vhangup			sys_vhangup
+154	common	modify_ldt		sys_modify_ldt
+155	common	pivot_root		sys_pivot_root
 156	64	_sysctl			sys_sysctl
-157	64	prctl			sys_prctl
-158	64	arch_prctl		sys_arch_prctl
-159	64	adjtimex		sys_adjtimex
-160	64	setrlimit		sys_setrlimit
-161	64	chroot			sys_chroot
-162	64	sync			sys_sync
-163	64	acct			sys_acct
-164	64	settimeofday		sys_settimeofday
-165	64	mount			sys_mount
-166	64	umount2			sys_umount
-167	64	swapon			sys_swapon
-168	64	swapoff			sys_swapoff
-169	64	reboot			sys_reboot
-170	64	sethostname		sys_sethostname
-171	64	setdomainname		sys_setdomainname
-172	64	iopl			stub_iopl
-173	64	ioperm			sys_ioperm
+157	common	prctl			sys_prctl
+158	common	arch_prctl		sys_arch_prctl
+159	common	adjtimex		sys_adjtimex
+160	common	setrlimit		sys_setrlimit
+161	common	chroot			sys_chroot
+162	common	sync			sys_sync
+163	common	acct			sys_acct
+164	common	settimeofday		sys_settimeofday
+165	common	mount			sys_mount
+166	common	umount2			sys_umount
+167	common	swapon			sys_swapon
+168	common	swapoff			sys_swapoff
+169	common	reboot			sys_reboot
+170	common	sethostname		sys_sethostname
+171	common	setdomainname		sys_setdomainname
+172	common	iopl			stub_iopl
+173	common	ioperm			sys_ioperm
 174	64	create_module
-175	64	init_module		sys_init_module
-176	64	delete_module		sys_delete_module
+175	common	init_module		sys_init_module
+176	common	delete_module		sys_delete_module
 177	64	get_kernel_syms
 178	64	query_module
-179	64	quotactl		sys_quotactl
+179	common	quotactl		sys_quotactl
 180	64	nfsservctl
-181	64	getpmsg
-182	64	putpmsg
-183	64	afs_syscall
-184	64	tuxcall
-185	64	security
-186	64	gettid			sys_gettid
-187	64	readahead		sys_readahead
-188	64	setxattr		sys_setxattr
-189	64	lsetxattr		sys_lsetxattr
-190	64	fsetxattr		sys_fsetxattr
-191	64	getxattr		sys_getxattr
-192	64	lgetxattr		sys_lgetxattr
-193	64	fgetxattr		sys_fgetxattr
-194	64	listxattr		sys_listxattr
-195	64	llistxattr		sys_llistxattr
-196	64	flistxattr		sys_flistxattr
-197	64	removexattr		sys_removexattr
-198	64	lremovexattr		sys_lremovexattr
-199	64	fremovexattr		sys_fremovexattr
-200	64	tkill			sys_tkill
-201	64	time			sys_time
-202	64	futex			sys_futex
-203	64	sched_setaffinity	sys_sched_setaffinity
-204	64	sched_getaffinity	sys_sched_getaffinity
+181	common	getpmsg
+182	common	putpmsg
+183	common	afs_syscall
+184	common	tuxcall
+185	common	security
+186	common	gettid			sys_gettid
+187	common	readahead		sys_readahead
+188	common	setxattr		sys_setxattr
+189	common	lsetxattr		sys_lsetxattr
+190	common	fsetxattr		sys_fsetxattr
+191	common	getxattr		sys_getxattr
+192	common	lgetxattr		sys_lgetxattr
+193	common	fgetxattr		sys_fgetxattr
+194	common	listxattr		sys_listxattr
+195	common	llistxattr		sys_llistxattr
+196	common	flistxattr		sys_flistxattr
+197	common	removexattr		sys_removexattr
+198	common	lremovexattr		sys_lremovexattr
+199	common	fremovexattr		sys_fremovexattr
+200	common	tkill			sys_tkill
+201	common	time			sys_time
+202	common	futex			sys_futex
+203	common	sched_setaffinity	sys_sched_setaffinity
+204	common	sched_getaffinity	sys_sched_getaffinity
 205	64	set_thread_area
-206	64	io_setup		sys_io_setup
-207	64	io_destroy		sys_io_destroy
-208	64	io_getevents		sys_io_getevents
-209	64	io_submit		sys_io_submit
-210	64	io_cancel		sys_io_cancel
+206	common	io_setup		sys_io_setup
+207	common	io_destroy		sys_io_destroy
+208	common	io_getevents		sys_io_getevents
+209	common	io_submit		sys_io_submit
+210	common	io_cancel		sys_io_cancel
 211	64	get_thread_area
-212	64	lookup_dcookie		sys_lookup_dcookie
-213	64	epoll_create		sys_epoll_create
+212	common	lookup_dcookie		sys_lookup_dcookie
+213	common	epoll_create		sys_epoll_create
 214	64	epoll_ctl_old
 215	64	epoll_wait_old
-216	64	remap_file_pages	sys_remap_file_pages
-217	64	getdents64		sys_getdents64
-218	64	set_tid_address		sys_set_tid_address
-219	64	restart_syscall		sys_restart_syscall
-220	64	semtimedop		sys_semtimedop
-221	64	fadvise64		sys_fadvise64
+216	common	remap_file_pages	sys_remap_file_pages
+217	common	getdents64		sys_getdents64
+218	common	set_tid_address		sys_set_tid_address
+219	common	restart_syscall		sys_restart_syscall
+220	common	semtimedop		sys_semtimedop
+221	common	fadvise64		sys_fadvise64
 222	64	timer_create		sys_timer_create
-223	64	timer_settime		sys_timer_settime
-224	64	timer_gettime		sys_timer_gettime
-225	64	timer_getoverrun	sys_timer_getoverrun
-226	64	timer_delete		sys_timer_delete
-227	64	clock_settime		sys_clock_settime
-228	64	clock_gettime		sys_clock_gettime
-229	64	clock_getres		sys_clock_getres
-230	64	clock_nanosleep		sys_clock_nanosleep
-231	64	exit_group		sys_exit_group
-232	64	epoll_wait		sys_epoll_wait
-233	64	epoll_ctl		sys_epoll_ctl
-234	64	tgkill			sys_tgkill
-235	64	utimes			sys_utimes
+223	common	timer_settime		sys_timer_settime
+224	common	timer_gettime		sys_timer_gettime
+225	common	timer_getoverrun	sys_timer_getoverrun
+226	common	timer_delete		sys_timer_delete
+227	common	clock_settime		sys_clock_settime
+228	common	clock_gettime		sys_clock_gettime
+229	common	clock_getres		sys_clock_getres
+230	common	clock_nanosleep		sys_clock_nanosleep
+231	common	exit_group		sys_exit_group
+232	common	epoll_wait		sys_epoll_wait
+233	common	epoll_ctl		sys_epoll_ctl
+234	common	tgkill			sys_tgkill
+235	common	utimes			sys_utimes
 236	64	vserver
-237	64	mbind			sys_mbind
-238	64	set_mempolicy		sys_set_mempolicy
-239	64	get_mempolicy		sys_get_mempolicy
-240	64	mq_open			sys_mq_open
-241	64	mq_unlink		sys_mq_unlink
-242	64	mq_timedsend		sys_mq_timedsend
-243	64	mq_timedreceive		sys_mq_timedreceive
+237	common	mbind			sys_mbind
+238	common	set_mempolicy		sys_set_mempolicy
+239	common	get_mempolicy		sys_get_mempolicy
+240	common	mq_open			sys_mq_open
+241	common	mq_unlink		sys_mq_unlink
+242	common	mq_timedsend		sys_mq_timedsend
+243	common	mq_timedreceive		sys_mq_timedreceive
 244	64	mq_notify		sys_mq_notify
-245	64	mq_getsetattr		sys_mq_getsetattr
+245	common	mq_getsetattr		sys_mq_getsetattr
 246	64	kexec_load		sys_kexec_load
 247	64	waitid			sys_waitid
-248	64	add_key			sys_add_key
-249	64	request_key		sys_request_key
-250	64	keyctl			sys_keyctl
-251	64	ioprio_set		sys_ioprio_set
-252	64	ioprio_get		sys_ioprio_get
-253	64	inotify_init		sys_inotify_init
-254	64	inotify_add_watch	sys_inotify_add_watch
-255	64	inotify_rm_watch	sys_inotify_rm_watch
-256	64	migrate_pages		sys_migrate_pages
-257	64	openat			sys_openat
-258	64	mkdirat			sys_mkdirat
-259	64	mknodat			sys_mknodat
-260	64	fchownat		sys_fchownat
-261	64	futimesat		sys_futimesat
-262	64	newfstatat		sys_newfstatat
-263	64	unlinkat		sys_unlinkat
-264	64	renameat		sys_renameat
-265	64	linkat			sys_linkat
-266	64	symlinkat		sys_symlinkat
-267	64	readlinkat		sys_readlinkat
-268	64	fchmodat		sys_fchmodat
-269	64	faccessat		sys_faccessat
-270	64	pselect6		sys_pselect6
-271	64	ppoll			sys_ppoll
-272	64	unshare			sys_unshare
+248	common	add_key			sys_add_key
+249	common	request_key		sys_request_key
+250	common	keyctl			sys_keyctl
+251	common	ioprio_set		sys_ioprio_set
+252	common	ioprio_get		sys_ioprio_get
+253	common	inotify_init		sys_inotify_init
+254	common	inotify_add_watch	sys_inotify_add_watch
+255	common	inotify_rm_watch	sys_inotify_rm_watch
+256	common	migrate_pages		sys_migrate_pages
+257	common	openat			sys_openat
+258	common	mkdirat			sys_mkdirat
+259	common	mknodat			sys_mknodat
+260	common	fchownat		sys_fchownat
+261	common	futimesat		sys_futimesat
+262	common	newfstatat		sys_newfstatat
+263	common	unlinkat		sys_unlinkat
+264	common	renameat		sys_renameat
+265	common	linkat			sys_linkat
+266	common	symlinkat		sys_symlinkat
+267	common	readlinkat		sys_readlinkat
+268	common	fchmodat		sys_fchmodat
+269	common	faccessat		sys_faccessat
+270	common	pselect6		sys_pselect6
+271	common	ppoll			sys_ppoll
+272	common	unshare			sys_unshare
 273	64	set_robust_list		sys_set_robust_list
 274	64	get_robust_list		sys_get_robust_list
-275	64	splice			sys_splice
-276	64	tee			sys_tee
-277	64	sync_file_range		sys_sync_file_range
+275	common	splice			sys_splice
+276	common	tee			sys_tee
+277	common	sync_file_range		sys_sync_file_range
 278	64	vmsplice		sys_vmsplice
 279	64	move_pages		sys_move_pages
-280	64	utimensat		sys_utimensat
-281	64	epoll_pwait		sys_epoll_pwait
-282	64	signalfd		sys_signalfd
-283	64	timerfd_create		sys_timerfd_create
-284	64	eventfd			sys_eventfd
-285	64	fallocate		sys_fallocate
-286	64	timerfd_settime		sys_timerfd_settime
-287	64	timerfd_gettime		sys_timerfd_gettime
-288	64	accept4			sys_accept4
-289	64	signalfd4		sys_signalfd4
-290	64	eventfd2		sys_eventfd2
-291	64	epoll_create1		sys_epoll_create1
-292	64	dup3			sys_dup3
-293	64	pipe2			sys_pipe2
-294	64	inotify_init1		sys_inotify_init1
+280	common	utimensat		sys_utimensat
+281	common	epoll_pwait		sys_epoll_pwait
+282	common	signalfd		sys_signalfd
+283	common	timerfd_create		sys_timerfd_create
+284	common	eventfd			sys_eventfd
+285	common	fallocate		sys_fallocate
+286	common	timerfd_settime		sys_timerfd_settime
+287	common	timerfd_gettime		sys_timerfd_gettime
+288	common	accept4			sys_accept4
+289	common	signalfd4		sys_signalfd4
+290	common	eventfd2		sys_eventfd2
+291	common	epoll_create1		sys_epoll_create1
+292	common	dup3			sys_dup3
+293	common	pipe2			sys_pipe2
+294	common	inotify_init1		sys_inotify_init1
 295	64	preadv			sys_preadv
 296	64	pwritev			sys_pwritev
 297	64	rt_tgsigqueueinfo	sys_rt_tgsigqueueinfo
-298	64	perf_event_open		sys_perf_event_open
+298	common	perf_event_open		sys_perf_event_open
 299	64	recvmmsg		sys_recvmmsg
-300	64	fanotify_init		sys_fanotify_init
-301	64	fanotify_mark		sys_fanotify_mark
-302	64	prlimit64		sys_prlimit64
-303	64	name_to_handle_at	sys_name_to_handle_at
-304	64	open_by_handle_at	sys_open_by_handle_at
-305	64	clock_adjtime		sys_clock_adjtime
-306	64	syncfs			sys_syncfs
+300	common	fanotify_init		sys_fanotify_init
+301	common	fanotify_mark		sys_fanotify_mark
+302	common	prlimit64		sys_prlimit64
+303	common	name_to_handle_at	sys_name_to_handle_at
+304	common	open_by_handle_at	sys_open_by_handle_at
+305	common	clock_adjtime		sys_clock_adjtime
+306	common	syncfs			sys_syncfs
 307	64	sendmmsg		sys_sendmmsg
-308	64	setns			sys_setns
-309	64	getcpu			sys_getcpu
+308	common	setns			sys_setns
+309	common	getcpu			sys_getcpu
 310	64	process_vm_readv	sys_process_vm_readv
 311	64	process_vm_writev	sys_process_vm_writev
+#
+# x32-specific system call numbers start at 512 to avoid cache impact
+# for native 64-bit operation.
+#
+512	x32	rt_sigaction		sys32_rt_sigaction
+513	x32	rt_sigreturn		stub_x32_rt_sigreturn
+514	x32	ioctl			compat_sys_ioctl
+515	x32	readv			compat_sys_readv
+516	x32	writev			compat_sys_writev
+517	x32	recvfrom		compat_sys_recvfrom
+518	x32	sendmsg			compat_sys_sendmsg
+519	x32	recvmsg			compat_sys_recvmsg
+520	x32	execve			stub_x32_execve
+521	x32	times			compat_sys_times
+522	x32	rt_sigpending		sys32_rt_sigpending
+523	x32	rt_sigtimedwait		compat_sys_rt_sigtimedwait
+524	x32	rt_sigqueueinfo		sys32_rt_sigqueueinfo
+525	x32	sigaltstack		stub_x32_sigaltstack
+526	x32	timer_create		compat_sys_timer_create
+527	x32	mq_notify		compat_sys_mq_notify
+528	x32	kexec_load		compat_sys_kexec_load
+529	x32	waitid			compat_sys_waitid
+530	x32	set_robust_list		compat_sys_set_robust_list
+531	x32	get_robust_list		compat_sys_get_robust_list
+532	x32	vmsplice		compat_sys_vmsplice
+533	x32	move_pages		compat_sys_move_pages
+534	x32	preadv			compat_sys_preadv64
+535	x32	pwritev			compat_sys_pwritev64
+536	x32	rt_tgsigqueueinfo	compat_sys_rt_tgsigqueueinfo
+537	x32	recvmmsg		compat_sys_recvmmsg
+538	x32	sendmmsg		compat_sys_sendmmsg
+539	x32	process_vm_readv	compat_sys_process_vm_readv
+540	x32	process_vm_writev	compat_sys_process_vm_writev
diff --git a/arch/x86/um/sys_call_table_64.c b/arch/x86/um/sys_call_table_64.c
index fe626c3..9924776 100644
--- a/arch/x86/um/sys_call_table_64.c
+++ b/arch/x86/um/sys_call_table_64.c
@@ -35,6 +35,9 @@
 #define stub_sigaltstack sys_sigaltstack
 #define stub_rt_sigreturn sys_rt_sigreturn
 
+#define __SYSCALL_COMMON(nr, sym, compat) __SYSCALL_64(nr, sym, compat)
+#define __SYSCALL_X32(nr, sym, compat) /* Not supported */
+
 #define __SYSCALL_64(nr, sym, compat) extern asmlinkage void sym(void) ;
 #include <asm/syscalls_64.h>
 
diff --git a/arch/x86/um/user-offsets.c b/arch/x86/um/user-offsets.c
index 5edf4f4..ce7e360 100644
--- a/arch/x86/um/user-offsets.c
+++ b/arch/x86/um/user-offsets.c
@@ -15,6 +15,8 @@ static char syscalls[] = {
 };
 #else
 #define __SYSCALL_64(nr, sym, compat) [nr] = 1,
+#define __SYSCALL_COMMON(nr, sym, compat) [nr] = 1,
+#define __SYSCALL_X32(nr, sym, compat) /* Not supported */
 static char syscalls[] = {
 #include <asm/syscalls_64.h>
 };
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 18/30] x32: Generate <asm/unistd_x32.h>
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (16 preceding siblings ...)
  2012-02-20  0:07 ` [PATCH 17/30] x32: Add x32 system calls to syscall/syscall_64.tbl H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 19/30] x32: Generate <asm/unistd_64_x32.h> H. Peter Anvin
                   ` (18 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. Peter Anvin" <hpa@zytor.com>

Generate <asm/unistd_x32.h>; this exports x32 system call numbers to
user space.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/include/asm/Kbuild   |    1 +
 arch/x86/include/asm/unistd.h |    7 ++++++-
 arch/x86/syscalls/Makefile    |   10 ++++++++--
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild
index 986954f..f9c0d3b 100644
--- a/arch/x86/include/asm/Kbuild
+++ b/arch/x86/include/asm/Kbuild
@@ -25,3 +25,4 @@ header-y += vsyscall.h
 
 genhdr-y += unistd_32.h
 genhdr-y += unistd_64.h
+genhdr-y += unistd_x32.h
diff --git a/arch/x86/include/asm/unistd.h b/arch/x86/include/asm/unistd.h
index 21f77b8..dab5349 100644
--- a/arch/x86/include/asm/unistd.h
+++ b/arch/x86/include/asm/unistd.h
@@ -1,6 +1,9 @@
 #ifndef _ASM_X86_UNISTD_H
 #define _ASM_X86_UNISTD_H 1
 
+/* x32 syscall flag bit */
+#define __X32_SYSCALL_BIT	0x40000000
+
 #ifdef __KERNEL__
 # ifdef CONFIG_X86_32
 
@@ -52,8 +55,10 @@
 #else
 # ifdef __i386__
 #  include <asm/unistd_32.h>
-# else
+# elif defined(__LP64__)
 #  include <asm/unistd_64.h>
+# else
+#  include <asm/unistd_x32.h>
 # endif
 #endif
 
diff --git a/arch/x86/syscalls/Makefile b/arch/x86/syscalls/Makefile
index 89dd958..54bdbd7 100644
--- a/arch/x86/syscalls/Makefile
+++ b/arch/x86/syscalls/Makefile
@@ -11,7 +11,8 @@ systbl := $(srctree)/$(src)/syscalltbl.sh
 
 quiet_cmd_syshdr = SYSHDR  $@
       cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' $< $@ \
-		   $(syshdr_abi_$(basetarget)) $(syshdr_pfx_$(basetarget))
+		   $(syshdr_abi_$(basetarget)) $(syshdr_pfx_$(basetarget)) \
+		   $(syshdr_offset_$(basetarget))
 quiet_cmd_systbl = SYSTBL  $@
       cmd_systbl = $(CONFIG_SHELL) '$(systbl)' $< $@
 
@@ -24,6 +25,11 @@ syshdr_pfx_unistd_32_ia32 := ia32_
 $(out)/unistd_32_ia32.h: $(syscall32) $(syshdr)
 	$(call if_changed,syshdr)
 
+syshdr_abi_unistd_x32 := common,x32
+syshdr_offset_unistd_x32 := __X32_SYSCALL_BIT
+$(out)/unistd_x32.h: $(syscall64) $(syshdr)
+	$(call if_changed,syshdr)
+
 syshdr_abi_unistd_64 := common,64
 $(out)/unistd_64.h: $(syscall64) $(syshdr)
 	$(call if_changed,syshdr)
@@ -33,7 +39,7 @@ $(out)/syscalls_32.h: $(syscall32) $(systbl)
 $(out)/syscalls_64.h: $(syscall64) $(systbl)
 	$(call if_changed,systbl)
 
-syshdr-y			+= unistd_32.h unistd_64.h
+syshdr-y			+= unistd_32.h unistd_64.h unistd_x32.h
 syshdr-y			+= syscalls_32.h
 syshdr-$(CONFIG_X86_64)		+= unistd_32_ia32.h
 syshdr-$(CONFIG_X86_64)		+= syscalls_64.h
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 19/30] x32: Generate <asm/unistd_64_x32.h>
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (17 preceding siblings ...)
  2012-02-20  0:07 ` [PATCH 18/30] x32: Generate <asm/unistd_x32.h> H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 20/30] x86: Move some signal-handling definitions to a common header H. Peter Anvin
                   ` (17 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. Peter Anvin" <hpa@zytor.com>

Generate macros for the *kernel* code to use to refer to x32 system
calls.  These have an __NR_x32_ prefix and do not include
__X32_SYSCALL_BIT.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/include/asm/unistd.h |    1 +
 arch/x86/syscalls/Makefile    |    7 ++++++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/unistd.h b/arch/x86/include/asm/unistd.h
index dab5349..7a48a55 100644
--- a/arch/x86/include/asm/unistd.h
+++ b/arch/x86/include/asm/unistd.h
@@ -17,6 +17,7 @@
 # else
 
 #  include <asm/unistd_64.h>
+#  include <asm/unistd_64_x32.h>
 #  define __ARCH_WANT_COMPAT_SYS_TIME
 
 # endif
diff --git a/arch/x86/syscalls/Makefile b/arch/x86/syscalls/Makefile
index 54bdbd7..414d402 100644
--- a/arch/x86/syscalls/Makefile
+++ b/arch/x86/syscalls/Makefile
@@ -34,6 +34,11 @@ syshdr_abi_unistd_64 := common,64
 $(out)/unistd_64.h: $(syscall64) $(syshdr)
 	$(call if_changed,syshdr)
 
+syshdr_abi_unistd_64_x32 := x32
+syshdr_pfx_unistd_64_x32 := x32_
+$(out)/unistd_64_x32.h: $(syscall64) $(syshdr)
+	$(call if_changed,syshdr)
+
 $(out)/syscalls_32.h: $(syscall32) $(systbl)
 	$(call if_changed,systbl)
 $(out)/syscalls_64.h: $(syscall64) $(systbl)
@@ -41,7 +46,7 @@ $(out)/syscalls_64.h: $(syscall64) $(systbl)
 
 syshdr-y			+= unistd_32.h unistd_64.h unistd_x32.h
 syshdr-y			+= syscalls_32.h
-syshdr-$(CONFIG_X86_64)		+= unistd_32_ia32.h
+syshdr-$(CONFIG_X86_64)		+= unistd_32_ia32.h unistd_64_x32.h
 syshdr-$(CONFIG_X86_64)		+= syscalls_64.h
 
 targets	+= $(syshdr-y)
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 20/30] x86: Move some signal-handling definitions to a common header
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (18 preceding siblings ...)
  2012-02-20  0:07 ` [PATCH 19/30] x32: Generate <asm/unistd_64_x32.h> H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20  0:07 ` [PATCH 21/30] x32: Export setup/restore_sigcontext from signal.c H. Peter Anvin
                   ` (16 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. Peter Anvin" <hpa@zytor.com>

There are some definitions which are duplicated between
kernel/signal.c and ia32/ia32_signal.c; move them to a common header
file.

Rather than adding stuff to existing header files which contain data
structures, create a new header file; hence the slightly odd name
("all the good ones were taken.")

Note: nothing relied on signal_fault() being defined in
<asm/ptrace.h>.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/ia32/ia32_signal.c        |   12 ++----------
 arch/x86/include/asm/ptrace.h      |    1 -
 arch/x86/include/asm/sighandling.h |   19 +++++++++++++++++++
 arch/x86/kernel/signal.c           |   10 +---------
 4 files changed, 22 insertions(+), 20 deletions(-)
 create mode 100644 arch/x86/include/asm/sighandling.h

diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index 6557769..25d80f3 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -12,10 +12,8 @@
 #include <linux/mm.h>
 #include <linux/smp.h>
 #include <linux/kernel.h>
-#include <linux/signal.h>
 #include <linux/errno.h>
 #include <linux/wait.h>
-#include <linux/ptrace.h>
 #include <linux/unistd.h>
 #include <linux/stddef.h>
 #include <linux/personality.h>
@@ -31,16 +29,10 @@
 #include <asm/proto.h>
 #include <asm/vdso.h>
 #include <asm/sigframe.h>
+#include <asm/sighandling.h>
 #include <asm/sys_ia32.h>
 
-#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
-
-#define FIX_EFLAGS	(X86_EFLAGS_AC | X86_EFLAGS_OF | \
-			 X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \
-			 X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \
-			 X86_EFLAGS_CF)
-
-void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
+#define FIX_EFLAGS	__FIX_EFLAGS
 
 int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
 {
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 3566454..dcfde52 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -145,7 +145,6 @@ extern unsigned long
 convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs);
 extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
 			 int error_code, int si_code);
-void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
 
 extern long syscall_trace_enter(struct pt_regs *);
 extern void syscall_trace_leave(struct pt_regs *);
diff --git a/arch/x86/include/asm/sighandling.h b/arch/x86/include/asm/sighandling.h
new file mode 100644
index 0000000..843e299
--- /dev/null
+++ b/arch/x86/include/asm/sighandling.h
@@ -0,0 +1,19 @@
+#ifndef _ASM_X86_SIGHANDLING_H
+#define _ASM_X86_SIGHANDLING_H
+
+#include <linux/compiler.h>
+#include <linux/ptrace.h>
+#include <linux/signal.h>
+
+#include <asm/processor-flags.h>
+
+#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
+
+#define __FIX_EFLAGS	(X86_EFLAGS_AC | X86_EFLAGS_OF | \
+			 X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \
+			 X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \
+			 X86_EFLAGS_CF)
+
+void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
+
+#endif /* _ASM_X86_SIGHANDLING_H */
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 46a01bd..c432dc0 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -10,10 +10,8 @@
 #include <linux/mm.h>
 #include <linux/smp.h>
 #include <linux/kernel.h>
-#include <linux/signal.h>
 #include <linux/errno.h>
 #include <linux/wait.h>
-#include <linux/ptrace.h>
 #include <linux/tracehook.h>
 #include <linux/unistd.h>
 #include <linux/stddef.h>
@@ -26,6 +24,7 @@
 #include <asm/i387.h>
 #include <asm/vdso.h>
 #include <asm/mce.h>
+#include <asm/sighandling.h>
 
 #ifdef CONFIG_X86_64
 #include <asm/proto.h>
@@ -37,13 +36,6 @@
 
 #include <asm/sigframe.h>
 
-#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
-
-#define __FIX_EFLAGS	(X86_EFLAGS_AC | X86_EFLAGS_OF | \
-			 X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \
-			 X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \
-			 X86_EFLAGS_CF)
-
 #ifdef CONFIG_X86_32
 # define FIX_EFLAGS	(__FIX_EFLAGS | X86_EFLAGS_RF)
 #else
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 21/30] x32: Export setup/restore_sigcontext from signal.c
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (19 preceding siblings ...)
  2012-02-20  0:07 ` [PATCH 20/30] x86: Move some signal-handling definitions to a common header H. Peter Anvin
@ 2012-02-20  0:07 ` H. Peter Anvin
  2012-02-20  0:08 ` [PATCH 22/30] x32: Add struct ucontext_x32 H. Peter Anvin
                   ` (15 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:07 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. Peter Anvin" <hpa@zytor.com>

Export setup_sigcontext() and restore_sigcontext() from signal.c, so
we can use the 64-bit versions verbatim for x32.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/include/asm/sighandling.h |    5 +++++
 arch/x86/kernel/signal.c           |   10 ++++------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/asm/sighandling.h b/arch/x86/include/asm/sighandling.h
index 843e299..ada93b3 100644
--- a/arch/x86/include/asm/sighandling.h
+++ b/arch/x86/include/asm/sighandling.h
@@ -16,4 +16,9 @@
 
 void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
 
+int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
+		       unsigned long *pax);
+int setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
+		     struct pt_regs *regs, unsigned long mask);
+
 #endif /* _ASM_X86_SIGHANDLING_H */
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index c432dc0..450fb25 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -60,9 +60,8 @@
 	regs->seg = GET_SEG(seg) | 3;			\
 } while (0)
 
-static int
-restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
-		   unsigned long *pax)
+int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
+		       unsigned long *pax)
 {
 	void __user *buf;
 	unsigned int tmpflags;
@@ -117,9 +116,8 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
 	return err;
 }
 
-static int
-setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
-		 struct pt_regs *regs, unsigned long mask)
+int setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
+		     struct pt_regs *regs, unsigned long mask)
 {
 	int err = 0;
 
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 22/30] x32: Add struct ucontext_x32
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (20 preceding siblings ...)
  2012-02-20  0:07 ` [PATCH 21/30] x32: Export setup/restore_sigcontext from signal.c H. Peter Anvin
@ 2012-02-20  0:08 ` H. Peter Anvin
  2012-02-20  0:08 ` [PATCH 23/30] x32: Add rt_sigframe_x32 H. Peter Anvin
                   ` (14 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:08 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. J. Lu" <hjl.tools@gmail.com>

Add a definition for struct ucontext_x32; this is inherently a mix of
the 32- and 64-bit versions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/include/asm/ia32.h |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h
index 1f7e625..c6435ab 100644
--- a/arch/x86/include/asm/ia32.h
+++ b/arch/x86/include/asm/ia32.h
@@ -43,6 +43,15 @@ struct ucontext_ia32 {
 	compat_sigset_t	  uc_sigmask;	/* mask last for extensibility */
 };
 
+struct ucontext_x32 {
+	unsigned int	  uc_flags;
+	unsigned int 	  uc_link;
+	stack_ia32_t	  uc_stack;
+	unsigned int	  uc__pad0;     /* needed for alignment */
+	struct sigcontext uc_mcontext;  /* the 64-bit sigcontext type */
+	compat_sigset_t	  uc_sigmask;	/* mask last for extensibility */
+};
+
 /* This matches struct stat64 in glibc2.2, hence the absolutely
  * insane amounts of padding around dev_t's.
  */
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 23/30] x32: Add rt_sigframe_x32
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (21 preceding siblings ...)
  2012-02-20  0:08 ` [PATCH 22/30] x32: Add struct ucontext_x32 H. Peter Anvin
@ 2012-02-20  0:08 ` H. Peter Anvin
  2012-02-20  0:08 ` [PATCH 24/30] x32: Handle the x32 system call flag H. Peter Anvin
                   ` (13 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:08 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. Peter Anvin" <hpa@zytor.com>

Add rt_sigframe_x32 to <asm/sigframe.h>.  Unfortunately we can't just
define all the data structures unconditionally, due to the #ifdef
CONFIG_COMPAT in <linux/compat.h> and its trickle-down effects, hence
the #ifdef mess.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/include/asm/sigframe.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/sigframe.h b/arch/x86/include/asm/sigframe.h
index 4e0fe26..7c7c27c 100644
--- a/arch/x86/include/asm/sigframe.h
+++ b/arch/x86/include/asm/sigframe.h
@@ -59,12 +59,25 @@ struct rt_sigframe_ia32 {
 #endif /* defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION) */
 
 #ifdef CONFIG_X86_64
+
 struct rt_sigframe {
 	char __user *pretcode;
 	struct ucontext uc;
 	struct siginfo info;
 	/* fp state follows here */
 };
+
+#ifdef CONFIG_X86_X32_ABI
+
+struct rt_sigframe_x32 {
+	u64 pretcode;
+	struct ucontext_x32 uc;
+	compat_siginfo_t info;
+	/* fp state follows here */
+};
+
+#endif /* CONFIG_X86_X32_ABI */
+
 #endif /* CONFIG_X86_64 */
 
 #endif /* _ASM_X86_SIGFRAME_H */
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 24/30] x32: Handle the x32 system call flag
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (22 preceding siblings ...)
  2012-02-20  0:08 ` [PATCH 23/30] x32: Add rt_sigframe_x32 H. Peter Anvin
@ 2012-02-20  0:08 ` H. Peter Anvin
  2012-02-20  0:08 ` [PATCH 25/30] x86: Add #ifdef CONFIG_COMPAT to <asm/sys_ia32.h> H. Peter Anvin
                   ` (12 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:08 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. Peter Anvin" <hpa@zytor.com>

x32 shares most system calls with x86-64, but unfortunately some
subsystem (the input subsystem is the chief offender) which require
is_compat() when operating with a 32-bit userspace.  The input system
actually has text files in sysfs whose meaning is dependent on
sizeof(long) in userspace!

We could solve this by having two completely disjoint system call
tables; requiring that each system call be duplicated.  This patch
takes a different approach: we add a flag to the system call number;
this flag doesn't affect the system call dispatch but requests compat
treatment from affected subsystems for the duration of the system call.

The change of cmpq to cmpl is safe since it immediately follows the
and.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/include/asm/compat.h  |   13 +++++++++++--
 arch/x86/include/asm/syscall.h |    5 +++--
 arch/x86/include/asm/unistd.h  |    7 +++++++
 arch/x86/kernel/entry_64.S     |   10 ++++++++++
 4 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h
index 30d737e..7938b84 100644
--- a/arch/x86/include/asm/compat.h
+++ b/arch/x86/include/asm/compat.h
@@ -7,6 +7,7 @@
 #include <linux/types.h>
 #include <linux/sched.h>
 #include <asm/user32.h>
+#include <asm/unistd.h>
 
 #define COMPAT_USER_HZ		100
 #define COMPAT_UTS_MACHINE	"i686\0\0"
@@ -212,9 +213,17 @@ static inline void __user *arch_compat_alloc_user_space(long len)
 	return (void __user *)regs->sp - len;
 }
 
-static inline int is_compat_task(void)
+static inline bool is_compat_task(void)
 {
-	return current_thread_info()->status & TS_COMPAT;
+#ifdef CONFIG_IA32_EMULATION
+	if (current_thread_info()->status & TS_COMPAT)
+		return true;
+#endif
+#ifdef CONFIG_X86_X32_ABI
+	if (task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT)
+		return true;
+#endif
+	return false;
 }
 
 #endif /* _ASM_X86_COMPAT_H */
diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h
index d962e56..386b786 100644
--- a/arch/x86/include/asm/syscall.h
+++ b/arch/x86/include/asm/syscall.h
@@ -16,6 +16,7 @@
 #include <linux/sched.h>
 #include <linux/err.h>
 #include <asm/asm-offsets.h>	/* For NR_syscalls */
+#include <asm/unistd.h>
 
 extern const unsigned long sys_call_table[];
 
@@ -26,13 +27,13 @@ extern const unsigned long sys_call_table[];
  */
 static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
 {
-	return regs->orig_ax;
+	return regs->orig_ax & __SYSCALL_MASK;
 }
 
 static inline void syscall_rollback(struct task_struct *task,
 				    struct pt_regs *regs)
 {
-	regs->ax = regs->orig_ax;
+	regs->ax = regs->orig_ax & __SYSCALL_MASK;
 }
 
 static inline long syscall_get_error(struct task_struct *task,
diff --git a/arch/x86/include/asm/unistd.h b/arch/x86/include/asm/unistd.h
index 7a48a55..37cdc9d 100644
--- a/arch/x86/include/asm/unistd.h
+++ b/arch/x86/include/asm/unistd.h
@@ -5,6 +5,13 @@
 #define __X32_SYSCALL_BIT	0x40000000
 
 #ifdef __KERNEL__
+
+# ifdef CONFIG_X86_X32_ABI
+#  define __SYSCALL_MASK (~(__X32_SYSCALL_BIT))
+# else
+#  define __SYSCALL_MASK (~0)
+# endif
+
 # ifdef CONFIG_X86_32
 
 #  include <asm/unistd_32.h>
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 3fe8239..a17b342 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -482,7 +482,12 @@ GLOBAL(system_call_after_swapgs)
 	testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
 	jnz tracesys
 system_call_fastpath:
+#if __SYSCALL_MASK == ~0
 	cmpq $__NR_syscall_max,%rax
+#else
+	andl $__SYSCALL_MASK,%eax
+	cmpl $__NR_syscall_max,%eax
+#endif
 	ja badsys
 	movq %r10,%rcx
 	call *sys_call_table(,%rax,8)  # XXX:	 rip relative
@@ -596,7 +601,12 @@ tracesys:
 	 */
 	LOAD_ARGS ARGOFFSET, 1
 	RESTORE_REST
+#if __SYSCALL_MASK == ~0
 	cmpq $__NR_syscall_max,%rax
+#else
+	andl $__SYSCALL_MASK,%eax
+	cmpl $__NR_syscall_max,%eax
+#endif
 	ja   int_ret_from_sys_call	/* RAX(%rsp) set to -ENOSYS above */
 	movq %r10,%rcx	/* fixup for C */
 	call *sys_call_table(,%rax,8)
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 25/30] x86: Add #ifdef CONFIG_COMPAT to <asm/sys_ia32.h>
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (23 preceding siblings ...)
  2012-02-20  0:08 ` [PATCH 24/30] x32: Handle the x32 system call flag H. Peter Anvin
@ 2012-02-20  0:08 ` H. Peter Anvin
  2012-02-20  0:08 ` [PATCH 26/30] x32: Signal-related system calls H. Peter Anvin
                   ` (11 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:08 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. Peter Anvin" <hpa@zytor.com>

Unfortunately a lot of the compat types are guarded with CONFIG_COMPAT
or the equivalent, so add a similar guard to <asm/sys_ia32.h> to avoid
compilation failures when CONFIG_COMPAT=n.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/include/asm/sys_ia32.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h
index 68da87b..3fda9db4 100644
--- a/arch/x86/include/asm/sys_ia32.h
+++ b/arch/x86/include/asm/sys_ia32.h
@@ -10,6 +10,8 @@
 #ifndef _ASM_X86_SYS_IA32_H
 #define _ASM_X86_SYS_IA32_H
 
+#ifdef CONFIG_COMPAT
+
 #include <linux/compiler.h>
 #include <linux/linkage.h>
 #include <linux/types.h>
@@ -81,4 +83,7 @@ asmlinkage long sys32_ipc(u32, int, int, int, compat_uptr_t, u32);
 
 asmlinkage long sys32_fanotify_mark(int, unsigned int, u32, u32, int,
 				    const char __user *);
+
+#endif /* CONFIG_COMPAT */
+
 #endif /* _ASM_X86_SYS_IA32_H */
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 26/30] x32: Signal-related system calls
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (24 preceding siblings ...)
  2012-02-20  0:08 ` [PATCH 25/30] x86: Add #ifdef CONFIG_COMPAT to <asm/sys_ia32.h> H. Peter Anvin
@ 2012-02-20  0:08 ` H. Peter Anvin
  2012-02-20  0:08 ` [PATCH 27/30] x32: Handle process creation H. Peter Anvin
                   ` (10 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:08 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. Peter Anvin" <hpa@zytor.com>

x32 uses the 64-bit signal frame format, obviously, but there are some
structures which mixes that with pointers or sizeof(long) types, as
such we have to create a handful of system calls specific to x32.  By
and large these are a mixture of the 64-bit and the compat system
calls.

Originally-by: H. J. Lu <hjl.tools@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/kernel/entry_64.S |   19 +++++++
 arch/x86/kernel/signal.c   |  118 +++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 136 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index a17b342..53dc821 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -746,6 +746,25 @@ ENTRY(stub_rt_sigreturn)
 	CFI_ENDPROC
 END(stub_rt_sigreturn)
 
+#ifdef CONFIG_X86_X32_ABI
+	PTREGSCALL stub_x32_sigaltstack, sys32_sigaltstack, %rdx
+
+ENTRY(stub_x32_rt_sigreturn)
+	CFI_STARTPROC
+	addq $8, %rsp
+	PARTIAL_FRAME 0
+	SAVE_REST
+	movq %rsp,%rdi
+	FIXUP_TOP_OF_STACK %r11
+	call sys32_x32_rt_sigreturn
+	movq %rax,RAX(%rsp) # fixme, this could be done at the higher layer
+	RESTORE_REST
+	jmp int_ret_from_sys_call
+	CFI_ENDPROC
+END(stub_x32_rt_sigreturn)
+
+#endif
+
 /*
  * Build the entry stubs and pointer table with some assembler magic.
  * We pack 7 stubs into a single 32-byte chunk, which will fit in a
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 450fb25..c3846b6 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -29,6 +29,7 @@
 #ifdef CONFIG_X86_64
 #include <asm/proto.h>
 #include <asm/ia32_unistd.h>
+#include <asm/sys_ia32.h>
 #endif /* CONFIG_X86_64 */
 
 #include <asm/syscall.h>
@@ -632,6 +633,16 @@ static int signr_convert(int sig)
 #define is_ia32	0
 #endif /* CONFIG_IA32_EMULATION */
 
+#ifdef CONFIG_X86_X32_ABI
+#define is_x32	test_thread_flag(TIF_X32)
+
+static int x32_setup_rt_frame(int sig, struct k_sigaction *ka,
+			      siginfo_t *info, compat_sigset_t *set,
+			      struct pt_regs *regs);
+#else /* !CONFIG_X86_X32_ABI */
+#define is_x32	0
+#endif /* CONFIG_X86_X32_ABI */
+
 int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 		sigset_t *set, struct pt_regs *regs);
 int ia32_setup_frame(int sig, struct k_sigaction *ka,
@@ -656,8 +667,14 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 			ret = ia32_setup_rt_frame(usig, ka, info, set, regs);
 		else
 			ret = ia32_setup_frame(usig, ka, set, regs);
-	} else
+#ifdef CONFIG_X86_X32_ABI
+	} else if (is_x32) {
+		ret = x32_setup_rt_frame(usig, ka, info,
+					 (compat_sigset_t *)set, regs);
+#endif
+	} else {
 		ret = __setup_rt_frame(sig, ka, info, set, regs);
+	}
 
 	if (ret) {
 		force_sigsegv(sig, current);
@@ -840,3 +857,102 @@ void signal_fault(struct pt_regs *regs, void __user *frame, char *where)
 
 	force_sig(SIGSEGV, me);
 }
+
+#ifdef CONFIG_X86_X32_ABI
+static int x32_setup_rt_frame(int sig, struct k_sigaction *ka,
+			      siginfo_t *info, compat_sigset_t *set,
+			      struct pt_regs *regs)
+{
+	struct rt_sigframe_x32 __user *frame;
+	void __user *restorer;
+	int err = 0;
+	void __user *fpstate = NULL;
+
+	frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate);
+
+	if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
+		return -EFAULT;
+
+	if (ka->sa.sa_flags & SA_SIGINFO) {
+		if (copy_siginfo_to_user32(&frame->info, info))
+			return -EFAULT;
+	}
+
+	put_user_try {
+		/* Create the ucontext.  */
+		if (cpu_has_xsave)
+			put_user_ex(UC_FP_XSTATE, &frame->uc.uc_flags);
+		else
+			put_user_ex(0, &frame->uc.uc_flags);
+		put_user_ex(0, &frame->uc.uc_link);
+		put_user_ex(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
+		put_user_ex(sas_ss_flags(regs->sp),
+			    &frame->uc.uc_stack.ss_flags);
+		put_user_ex(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
+		put_user_ex(0, &frame->uc.uc__pad0);
+		err |= setup_sigcontext(&frame->uc.uc_mcontext, fpstate,
+					regs, set->sig[0]);
+		err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
+
+		if (ka->sa.sa_flags & SA_RESTORER) {
+			restorer = ka->sa.sa_restorer;
+		} else {
+			/* could use a vstub here */
+			restorer = NULL;
+			err |= -EFAULT;
+		}
+		put_user_ex(restorer, &frame->pretcode);
+	} put_user_catch(err);
+
+	if (err)
+		return -EFAULT;
+
+	/* Set up registers for signal handler */
+	regs->sp = (unsigned long) frame;
+	regs->ip = (unsigned long) ka->sa.sa_handler;
+
+	/* We use the x32 calling convention here... */
+	regs->di = sig;
+	regs->si = (unsigned long) &frame->info;
+	regs->dx = (unsigned long) &frame->uc;
+
+	loadsegment(ds, __USER_DS);
+	loadsegment(es, __USER_DS);
+
+	regs->cs = __USER_CS;
+	regs->ss = __USER_DS;
+
+	return 0;
+}
+
+asmlinkage long sys32_x32_rt_sigreturn(struct pt_regs *regs)
+{
+	struct rt_sigframe_x32 __user *frame;
+	sigset_t set;
+	unsigned long ax;
+	struct pt_regs tregs;
+
+	frame = (struct rt_sigframe_x32 __user *)(regs->sp - 8);
+
+	if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
+		goto badframe;
+	if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
+		goto badframe;
+
+	sigdelsetmask(&set, ~_BLOCKABLE);
+	set_current_blocked(&set);
+
+	if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax))
+		goto badframe;
+
+	tregs = *regs;
+	if (sys32_sigaltstack(&frame->uc.uc_stack, NULL, &tregs) == -EFAULT)
+		goto badframe;
+
+	return ax;
+
+badframe:
+	signal_fault(regs, frame, "x32 rt_sigreturn");
+	return 0;
+}
+#endif
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 27/30] x32: Handle process creation
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (25 preceding siblings ...)
  2012-02-20  0:08 ` [PATCH 26/30] x32: Signal-related system calls H. Peter Anvin
@ 2012-02-20  0:08 ` H. Peter Anvin
  2012-02-20  0:08 ` [PATCH 28/30] x32: If configured, add x32 system calls to system call tables H. Peter Anvin
                   ` (9 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:08 UTC (permalink / raw)
  To: linux-kernel, linux-arch
  Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools, Peter Zijlstra

From: "H. Peter Anvin" <hpa@zytor.com>

Allow an x32 process to be started.

Originally-by: H. J. Lu <hjl.tools@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 arch/x86/include/asm/compat.h    |   26 ++++++++++++++++++++++++--
 arch/x86/include/asm/elf.h       |   25 +++++++++++++++++++++----
 arch/x86/kernel/cpu/perf_event.c |    4 +++-
 arch/x86/kernel/entry_64.S       |   15 +++++++++++++++
 arch/x86/kernel/process_64.c     |   23 ++++++++++++++++-------
 5 files changed, 79 insertions(+), 14 deletions(-)

diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h
index 7938b84..e7f68b4 100644
--- a/arch/x86/include/asm/compat.h
+++ b/arch/x86/include/asm/compat.h
@@ -6,6 +6,7 @@
  */
 #include <linux/types.h>
 #include <linux/sched.h>
+#include <asm/processor.h>
 #include <asm/user32.h>
 #include <asm/unistd.h>
 
@@ -187,7 +188,20 @@ struct compat_shmid64_ds {
 /*
  * The type of struct elf_prstatus.pr_reg in compatible core dumps.
  */
+#ifdef CONFIG_X86_X32_ABI
+typedef struct user_regs_struct compat_elf_gregset_t;
+
+#define PR_REG_SIZE(S) (test_thread_flag(TIF_IA32) ? 68 : 216)
+#define PRSTATUS_SIZE(S) (test_thread_flag(TIF_IA32) ? 144 : 296)
+#define SET_PR_FPVALID(S,V) \
+  do { *(int *) (((void *) &((S)->pr_reg)) + PR_REG_SIZE(0)) = (V); } \
+  while (0)
+
+#define COMPAT_USE_64BIT_TIME \
+	(!!(task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT))
+#else
 typedef struct user_regs_struct32 compat_elf_gregset_t;
+#endif
 
 /*
  * A pointer passed in from user mode. This should not
@@ -209,8 +223,16 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
 
 static inline void __user *arch_compat_alloc_user_space(long len)
 {
-	struct pt_regs *regs = task_pt_regs(current);
-	return (void __user *)regs->sp - len;
+	compat_uptr_t sp;
+
+	if (test_thread_flag(TIF_IA32)) {
+		sp = task_pt_regs(current)->sp;
+	} else {
+		/* -128 for the x32 ABI redzone */
+		sp = percpu_read(old_rsp) - 128;
+	}
+
+	return (void __user *)round_down(sp - len, 16);
 }
 
 static inline bool is_compat_task(void)
diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index 410fa6a..83aabea 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -156,7 +156,12 @@ do {						\
 #define elf_check_arch(x)			\
 	((x)->e_machine == EM_X86_64)
 
-#define compat_elf_check_arch(x)	elf_check_arch_ia32(x)
+#define compat_elf_check_arch(x)		\
+	(elf_check_arch_ia32(x) || (x)->e_machine == EM_X86_64)
+
+#if __USER32_DS != __USER_DS
+# error "The following code assumes __USER32_DS == __USER_DS"
+#endif
 
 static inline void elf_common_init(struct thread_struct *t,
 				   struct pt_regs *regs, const u16 ds)
@@ -179,8 +184,9 @@ static inline void elf_common_init(struct thread_struct *t,
 void start_thread_ia32(struct pt_regs *regs, u32 new_ip, u32 new_sp);
 #define compat_start_thread start_thread_ia32
 
-void set_personality_ia32(void);
-#define COMPAT_SET_PERSONALITY(ex) set_personality_ia32()
+void set_personality_ia32(bool);
+#define COMPAT_SET_PERSONALITY(ex)			\
+	set_personality_ia32((ex).e_machine == EM_X86_64)
 
 #define COMPAT_ELF_PLATFORM			("i686")
 
@@ -296,9 +302,20 @@ do {									\
 			    (unsigned long)current->mm->context.vdso);	\
 } while (0)
 
+#define ARCH_DLINFO_X32							\
+do {									\
+	if (vdso_enabled)						\
+		NEW_AUX_ENT(AT_SYSINFO_EHDR,				\
+			    (unsigned long)current->mm->context.vdso);	\
+} while (0)
+
 #define AT_SYSINFO		32
 
-#define COMPAT_ARCH_DLINFO	ARCH_DLINFO_IA32(sysctl_vsyscall32)
+#define COMPAT_ARCH_DLINFO						\
+if (test_thread_flag(TIF_X32))						\
+	ARCH_DLINFO_X32;						\
+else									\
+	ARCH_DLINFO_IA32(sysctl_vsyscall32)
 
 #define COMPAT_ELF_ET_DYN_BASE	(TASK_UNMAPPED_BASE + 0x1000000)
 
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 5adce10..63c0e05 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -28,7 +28,6 @@
 #include <asm/apic.h>
 #include <asm/stacktrace.h>
 #include <asm/nmi.h>
-#include <asm/compat.h>
 #include <asm/smp.h>
 #include <asm/alternative.h>
 
@@ -1595,6 +1594,9 @@ perf_callchain_kernel(struct perf_callchain_entry *entry, struct pt_regs *regs)
 }
 
 #ifdef CONFIG_COMPAT
+
+#include <asm/compat.h>
+
 static inline int
 perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry *entry)
 {
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 53dc821..9e036f0 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -763,6 +763,21 @@ ENTRY(stub_x32_rt_sigreturn)
 	CFI_ENDPROC
 END(stub_x32_rt_sigreturn)
 
+ENTRY(stub_x32_execve)
+	CFI_STARTPROC
+	addq $8, %rsp
+	PARTIAL_FRAME 0
+	SAVE_REST
+	FIXUP_TOP_OF_STACK %r11
+	movq %rsp, %rcx
+	call sys32_execve
+	RESTORE_TOP_OF_STACK %r11
+	movq %rax,RAX(%rsp)
+	RESTORE_REST
+	jmp int_ret_from_sys_call
+	CFI_ENDPROC
+END(stub_x32_execve)
+
 #endif
 
 /*
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 5fe2fba..a0701da 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -364,7 +364,9 @@ start_thread(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp)
 void start_thread_ia32(struct pt_regs *regs, u32 new_ip, u32 new_sp)
 {
 	start_thread_common(regs, new_ip, new_sp,
-			    __USER32_CS, __USER32_DS, __USER32_DS);
+			    test_thread_flag(TIF_X32)
+			    ? __USER_CS : __USER32_CS,
+			    __USER_DS, __USER_DS);
 }
 #endif
 
@@ -508,6 +510,7 @@ void set_personality_64bit(void)
 
 	/* Make sure to be in 64bit mode */
 	clear_thread_flag(TIF_IA32);
+	clear_thread_flag(TIF_X32);
 	clear_thread_flag(TIF_ADDR32);
 	clear_thread_flag(TIF_X32);
 
@@ -522,22 +525,28 @@ void set_personality_64bit(void)
 	current->personality &= ~READ_IMPLIES_EXEC;
 }
 
-void set_personality_ia32(void)
+void set_personality_ia32(bool x32)
 {
 	/* inherit personality from parent */
 
 	/* Make sure to be in 32bit mode */
-	set_thread_flag(TIF_IA32);
 	set_thread_flag(TIF_ADDR32);
-	clear_thread_flag(TIF_X32);
-	current->personality |= force_personality32;
 
 	/* Mark the associated mm as containing 32-bit tasks. */
 	if (current->mm)
 		current->mm->context.ia32_compat = 1;
 
-	/* Prepare the first "return" to user space */
-	current_thread_info()->status |= TS_COMPAT;
+	if (x32) {
+		clear_thread_flag(TIF_IA32);
+		set_thread_flag(TIF_X32);
+		current->personality &= ~READ_IMPLIES_EXEC;
+	} else {
+		set_thread_flag(TIF_IA32);
+		clear_thread_flag(TIF_X32);
+		current->personality |= force_personality32;
+		/* Prepare the first "return" to user space */
+		current_thread_info()->status |= TS_COMPAT;
+	}
 }
 
 unsigned long get_wchan(struct task_struct *p)
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 28/30] x32: If configured, add x32 system calls to system call tables
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (26 preceding siblings ...)
  2012-02-20  0:08 ` [PATCH 27/30] x32: Handle process creation H. Peter Anvin
@ 2012-02-20  0:08 ` H. Peter Anvin
  2012-02-20  0:08 ` [PATCH 29/30] x32: Allow x32 to be configured H. Peter Anvin
                   ` (8 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:08 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. Peter Anvin" <hpa@zytor.com>

If CONFIG_X86_X32_ABI is defined, add the x32 system calls to the
system call tables.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/kernel/asm-offsets_64.c |    6 +++++-
 arch/x86/kernel/syscall_64.c     |    7 ++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index c3354f7..1b4754f 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
@@ -2,7 +2,11 @@
 
 #define __SYSCALL_64(nr, sym, compat) [nr] = 1,
 #define __SYSCALL_COMMON(nr, sym, compat) [nr] = 1,
-#define __SYSCALL_X32(nr, sym, compat) /* Not yet */
+#ifdef CONFIG_X86_X32_ABI
+# define __SYSCALL_X32(nr, sym, compat) [nr] = 1,
+#else
+# define __SYSCALL_X32(nr, sym, compat) /* nothing */
+#endif
 static char syscalls_64[] = {
 #include <asm/syscalls_64.h>
 };
diff --git a/arch/x86/kernel/syscall_64.c b/arch/x86/kernel/syscall_64.c
index 26c4ca1..5c7f8c2 100644
--- a/arch/x86/kernel/syscall_64.c
+++ b/arch/x86/kernel/syscall_64.c
@@ -6,7 +6,12 @@
 #include <asm/asm-offsets.h>
 
 #define __SYSCALL_COMMON(nr, sym, compat) __SYSCALL_64(nr, sym, compat)
-#define __SYSCALL_X32(nr, sym, compat) /* Not yet */
+
+#ifdef CONFIG_X86_X32_ABI
+# define __SYSCALL_X32(nr, sym, compat) __SYSCALL_64(nr, sym, compat)
+#else
+# define __SYSCALL_X32(nr, sym, compat) /* nothing */
+#endif
 
 #define __SYSCALL_64(nr, sym, compat) extern asmlinkage void sym(void) ;
 #include <asm/syscalls_64.h>
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 29/30] x32: Allow x32 to be configured
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (27 preceding siblings ...)
  2012-02-20  0:08 ` [PATCH 28/30] x32: If configured, add x32 system calls to system call tables H. Peter Anvin
@ 2012-02-20  0:08 ` H. Peter Anvin
  2012-02-20  0:08 ` [PATCH 30/30] x32: Add x32 VDSO support H. Peter Anvin
                   ` (7 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:08 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. J. Lu" <hjl.tools@gmail.com>

At this point, one should be able to build an x32 kernel.

Note that for now we depend on CONFIG_IA32_EMULATION.  Long term, x32
and IA32 should be detangled.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/Kconfig |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 5bed94e..c9d6c9e 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2165,9 +2165,9 @@ config IA32_EMULATION
 	depends on X86_64
 	select COMPAT_BINFMT_ELF
 	---help---
-	  Include code to run 32-bit programs under a 64-bit kernel. You should
-	  likely turn this on, unless you're 100% sure that you don't have any
-	  32-bit programs left.
+	  Include code to run legacy 32-bit programs under a
+	  64-bit kernel. You should likely turn this on, unless you're
+	  100% sure that you don't have any 32-bit programs left.
 
 config IA32_AOUT
 	tristate "IA32 a.out support"
@@ -2175,9 +2175,22 @@ config IA32_AOUT
 	---help---
 	  Support old a.out binaries in the 32bit emulation.
 
+config X86_X32_ABI
+	bool "x32 ABI for 64-bit mode (EXPERIMENTAL)"
+	depends on X86_64 && IA32_EMULATION && EXPERIMENTAL
+	---help---
+	  Include code to run binaries for the x32 native 32-bit ABI
+	  for 64-bit processors.  An x32 process gets access to the
+	  full 64-bit register file and wide data path while leaving
+	  pointers at 32 bits for smaller memory footprint.
+
+	  You will need a recent binutils (2.22 or later) with
+	  elf32_x86_64 support enabled to compile a kernel with this
+	  option set.
+
 config COMPAT
 	def_bool y
-	depends on IA32_EMULATION
+	depends on IA32_EMULATION || X86_X32_ABI
 
 config COMPAT_FOR_U64_ALIGNMENT
 	def_bool COMPAT
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 30/30] x32: Add x32 VDSO support
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (28 preceding siblings ...)
  2012-02-20  0:08 ` [PATCH 29/30] x32: Allow x32 to be configured H. Peter Anvin
@ 2012-02-20  0:08 ` H. Peter Anvin
  2012-02-21  0:12   ` Andy Lutomirski
  2012-02-27 22:21 ` [tip:x86/x32] x32: Warn and disable rather than error if binutils too old tip-bot for H. Peter Anvin
                   ` (6 subsequent siblings)
  36 siblings, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:08 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: mingo, tglx, hpa, torvalds, akpm, hjl.tools

From: "H. J. Lu" <hjl.tools@gmail.com>

Add support for the x32 VDSO.  The x32 VDSO takes advantage of the
similarity between the x86-64 and the x32 ABIs to contain the same
content, only the container is different, as the x32 VDSO obviously is
an x32 shared object.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/vdso/.gitignore     |    2 +
 arch/x86/vdso/Makefile       |   46 ++++++++++++++++++++++++-
 arch/x86/vdso/vdso32-setup.c |    6 +++
 arch/x86/vdso/vdsox32.S      |   22 ++++++++++++
 arch/x86/vdso/vdsox32.lds.S  |   32 +++++++++++++++++
 arch/x86/vdso/vma.c          |   78 +++++++++++++++++++++++++++++++++++++----
 6 files changed, 177 insertions(+), 9 deletions(-)
 create mode 100644 arch/x86/vdso/vdsox32.S
 create mode 100644 arch/x86/vdso/vdsox32.lds.S

diff --git a/arch/x86/vdso/.gitignore b/arch/x86/vdso/.gitignore
index 60274d5..3282874 100644
--- a/arch/x86/vdso/.gitignore
+++ b/arch/x86/vdso/.gitignore
@@ -1,5 +1,7 @@
 vdso.lds
 vdso-syms.lds
+vdsox32.lds
+vdsox32-syms.lds
 vdso32-syms.lds
 vdso32-syscall-syms.lds
 vdso32-sysenter-syms.lds
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index 5d17950..fd14be1 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -3,21 +3,29 @@
 #
 
 VDSO64-$(CONFIG_X86_64)		:= y
+VDSOX32-$(CONFIG_X86_X32_ABI)	:= y
 VDSO32-$(CONFIG_X86_32)		:= y
 VDSO32-$(CONFIG_COMPAT)		:= y
 
 vdso-install-$(VDSO64-y)	+= vdso.so
+vdso-install-$(VDSOX32-y)	+= vdsox32.so
 vdso-install-$(VDSO32-y)	+= $(vdso32-images)
 
 
 # files to link into the vdso
 vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o
 
+vobjs-$(VDSOX32-y) += $(vobjx32s-compat)
+
+# Filter out x32 objects.
+vobj64s := $(filter-out $(vobjx32s-compat),$(vobjs-y))
+
 # files to link into kernel
 obj-$(VDSO64-y)			+= vma.o vdso.o
+obj-$(VDSOX32-y)		+= vdsox32.o
 obj-$(VDSO32-y)			+= vdso32.o vdso32-setup.o
 
-vobjs := $(foreach F,$(vobjs-y),$(obj)/$F)
+vobjs := $(foreach F,$(vobj64s),$(obj)/$F)
 
 $(obj)/vdso.o: $(obj)/vdso.so
 
@@ -73,6 +81,42 @@ $(obj)/%-syms.lds: $(obj)/%.so.dbg FORCE
 	$(call if_changed,vdsosym)
 
 #
+# X32 processes use x32 vDSO to access 64bit kernel data.
+#
+# Build x32 vDSO image:
+# 1. Compile x32 vDSO as 64bit.
+# 2. Convert object files to x32.
+# 3. Build x32 VDSO image with x32 objects, which contains 64bit codes
+# so that it can reach 64bit address space with 64bit pointers.
+#
+
+targets += vdsox32-syms.lds
+obj-$(VDSOX32-y)		+= vdsox32-syms.lds
+
+CPPFLAGS_vdsox32.lds = $(CPPFLAGS_vdso.lds)
+VDSO_LDFLAGS_vdsox32.lds = -Wl,-m,elf32_x86_64 \
+			   -Wl,-soname=linux-vdso.so.1 \
+			   -Wl,-z,max-page-size=4096 \
+			   -Wl,-z,common-page-size=4096
+
+vobjx32s-y := $(vobj64s:.o=-x32.o)
+vobjx32s := $(foreach F,$(vobjx32s-y),$(obj)/$F)
+
+# Convert 64bit object file to x32 for x32 vDSO.
+quiet_cmd_x32 = X32     $@
+      cmd_x32 = $(OBJCOPY) -O elf32-x86-64 $< $@
+
+$(obj)/%-x32.o: $(obj)/%.o FORCE
+	$(call if_changed,x32)
+
+targets += vdsox32.so vdsox32.so.dbg vdsox32.lds $(vobjx32s-y)
+
+$(obj)/vdsox32.o: $(src)/vdsox32.S $(obj)/vdsox32.so
+
+$(obj)/vdsox32.so.dbg: $(src)/vdsox32.lds $(vobjx32s) FORCE
+	$(call if_changed,vdso)
+
+#
 # Build multiple 32-bit vDSO images to choose from at boot time.
 #
 obj-$(VDSO32-y)			+= vdso32-syms.lds
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index 468d591..01b8a0d 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -317,6 +317,12 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 	int ret = 0;
 	bool compat;
 
+#ifdef CONFIG_X86_X32_ABI
+	extern int x32_setup_additional_pages(struct linux_binprm *, int);
+	if (test_thread_flag(TIF_X32))
+		return x32_setup_additional_pages (bprm, uses_interp);
+#endif
+
 	if (vdso_enabled == VDSO_DISABLED)
 		return 0;
 
diff --git a/arch/x86/vdso/vdsox32.S b/arch/x86/vdso/vdsox32.S
new file mode 100644
index 0000000..d6b9a7f
--- /dev/null
+++ b/arch/x86/vdso/vdsox32.S
@@ -0,0 +1,22 @@
+#include <asm/page_types.h>
+#include <linux/linkage.h>
+#include <linux/init.h>
+
+__PAGE_ALIGNED_DATA
+
+	.globl vdsox32_start, vdsox32_end
+	.align PAGE_SIZE
+vdsox32_start:
+	.incbin "arch/x86/vdso/vdsox32.so"
+vdsox32_end:
+	.align PAGE_SIZE /* extra data here leaks to userspace. */
+
+.previous
+
+	.globl vdsox32_pages
+	.bss
+	.align 8
+	.type vdsox32_pages, @object
+vdsox32_pages:
+	.zero (vdsox32_end - vdsox32_start + PAGE_SIZE - 1) / PAGE_SIZE * 8
+	.size vdsox32_pages, .-vdsox32_pages
diff --git a/arch/x86/vdso/vdsox32.lds.S b/arch/x86/vdso/vdsox32.lds.S
new file mode 100644
index 0000000..373ca9a
--- /dev/null
+++ b/arch/x86/vdso/vdsox32.lds.S
@@ -0,0 +1,32 @@
+/*
+ * Linker script for x32 vDSO.
+ * We #include the file to define the layout details.
+ * Here we only choose the prelinked virtual address.
+ *
+ * This file defines the version script giving the user-exported symbols in
+ * the DSO.  We can define local symbols here called VDSO* to make their
+ * values visible using the asm-x86/vdso.h macros from the kernel proper.
+ */
+
+#define VDSO_PRELINK 0
+#include "vdso-layout.lds.S"
+
+/*
+ * This controls what userland symbols we export from the vDSO.
+ */
+VERSION {
+	LINUX_2.6 {
+	global:
+		clock_gettime;
+		__vdso_clock_gettime;
+		gettimeofday;
+		__vdso_gettimeofday;
+		getcpu;
+		__vdso_getcpu;
+		time;
+		__vdso_time;
+	local: *;
+	};
+}
+
+VDSOX32_PRELINK = VDSO_PRELINK;
diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c
index 153407c..1bbcc62 100644
--- a/arch/x86/vdso/vma.c
+++ b/arch/x86/vdso/vma.c
@@ -24,7 +24,44 @@ extern unsigned short vdso_sync_cpuid;
 extern struct page *vdso_pages[];
 static unsigned vdso_size;
 
-static void __init patch_vdso(void *vdso, size_t len)
+#ifdef CONFIG_X86_X32_ABI
+extern char vdsox32_start[], vdsox32_end[];
+extern struct page *vdsox32_pages[];
+static unsigned vdsox32_size;
+
+static void __init patch_vdsox32(void *vdso, size_t len)
+{
+	Elf32_Ehdr *hdr = vdso;
+	Elf32_Shdr *sechdrs, *alt_sec = 0;
+	char *secstrings;
+	void *alt_data;
+	int i;
+
+	BUG_ON(len < sizeof(Elf32_Ehdr));
+	BUG_ON(memcmp(hdr->e_ident, ELFMAG, SELFMAG) != 0);
+
+	sechdrs = (void *)hdr + hdr->e_shoff;
+	secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
+
+	for (i = 1; i < hdr->e_shnum; i++) {
+		Elf32_Shdr *shdr = &sechdrs[i];
+		if (!strcmp(secstrings + shdr->sh_name, ".altinstructions")) {
+			alt_sec = shdr;
+			goto found;
+		}
+	}
+
+	/* If we get here, it's probably a bug. */
+	pr_warning("patch_vdsox32: .altinstructions not found\n");
+	return;  /* nothing to patch */
+
+found:
+	alt_data = (void *)hdr + alt_sec->sh_offset;
+	apply_alternatives(alt_data, alt_data + alt_sec->sh_size);
+}
+#endif
+
+static void __init patch_vdso64(void *vdso, size_t len)
 {
 	Elf64_Ehdr *hdr = vdso;
 	Elf64_Shdr *sechdrs, *alt_sec = 0;
@@ -47,7 +84,7 @@ static void __init patch_vdso(void *vdso, size_t len)
 	}
 
 	/* If we get here, it's probably a bug. */
-	pr_warning("patch_vdso: .altinstructions not found\n");
+	pr_warning("patch_vdso64: .altinstructions not found\n");
 	return;  /* nothing to patch */
 
 found:
@@ -60,12 +97,20 @@ static int __init init_vdso(void)
 	int npages = (vdso_end - vdso_start + PAGE_SIZE - 1) / PAGE_SIZE;
 	int i;
 
-	patch_vdso(vdso_start, vdso_end - vdso_start);
+	patch_vdso64(vdso_start, vdso_end - vdso_start);
 
 	vdso_size = npages << PAGE_SHIFT;
 	for (i = 0; i < npages; i++)
 		vdso_pages[i] = virt_to_page(vdso_start + i*PAGE_SIZE);
 
+#ifdef CONFIG_X86_X32_ABI
+	patch_vdsox32(vdsox32_start, vdsox32_end - vdsox32_start);
+	npages = (vdsox32_end - vdsox32_start + PAGE_SIZE - 1) / PAGE_SIZE;
+	vdsox32_size = npages << PAGE_SHIFT;
+	for (i = 0; i < npages; i++)
+		vdsox32_pages[i] = virt_to_page(vdsox32_start + i*PAGE_SIZE);
+#endif
+
 	return 0;
 }
 subsys_initcall(init_vdso);
@@ -103,7 +148,10 @@ static unsigned long vdso_addr(unsigned long start, unsigned len)
 
 /* Setup a VMA at program startup for the vsyscall page.
    Not called for compat tasks */
-int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
+static int setup_additional_pages(struct linux_binprm *bprm,
+				  int uses_interp,
+				  struct page **pages,
+				  unsigned size)
 {
 	struct mm_struct *mm = current->mm;
 	unsigned long addr;
@@ -113,8 +161,8 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 		return 0;
 
 	down_write(&mm->mmap_sem);
-	addr = vdso_addr(mm->start_stack, vdso_size);
-	addr = get_unmapped_area(NULL, addr, vdso_size, 0, 0);
+	addr = vdso_addr(mm->start_stack, size);
+	addr = get_unmapped_area(NULL, addr, size, 0, 0);
 	if (IS_ERR_VALUE(addr)) {
 		ret = addr;
 		goto up_fail;
@@ -122,11 +170,11 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 
 	current->mm->context.vdso = (void *)addr;
 
-	ret = install_special_mapping(mm, addr, vdso_size,
+	ret = install_special_mapping(mm, addr, size,
 				      VM_READ|VM_EXEC|
 				      VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
 				      VM_ALWAYSDUMP,
-				      vdso_pages);
+				      pages);
 	if (ret) {
 		current->mm->context.vdso = NULL;
 		goto up_fail;
@@ -137,6 +185,20 @@ up_fail:
 	return ret;
 }
 
+int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
+{
+	return setup_additional_pages (bprm, uses_interp, vdso_pages,
+				       vdso_size);
+}
+
+#ifdef CONFIG_X86_X32_ABI
+int x32_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
+{
+	return setup_additional_pages (bprm, uses_interp, vdsox32_pages,
+				       vdsox32_size);
+}
+#endif
+
 static __init int vdso_setup(char *s)
 {
 	vdso_enabled = simple_strtoul(s, NULL, 0);
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* Re: [PATCH 02/30] x86-64: Use explicit sizes in sigcontext.h, prepare for x32
  2012-02-20  0:07 ` [PATCH 02/30] x86-64: Use explicit sizes in sigcontext.h, prepare for x32 H. Peter Anvin
@ 2012-02-20  0:51   ` Linus Torvalds
  2012-02-20  0:56     ` H. Peter Anvin
  0 siblings, 1 reply; 106+ messages in thread
From: Linus Torvalds @ 2012-02-20  0:51 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: linux-kernel, linux-arch, mingo, tglx, akpm, hjl.tools

On Sun, Feb 19, 2012 at 4:07 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>
> Use explicit sizes (__u64) instead of implicit sizes (unsigned long)
> in the definition for sigcontext.h; this will allow this structure to
> be shared between the x86-64 native ABI and the x32 ABI.

Btw, since we had this issue just with autofs: what are the x32 ABI
alignment issues for __u64? Are they like x86-64 ("natural alignment")
or x86-32 ("4-byte alignment")?

I assume they are natural alignment, and as pointed out by Davem, we
do have the versions of u64 that make this explicit: "compat_u64" is
the 4-byte-aligned one, while "__aligned_u64" is the natively aligned
one.

Just plain "__u64" doesn't tell which it is, which is sad and wrong,
but we're likely stuck with it forever. Unless some shining knight
comes and says "__u64 is native alignment, and if you want anything
else, you need to use __compat_u64", and actually fixes the cases
where x86-32 depends on the 4-byte aligned one.

Which would be nice, but sounds unlikely. Shining knights tend to be
rare. But this *could* possibly be automated, so it's not entirely out
of the question.

                 Linus

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 02/30] x86-64: Use explicit sizes in sigcontext.h, prepare for x32
  2012-02-20  0:51   ` Linus Torvalds
@ 2012-02-20  0:56     ` H. Peter Anvin
  2012-02-22 12:22       ` Arnd Bergmann
  0 siblings, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:56 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, linux-arch, mingo, tglx, akpm, hjl.tools

On 02/19/2012 04:51 PM, Linus Torvalds wrote:
> On Sun, Feb 19, 2012 at 4:07 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>>
>> Use explicit sizes (__u64) instead of implicit sizes (unsigned long)
>> in the definition for sigcontext.h; this will allow this structure to
>> be shared between the x86-64 native ABI and the x32 ABI.
> 
> Btw, since we had this issue just with autofs: what are the x32 ABI
> alignment issues for __u64? Are they like x86-64 ("natural alignment")
> or x86-32 ("4-byte alignment")?
> 
> I assume they are natural alignment, and as pointed out by Davem, we
> do have the versions of u64 that make this explicit: "compat_u64" is
> the 4-byte-aligned one, while "__aligned_u64" is the natively aligned
> one.
> 
> Just plain "__u64" doesn't tell which it is, which is sad and wrong,
> but we're likely stuck with it forever. Unless some shining knight
> comes and says "__u64 is native alignment, and if you want anything
> else, you need to use __compat_u64", and actually fixes the cases
> where x86-32 depends on the 4-byte aligned one.
> 
> Which would be nice, but sounds unlikely. Shining knights tend to be
> rare. But this *could* possibly be automated, so it's not entirely out
> of the question.
> 

We are using __u64 as x86-32 compatible since we are sharing most of the
really complex path (like ioctl) with i386 much more so than x86-64.  So
it is defined in userspace as:

typedef unsigned long long __u64 __attribute__((aligned(4)));

__aligned_u64 obviously is naturally aligned, which matches uint64_t is
userspace.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 08/30] compat: Use COMPAT_USE_64BIT_TIME in the lp driver
  2012-02-20  0:07 ` [PATCH 08/30] compat: Use COMPAT_USE_64BIT_TIME in the lp driver H. Peter Anvin
@ 2012-02-20  0:56   ` Linus Torvalds
  2012-02-20  0:59     ` H. Peter Anvin
  2012-02-20  2:22     ` [PATCH 0/7] COMPAT_USE_64BIT_TIME v2 H. Peter Anvin
  0 siblings, 2 replies; 106+ messages in thread
From: Linus Torvalds @ 2012-02-20  0:56 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: linux-kernel, linux-arch, mingo, tglx, akpm, hjl.tools,
	Arnd Bergmann, Greg Kroah-Hartman

On Sun, Feb 19, 2012 at 4:07 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> From: "H. J. Lu" <hjl.tools@gmail.com>
>
> Enable the lp driver to be used with a compat ABI with 64-bit time.

Ugh. Is this really the only case?

Because if it isn't, I suspect it would be much better off with a
helper function. In fact, even if this *does* end up being the only
place, a helper function to get/set a timeval from user space sounds
like a good idea, and makes things much more readable than that
ad-hoccery in the middle of code.

IOW, I'd like to see something like

   get_user_timeval(void __user *tv, struct timeval *res)

even if it would be only local to this file.

                   Linus

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 08/30] compat: Use COMPAT_USE_64BIT_TIME in the lp driver
  2012-02-20  0:56   ` Linus Torvalds
@ 2012-02-20  0:59     ` H. Peter Anvin
  2012-02-20  2:22     ` [PATCH 0/7] COMPAT_USE_64BIT_TIME v2 H. Peter Anvin
  1 sibling, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  0:59 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, linux-arch, mingo, tglx, akpm, hjl.tools,
	Arnd Bergmann, Greg Kroah-Hartman

On 02/19/2012 04:56 PM, Linus Torvalds wrote:
> On Sun, Feb 19, 2012 at 4:07 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>> From: "H. J. Lu" <hjl.tools@gmail.com>
>>
>> Enable the lp driver to be used with a compat ABI with 64-bit time.
> 
> Ugh. Is this really the only case?
> 

No, it's not the only case, and a helper function is a great idea.

	-hpa


-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 106+ messages in thread

* [PATCH 0/7] COMPAT_USE_64BIT_TIME v2
  2012-02-20  0:56   ` Linus Torvalds
  2012-02-20  0:59     ` H. Peter Anvin
@ 2012-02-20  2:22     ` H. Peter Anvin
  2012-02-20  2:22       ` [PATCH 1/7] compat: Introduce COMPAT_USE_64BIT_TIME H. Peter Anvin
                         ` (7 more replies)
  1 sibling, 8 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  2:22 UTC (permalink / raw)
  To: linux-kernel, linux-arch
  Cc: mingo, tglx, torvalds, akpm, davem, hjl.tools, Arnd Bergmann,
	Greg Kroah-Hartman, H. Peter Anvin

From: "H. Peter Anvin" <hpa@zytor.com>

This is a respin of the COMPAT_USE_64BIT_TIME bits of the x32
patchset.  It replaces patches 07/30-10/30 out of that patchset.

The differences in this respin are:

1. Use helper functions as suggested by Linus, and
2. Add support in the networking stack (this bit got inadvertently
   left out of the previous patchset.)

Linus, is this more what you were looking for?

This is the diffstat for this set:

 drivers/char/lp.c            |    5 +--
 drivers/input/input-compat.c |    4 +-
 drivers/input/input-compat.h |    2 +-
 include/linux/compat.h       |   20 ++++++++++++
 kernel/compat.c              |   70 +++++++++++++++++++++++++++++++++++++-----
 net/bluetooth/hci_sock.c     |    3 +-
 net/compat.c                 |   65 ++++++++++++++++++++++++---------------
 net/socket.c                 |   18 +++++------
 8 files changed, 136 insertions(+), 51 deletions(-)

^ permalink raw reply	[flat|nested] 106+ messages in thread

* [PATCH 1/7] compat: Introduce COMPAT_USE_64BIT_TIME
  2012-02-20  2:22     ` [PATCH 0/7] COMPAT_USE_64BIT_TIME v2 H. Peter Anvin
@ 2012-02-20  2:22       ` H. Peter Anvin
  2012-02-20  2:22       ` [PATCH 2/7] compat: Add helper functions to read/write struct timeval, timespec H. Peter Anvin
                         ` (6 subsequent siblings)
  7 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  2:22 UTC (permalink / raw)
  To: linux-kernel, linux-arch
  Cc: mingo, tglx, torvalds, akpm, davem, hjl.tools, Arnd Bergmann,
	Greg Kroah-Hartman, H. Peter Anvin

From: "H. J. Lu" <hjl.tools@gmail.com>

Allow a compatibility ABI to use a 64-bit time_t and 64-bit members in
struct timeval and struct timespec to avoid the Y2038 problem.

This will be used for the x32 ABI.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 include/linux/compat.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/linux/compat.h b/include/linux/compat.h
index 41c9f65..1be91c0 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -19,6 +19,10 @@
 #include <asm/siginfo.h>
 #include <asm/signal.h>
 
+#ifndef COMPAT_USE_64BIT_TIME
+#define COMPAT_USE_64BIT_TIME 0
+#endif
+
 #define compat_jiffies_to_clock_t(x)	\
 		(((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
 
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 2/7] compat: Add helper functions to read/write struct timeval, timespec
  2012-02-20  2:22     ` [PATCH 0/7] COMPAT_USE_64BIT_TIME v2 H. Peter Anvin
  2012-02-20  2:22       ` [PATCH 1/7] compat: Introduce COMPAT_USE_64BIT_TIME H. Peter Anvin
@ 2012-02-20  2:22       ` H. Peter Anvin
  2012-02-20  2:22       ` [PATCH 3/7] compat: Handle COMPAT_USE_64BIT_TIME in the lp driver H. Peter Anvin
                         ` (5 subsequent siblings)
  7 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  2:22 UTC (permalink / raw)
  To: linux-kernel, linux-arch
  Cc: mingo, tglx, torvalds, akpm, davem, hjl.tools, Arnd Bergmann,
	Greg Kroah-Hartman, H. Peter Anvin

From: "H. Peter Anvin" <hpa@zytor.com>

Add helper functions to read and write struct timeval and struct
timespec from userspace.  We already had helper functions for reading
and writing struct compat_timespec; add a set of functions to do the
same with struct timeval, and add a second suite of functions which
can be sensitive to COMPAT_USE_64BIT_TIME and access either 32- or
64-bit time structures.

This also exports these helper functions to modules.

Rename the existing inlines for converting between struct
compat_timeval and native struct timespec so we can have a saner
naming convention for the exported functions.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 include/linux/compat.h |   16 +++++++++++
 kernel/compat.c        |   70 ++++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 78 insertions(+), 8 deletions(-)

diff --git a/include/linux/compat.h b/include/linux/compat.h
index 1be91c0..a82e452 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -87,10 +87,26 @@ typedef struct {
 	compat_sigset_word	sig[_COMPAT_NSIG_WORDS];
 } compat_sigset_t;
 
+/*
+ * These functions operate strictly on struct compat_time*
+ */
 extern int get_compat_timespec(struct timespec *,
 			       const struct compat_timespec __user *);
 extern int put_compat_timespec(const struct timespec *,
 			       struct compat_timespec __user *);
+extern int get_compat_timeval(struct timeval *,
+			      const struct compat_timeval __user *);
+extern int put_compat_timeval(const struct timeval *,
+			      struct compat_timeval __user *);
+/*
+ * These functions operate on 32- or 64-bit specs depending on
+ * COMPAT_USE_64BIT_TIME, hence the void user pointer arguments and the
+ * naming as compat_get/put_ rather than get/put_compat_.
+ */
+extern int compat_get_timespec(struct timespec *, const void __user *);
+extern int compat_put_timespec(const struct timespec *, void __user *);
+extern int compat_get_timeval(struct timeval *, const void __user *);
+extern int compat_put_timeval(const struct timeval *, void __user *);
 
 struct compat_iovec {
 	compat_uptr_t	iov_base;
diff --git a/kernel/compat.c b/kernel/compat.c
index f346ced..1743d67 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -31,11 +31,10 @@
 #include <asm/uaccess.h>
 
 /*
- * Note that the native side is already converted to a timespec, because
- * that's what we want anyway.
+ * Get/set struct timeval with struct timespec on the native side
  */
-static int compat_get_timeval(struct timespec *o,
-		struct compat_timeval __user *i)
+static int compat_get_timeval_convert(struct timespec *o,
+				      struct compat_timeval __user *i)
 {
 	long usec;
 
@@ -46,8 +45,8 @@ static int compat_get_timeval(struct timespec *o,
 	return 0;
 }
 
-static int compat_put_timeval(struct compat_timeval __user *o,
-		struct timeval *i)
+static int compat_put_timeval_convert(struct compat_timeval __user *o,
+				      struct timeval *i)
 {
 	return (put_user(i->tv_sec, &o->tv_sec) ||
 		put_user(i->tv_usec, &o->tv_usec)) ? -EFAULT : 0;
@@ -117,7 +116,7 @@ asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv,
 	if (tv) {
 		struct timeval ktv;
 		do_gettimeofday(&ktv);
-		if (compat_put_timeval(tv, &ktv))
+		if (compat_put_timeval_convert(tv, &ktv))
 			return -EFAULT;
 	}
 	if (tz) {
@@ -135,7 +134,7 @@ asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv,
 	struct timezone ktz;
 
 	if (tv) {
-		if (compat_get_timeval(&kts, tv))
+		if (compat_get_timeval_convert(&kts, tv))
 			return -EFAULT;
 	}
 	if (tz) {
@@ -146,12 +145,29 @@ asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv,
 	return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
 }
 
+int get_compat_timeval(struct timeval *tv, const struct compat_timeval __user *ctv)
+{
+	return (!access_ok(VERIFY_READ, ctv, sizeof(*ctv)) ||
+			__get_user(tv->tv_sec, &ctv->tv_sec) ||
+			__get_user(tv->tv_usec, &ctv->tv_usec)) ? -EFAULT : 0;
+}
+EXPORT_SYMBOL_GPL(get_compat_timeval);
+
+int put_compat_timeval(const struct timeval *tv, struct compat_timespec __user *ctv)
+{
+	return (!access_ok(VERIFY_WRITE, ctv, sizeof(*ctv)) ||
+			__put_user(tv->tv_sec, &ctv->tv_sec) ||
+			__put_user(tv->tv_usec, &ctv->tv_usec)) ? -EFAULT : 0;
+}
+EXPORT_SYMBOL_GPL(put_compat_timeval);
+
 int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts)
 {
 	return (!access_ok(VERIFY_READ, cts, sizeof(*cts)) ||
 			__get_user(ts->tv_sec, &cts->tv_sec) ||
 			__get_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0;
 }
+EXPORT_SYMBOL_GPL(get_compat_timespec);
 
 int put_compat_timespec(const struct timespec *ts, struct compat_timespec __user *cts)
 {
@@ -161,6 +177,42 @@ int put_compat_timespec(const struct timespec *ts, struct compat_timespec __user
 }
 EXPORT_SYMBOL_GPL(put_compat_timespec);
 
+int compat_get_timeval(struct timeval *tv, const void __user *utv)
+{
+	if (COMPAT_USE_64BIT_TIME)
+		return get_user(tv, (const struct timeval __user *)utv);
+	else
+		return get_compat_timeval(tv, utv);
+}
+EXPORT_SYMBOL_GPL(compat_get_timeval);
+
+int compat_put_timeval(const struct timeval *tv, void __user *utv)
+{
+	if (COMPAT_USE_64BIT_TIME)
+		return put_user(tv, (struct timeval __user *)utv);
+	else
+		return put_compat_timeval(tv, utv);
+}
+EXPORT_SYMBOL_GPL(compat_put_timeval);
+
+int compat_get_timespec(struct timespec *ts, const void __user *uts)
+{
+	if (COMPAT_USE_64BIT_TIME)
+		return get_user(ts, (const struct timespec __user *)uts);
+	else
+		return get_compat_timespec(ts, uts);
+}
+EXPORT_SYMBOL_GPL(compat_get_timespec);
+
+int compat_put_timespec(const struct timespec *ts, void __user *uts)
+{
+	if (COMPAT_USE_64BIT_TIME)
+		return put_user(tv, (struct timeval __user *)ctv);
+	else
+		return put_compat_timespec(ts, uts);
+}
+EXPORT_SYMBOL_GPL(compat_put_timespec);
+
 static long compat_nanosleep_restart(struct restart_block *restart)
 {
 	struct compat_timespec __user *rmtp;
@@ -1162,3 +1214,5 @@ void __user *compat_alloc_user_space(unsigned long len)
 	return ptr;
 }
 EXPORT_SYMBOL_GPL(compat_alloc_user_space);
+
+/*
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 3/7] compat: Handle COMPAT_USE_64BIT_TIME in the lp driver
  2012-02-20  2:22     ` [PATCH 0/7] COMPAT_USE_64BIT_TIME v2 H. Peter Anvin
  2012-02-20  2:22       ` [PATCH 1/7] compat: Introduce COMPAT_USE_64BIT_TIME H. Peter Anvin
  2012-02-20  2:22       ` [PATCH 2/7] compat: Add helper functions to read/write struct timeval, timespec H. Peter Anvin
@ 2012-02-20  2:22       ` H. Peter Anvin
  2012-02-20  2:22       ` [PATCH 4/7] compat: Use COMPAT_USE_64BIT_TIME in the input subsystem H. Peter Anvin
                         ` (4 subsequent siblings)
  7 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  2:22 UTC (permalink / raw)
  To: linux-kernel, linux-arch
  Cc: mingo, tglx, torvalds, akpm, davem, hjl.tools, Arnd Bergmann,
	Greg Kroah-Hartman, H. Peter Anvin

From: "H. Peter Anvin" <hpa@zytor.com>

Enable the lp driver to be used with a compat ABI with 64-bit time.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <greg@kroah.com>
---
 drivers/char/lp.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index f434856..64f5aeb 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -706,16 +706,13 @@ static long lp_compat_ioctl(struct file *file, unsigned int cmd,
 {
 	unsigned int minor;
 	struct timeval par_timeout;
-	struct compat_timeval __user *tc;
 	int ret;
 
 	minor = iminor(file->f_path.dentry->d_inode);
 	mutex_lock(&lp_mutex);
 	switch (cmd) {
 	case LPSETTIMEOUT:
-		tc = compat_ptr(arg);
-		if (get_user(par_timeout.tv_sec, &tc->tv_sec) ||
-		    get_user(par_timeout.tv_usec, &tc->tv_usec)) {
+		if (compat_get_timeval(par_timeout, compat_ptr(arg))) {
 			ret = -EFAULT;
 			break;
 		}
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 4/7] compat: Use COMPAT_USE_64BIT_TIME in the input subsystem
  2012-02-20  2:22     ` [PATCH 0/7] COMPAT_USE_64BIT_TIME v2 H. Peter Anvin
                         ` (2 preceding siblings ...)
  2012-02-20  2:22       ` [PATCH 3/7] compat: Handle COMPAT_USE_64BIT_TIME in the lp driver H. Peter Anvin
@ 2012-02-20  2:22       ` H. Peter Anvin
  2012-02-20  2:22       ` [PATCH 5/7] compat: Use COMPAT_USE_64BIT_TIME in the Bluetooth subsystem H. Peter Anvin
                         ` (3 subsequent siblings)
  7 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  2:22 UTC (permalink / raw)
  To: linux-kernel, linux-arch
  Cc: mingo, tglx, torvalds, akpm, davem, hjl.tools, Arnd Bergmann,
	Greg Kroah-Hartman, H. Peter Anvin, Dmitry Torokhov

From: "H. J. Lu" <hjl.tools@gmail.com>

Enable the input system to be used with a compat ABI with 64-bit time.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/input-compat.c |    4 ++--
 drivers/input/input-compat.h |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/input/input-compat.c b/drivers/input/input-compat.c
index e46a867..64ca711 100644
--- a/drivers/input/input-compat.c
+++ b/drivers/input/input-compat.c
@@ -17,7 +17,7 @@
 int input_event_from_user(const char __user *buffer,
 			  struct input_event *event)
 {
-	if (INPUT_COMPAT_TEST) {
+	if (INPUT_COMPAT_TEST && !COMPAT_USE_64BIT_TIME) {
 		struct input_event_compat compat_event;
 
 		if (copy_from_user(&compat_event, buffer,
@@ -41,7 +41,7 @@ int input_event_from_user(const char __user *buffer,
 int input_event_to_user(char __user *buffer,
 			const struct input_event *event)
 {
-	if (INPUT_COMPAT_TEST) {
+	if (INPUT_COMPAT_TEST && !COMPAT_USE_64BIT_TIME) {
 		struct input_event_compat compat_event;
 
 		compat_event.time.tv_sec = event->time.tv_sec;
diff --git a/drivers/input/input-compat.h b/drivers/input/input-compat.h
index 22be27b..148f66f 100644
--- a/drivers/input/input-compat.h
+++ b/drivers/input/input-compat.h
@@ -67,7 +67,7 @@ struct ff_effect_compat {
 
 static inline size_t input_event_size(void)
 {
-	return INPUT_COMPAT_TEST ?
+	return (INPUT_COMPAT_TEST && !COMPAT_USE_64BIT_TIME) ?
 		sizeof(struct input_event_compat) : sizeof(struct input_event);
 }
 
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 5/7] compat: Use COMPAT_USE_64BIT_TIME in the Bluetooth subsystem
  2012-02-20  2:22     ` [PATCH 0/7] COMPAT_USE_64BIT_TIME v2 H. Peter Anvin
                         ` (3 preceding siblings ...)
  2012-02-20  2:22       ` [PATCH 4/7] compat: Use COMPAT_USE_64BIT_TIME in the input subsystem H. Peter Anvin
@ 2012-02-20  2:22       ` H. Peter Anvin
  2012-02-20  2:22       ` [PATCH 6/7] compat: Use COMPAT_USE_64BIT_TIME in net/compat.c H. Peter Anvin
                         ` (2 subsequent siblings)
  7 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  2:22 UTC (permalink / raw)
  To: linux-kernel, linux-arch
  Cc: mingo, tglx, torvalds, akpm, davem, hjl.tools, Arnd Bergmann,
	Greg Kroah-Hartman, H. Peter Anvin, Marcel Holtmann,
	Gustavo F. Padovan

From: "H. J. Lu" <hjl.tools@gmail.com>

Enable the Bluetooth subsystem to be used with a compat ABI with
64-bit time.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Gustavo F. Padovan <padovan@profusion.mobi>
Cc: David S. Miller <davem@davemloft.net>
---
 net/bluetooth/hci_sock.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 0dcc962..b2eb2b9 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -418,7 +418,8 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_
 		data = &tv;
 		len = sizeof(tv);
 #ifdef CONFIG_COMPAT
-		if (msg->msg_flags & MSG_CMSG_COMPAT) {
+		if (!COMPAT_USE_64BIT_TIME &&
+		    (msg->msg_flags & MSG_CMSG_COMPAT)) {
 			ctv.tv_sec = tv.tv_sec;
 			ctv.tv_usec = tv.tv_usec;
 			data = &ctv;
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 6/7] compat: Use COMPAT_USE_64BIT_TIME in net/compat.c
  2012-02-20  2:22     ` [PATCH 0/7] COMPAT_USE_64BIT_TIME v2 H. Peter Anvin
                         ` (4 preceding siblings ...)
  2012-02-20  2:22       ` [PATCH 5/7] compat: Use COMPAT_USE_64BIT_TIME in the Bluetooth subsystem H. Peter Anvin
@ 2012-02-20  2:22       ` H. Peter Anvin
  2012-02-20  2:22       ` [PATCH 7/7] compat: Handle COMPAT_USE_64BIT_TIME in net/socket.c H. Peter Anvin
  2012-02-20  2:42       ` [PATCH 0/7] COMPAT_USE_64BIT_TIME v2 H. Peter Anvin
  7 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  2:22 UTC (permalink / raw)
  To: linux-kernel, linux-arch
  Cc: mingo, tglx, torvalds, akpm, davem, hjl.tools, Arnd Bergmann,
	Greg Kroah-Hartman, H. Peter Anvin

From: "H. J. Lu" <hjl.tools@gmail.com>

Handle 64-bit time structures in the networking core compat code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: David S. Miller <davem@davemloft.net>
---
 net/compat.c |   65 +++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 40 insertions(+), 25 deletions(-)

diff --git a/net/compat.c b/net/compat.c
index 6def90e..73bf0e0 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -219,8 +219,6 @@ Efault:
 
 int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *data)
 {
-	struct compat_timeval ctv;
-	struct compat_timespec cts[3];
 	struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control;
 	struct compat_cmsghdr cmhdr;
 	int cmlen;
@@ -230,24 +228,28 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *dat
 		return 0; /* XXX: return error? check spec. */
 	}
 
-	if (level == SOL_SOCKET && type == SCM_TIMESTAMP) {
-		struct timeval *tv = (struct timeval *)data;
-		ctv.tv_sec = tv->tv_sec;
-		ctv.tv_usec = tv->tv_usec;
-		data = &ctv;
-		len = sizeof(ctv);
-	}
-	if (level == SOL_SOCKET &&
-	    (type == SCM_TIMESTAMPNS || type == SCM_TIMESTAMPING)) {
-		int count = type == SCM_TIMESTAMPNS ? 1 : 3;
-		int i;
-		struct timespec *ts = (struct timespec *)data;
-		for (i = 0; i < count; i++) {
-			cts[i].tv_sec = ts[i].tv_sec;
-			cts[i].tv_nsec = ts[i].tv_nsec;
+	if (!COMPAT_USE_64BIT_TIME) {
+		struct compat_timeval ctv;
+		struct compat_timespec cts[3];
+		if (level == SOL_SOCKET && type == SCM_TIMESTAMP) {
+			struct timeval *tv = (struct timeval *)data;
+			ctv.tv_sec = tv->tv_sec;
+			ctv.tv_usec = tv->tv_usec;
+			data = &ctv;
+			len = sizeof(ctv);
+		}
+		if (level == SOL_SOCKET &&
+		    (type == SCM_TIMESTAMPNS || type == SCM_TIMESTAMPING)) {
+			int count = type == SCM_TIMESTAMPNS ? 1 : 3;
+			int i;
+			struct timespec *ts = (struct timespec *)data;
+			for (i = 0; i < count; i++) {
+				cts[i].tv_sec = ts[i].tv_sec;
+				cts[i].tv_nsec = ts[i].tv_nsec;
+			}
+			data = &cts;
+			len = sizeof(cts[0]) * count;
 		}
-		data = &cts;
-		len = sizeof(cts[0]) * count;
 	}
 
 	cmlen = CMSG_COMPAT_LEN(len);
@@ -454,11 +456,15 @@ static int compat_sock_getsockopt(struct socket *sock, int level, int optname,
 
 int compat_sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp)
 {
-	struct compat_timeval __user *ctv =
-			(struct compat_timeval __user *) userstamp;
-	int err = -ENOENT;
+	struct compat_timeval __user *ctv;
+	int err;
 	struct timeval tv;
 
+	if (COMPAT_USE_64BIT_TIME)
+		return sock_get_timestamp(sk, userstamp);
+
+	ctv = (struct compat_timeval __user *) userstamp;
+	err = -ENOENT;
 	if (!sock_flag(sk, SOCK_TIMESTAMP))
 		sock_enable_timestamp(sk, SOCK_TIMESTAMP);
 	tv = ktime_to_timeval(sk->sk_stamp);
@@ -478,11 +484,15 @@ EXPORT_SYMBOL(compat_sock_get_timestamp);
 
 int compat_sock_get_timestampns(struct sock *sk, struct timespec __user *userstamp)
 {
-	struct compat_timespec __user *ctv =
-			(struct compat_timespec __user *) userstamp;
-	int err = -ENOENT;
+	struct compat_timespec __user *ctv;
+	int err;
 	struct timespec ts;
 
+	if (COMPAT_USE_64BIT_TIME)
+		return sock_get_timestampns (sk, userstamp);
+
+	ctv = (struct compat_timespec __user *) userstamp;
+	err = -ENOENT;
 	if (!sock_flag(sk, SOCK_TIMESTAMP))
 		sock_enable_timestamp(sk, SOCK_TIMESTAMP);
 	ts = ktime_to_timespec(sk->sk_stamp);
@@ -767,6 +777,11 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
 	int datagrams;
 	struct timespec ktspec;
 
+	if (COMPAT_USE_64BIT_TIME)
+		return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
+				      flags | MSG_CMSG_COMPAT,
+				      (struct timespec *) timeout);
+
 	if (timeout == NULL)
 		return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
 				      flags | MSG_CMSG_COMPAT, NULL);
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [PATCH 7/7] compat: Handle COMPAT_USE_64BIT_TIME in net/socket.c
  2012-02-20  2:22     ` [PATCH 0/7] COMPAT_USE_64BIT_TIME v2 H. Peter Anvin
                         ` (5 preceding siblings ...)
  2012-02-20  2:22       ` [PATCH 6/7] compat: Use COMPAT_USE_64BIT_TIME in net/compat.c H. Peter Anvin
@ 2012-02-20  2:22       ` H. Peter Anvin
  2012-02-20  2:42       ` [PATCH 0/7] COMPAT_USE_64BIT_TIME v2 H. Peter Anvin
  7 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  2:22 UTC (permalink / raw)
  To: linux-kernel, linux-arch
  Cc: mingo, tglx, torvalds, akpm, davem, hjl.tools, Arnd Bergmann,
	Greg Kroah-Hartman, H. Peter Anvin

From: "H. Peter Anvin" <hpa@zytor.com>

Use helper functions aware of COMPAT_USE_64BIT_TIME to write struct
timeval and struct timespec to userspace in net/socket.c.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 net/socket.c |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index 28a96af..57f5a25 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2600,7 +2600,7 @@ void socket_seq_show(struct seq_file *seq)
 
 #ifdef CONFIG_COMPAT
 static int do_siocgstamp(struct net *net, struct socket *sock,
-			 unsigned int cmd, struct compat_timeval __user *up)
+			 unsigned int cmd, void __user *up)
 {
 	mm_segment_t old_fs = get_fs();
 	struct timeval ktv;
@@ -2609,15 +2609,14 @@ static int do_siocgstamp(struct net *net, struct socket *sock,
 	set_fs(KERNEL_DS);
 	err = sock_do_ioctl(net, sock, cmd, (unsigned long)&ktv);
 	set_fs(old_fs);
-	if (!err) {
-		err = put_user(ktv.tv_sec, &up->tv_sec);
-		err |= __put_user(ktv.tv_usec, &up->tv_usec);
-	}
+	if (!err)
+		err = compat_put_timeval(up, &ktv);
+
 	return err;
 }
 
 static int do_siocgstampns(struct net *net, struct socket *sock,
-			 unsigned int cmd, struct compat_timespec __user *up)
+			 unsigned int cmd, struct void __user *up)
 {
 	mm_segment_t old_fs = get_fs();
 	struct timespec kts;
@@ -2626,10 +2625,9 @@ static int do_siocgstampns(struct net *net, struct socket *sock,
 	set_fs(KERNEL_DS);
 	err = sock_do_ioctl(net, sock, cmd, (unsigned long)&kts);
 	set_fs(old_fs);
-	if (!err) {
-		err = put_user(kts.tv_sec, &up->tv_sec);
-		err |= __put_user(kts.tv_nsec, &up->tv_nsec);
-	}
+	if (!err)
+		err = compat_put_timespec(up, &kts);
+
 	return err;
 }
 
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 106+ messages in thread

* Re: [PATCH 0/7] COMPAT_USE_64BIT_TIME v2
  2012-02-20  2:22     ` [PATCH 0/7] COMPAT_USE_64BIT_TIME v2 H. Peter Anvin
                         ` (6 preceding siblings ...)
  2012-02-20  2:22       ` [PATCH 7/7] compat: Handle COMPAT_USE_64BIT_TIME in net/socket.c H. Peter Anvin
@ 2012-02-20  2:42       ` H. Peter Anvin
  2012-02-20  6:22         ` H. Peter Anvin
  7 siblings, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  2:42 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, davem,
	hjl.tools, Arnd Bergmann, Greg Kroah-Hartman

On 02/19/2012 06:22 PM, H. Peter Anvin wrote:
> From: "H. Peter Anvin" <hpa@zytor.com>
> 
> This is a respin of the COMPAT_USE_64BIT_TIME bits of the x32
> patchset.  It replaces patches 07/30-10/30 out of that patchset.
> 
> The differences in this respin are:
> 
> 1. Use helper functions as suggested by Linus, and
> 2. Add support in the networking stack (this bit got inadvertently
>    left out of the previous patchset.)
> 
> Linus, is this more what you were looking for?
> 
> This is the diffstat for this set:
> 

(And no, it doesn't even compile... working on that ;)

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 0/7] COMPAT_USE_64BIT_TIME v2
  2012-02-20  2:42       ` [PATCH 0/7] COMPAT_USE_64BIT_TIME v2 H. Peter Anvin
@ 2012-02-20  6:22         ` H. Peter Anvin
  0 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20  6:22 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, davem,
	hjl.tools, Arnd Bergmann, Greg Kroah-Hartman

On 02/19/2012 06:42 PM, H. Peter Anvin wrote:
> 
> (And no, it doesn't even compile... working on that ;)
> 

The full tree which more Actually Compiles[TM] at:

git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-x32.git x86/x32

I won't patchbomb it tonight, though.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 06/30] sysinfo: Use explicit types in <linux/sysinfo.h>
  2012-02-20  0:07 ` [PATCH 06/30] sysinfo: Use explicit types in <linux/sysinfo.h> H. Peter Anvin
@ 2012-02-20 12:12   ` Geert Uytterhoeven
  2012-02-20 17:29     ` H. Peter Anvin
  0 siblings, 1 reply; 106+ messages in thread
From: Geert Uytterhoeven @ 2012-02-20 12:12 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, hjl.tools

On Mon, Feb 20, 2012 at 01:07, H. Peter Anvin <hpa@zytor.com> wrote:
> --- a/include/linux/sysinfo.h
> +++ b/include/linux/sysinfo.h
> @@ -1,22 +1,24 @@
>  #ifndef _LINUX_SYSINFO_H
>  #define _LINUX_SYSINFO_H
>
> +#include <linux/types.h>
> +
>  #define SI_LOAD_SHIFT  16
>  struct sysinfo {
> -       long uptime;                    /* Seconds since boot */
> -       unsigned long loads[3];         /* 1, 5, and 15 minute load averages */
> -       unsigned long totalram;         /* Total usable main memory size */
> -       unsigned long freeram;          /* Available memory size */
> -       unsigned long sharedram;        /* Amount of shared memory */
> -       unsigned long bufferram;        /* Memory used by buffers */
> -       unsigned long totalswap;        /* Total swap space size */
> -       unsigned long freeswap;         /* swap space still available */
> -       unsigned short procs;           /* Number of current processes */
> -       unsigned short pad;             /* explicit padding for m68k */
> -       unsigned long totalhigh;        /* Total high memory size */
> -       unsigned long freehigh;         /* Available high memory size */
> -       unsigned int mem_unit;          /* Memory unit size in bytes */
> -       char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
> +       __kernel_long_t uptime;         /* Seconds since boot */
> +       __kernel_ulong_t loads[3];      /* 1, 5, and 15 minute load averages */
> +       __kernel_ulong_t totalram;      /* Total usable main memory size */
> +       __kernel_ulong_t freeram;       /* Available memory size */
> +       __kernel_ulong_t sharedram;     /* Amount of shared memory */
> +       __kernel_ulong_t bufferram;     /* Memory used by buffers */
> +       __kernel_ulong_t totalswap;     /* Total swap space size */
> +       __kernel_ulong_t freeswap;      /* swap space still available */
> +       __u16 procs;                    /* Number of current processes */
> +       __u16 pad;                      /* Explicit padding for m68k */

Fueling the discussion about natural vs. 4-byte alignment?

> +       __kernel_ulong_t totalhigh;     /* Total high memory size */
> +       __kernel_ulong_t freehigh;      /* Available high memory size */
> +       __u32 mem_unit;                 /* Memory unit size in bytes */
> +       char _f[20-2*sizeof(__kernel_ulong_t)-sizeof(__u32)];   /* Padding: libc5 uses this.. */
>  };

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 06/30] sysinfo: Use explicit types in <linux/sysinfo.h>
  2012-02-20 12:12   ` Geert Uytterhoeven
@ 2012-02-20 17:29     ` H. Peter Anvin
  2012-02-20 20:01       ` Geert Uytterhoeven
  0 siblings, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20 17:29 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, hjl.tools

Not really... it comes down to "implicit padding in kernel ABI structures is bad".  They can easily become security holes.



Geert Uytterhoeven <geert@linux-m68k.org> wrote:

>On Mon, Feb 20, 2012 at 01:07, H. Peter Anvin <hpa@zytor.com> wrote:
>> --- a/include/linux/sysinfo.h
>> +++ b/include/linux/sysinfo.h
>> @@ -1,22 +1,24 @@
>>  #ifndef _LINUX_SYSINFO_H
>>  #define _LINUX_SYSINFO_H
>>
>> +#include <linux/types.h>
>> +
>>  #define SI_LOAD_SHIFT  16
>>  struct sysinfo {
>> -       long uptime;                    /* Seconds since boot */
>> -       unsigned long loads[3];         /* 1, 5, and 15 minute load
>averages */
>> -       unsigned long totalram;         /* Total usable main memory
>size */
>> -       unsigned long freeram;          /* Available memory size */
>> -       unsigned long sharedram;        /* Amount of shared memory */
>> -       unsigned long bufferram;        /* Memory used by buffers */
>> -       unsigned long totalswap;        /* Total swap space size */
>> -       unsigned long freeswap;         /* swap space still available
>*/
>> -       unsigned short procs;           /* Number of current
>processes */
>> -       unsigned short pad;             /* explicit padding for m68k
>*/
>> -       unsigned long totalhigh;        /* Total high memory size */
>> -       unsigned long freehigh;         /* Available high memory size
>*/
>> -       unsigned int mem_unit;          /* Memory unit size in bytes
>*/
>> -       char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5
>uses this.. */
>> +       __kernel_long_t uptime;         /* Seconds since boot */
>> +       __kernel_ulong_t loads[3];      /* 1, 5, and 15 minute load
>averages */
>> +       __kernel_ulong_t totalram;      /* Total usable main memory
>size */
>> +       __kernel_ulong_t freeram;       /* Available memory size */
>> +       __kernel_ulong_t sharedram;     /* Amount of shared memory */
>> +       __kernel_ulong_t bufferram;     /* Memory used by buffers */
>> +       __kernel_ulong_t totalswap;     /* Total swap space size */
>> +       __kernel_ulong_t freeswap;      /* swap space still available
>*/
>> +       __u16 procs;                    /* Number of current
>processes */
>> +       __u16 pad;                      /* Explicit padding for m68k
>*/
>
>Fueling the discussion about natural vs. 4-byte alignment?
>
>> +       __kernel_ulong_t totalhigh;     /* Total high memory size */
>> +       __kernel_ulong_t freehigh;      /* Available high memory size
>*/
>> +       __u32 mem_unit;                 /* Memory unit size in bytes
>*/
>> +       char _f[20-2*sizeof(__kernel_ulong_t)-sizeof(__u32)];   /*
>Padding: libc5 uses this.. */
>>  };
>
>Gr{oetje,eeting}s,
>
>                        Geert
>
>--
>Geert Uytterhoeven -- There's lots of Linux beyond ia32 --
>geert@linux-m68k.org
>
>In personal conversations with technical people, I call myself a
>hacker. But
>when I'm talking to journalists I just say "programmer" or something
>like that.
>                                -- Linus Torvalds

-- 
Sent from my mobile phone. Please excuse my brevity and lack of formatting.

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 06/30] sysinfo: Use explicit types in <linux/sysinfo.h>
  2012-02-20 17:29     ` H. Peter Anvin
@ 2012-02-20 20:01       ` Geert Uytterhoeven
  2012-02-20 20:44         ` H. Peter Anvin
  0 siblings, 1 reply; 106+ messages in thread
From: Geert Uytterhoeven @ 2012-02-20 20:01 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, hjl.tools

On Mon, Feb 20, 2012 at 18:29, H. Peter Anvin <hpa@zytor.com> wrote:
> Not really... it comes down to "implicit padding in kernel ABI structures is bad".  They can easily become security holes.

On 64-bit platforms with natural alignment of long, there's an implicit padding.

> Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
>>On Mon, Feb 20, 2012 at 01:07, H. Peter Anvin <hpa@zytor.com> wrote:
>>> --- a/include/linux/sysinfo.h
>>> +++ b/include/linux/sysinfo.h
>>> @@ -1,22 +1,24 @@
>>>  #ifndef _LINUX_SYSINFO_H
>>>  #define _LINUX_SYSINFO_H
>>>
>>> +#include <linux/types.h>
>>> +
>>>  #define SI_LOAD_SHIFT  16
>>>  struct sysinfo {
>>> -       long uptime;                    /* Seconds since boot */
>>> -       unsigned long loads[3];         /* 1, 5, and 15 minute load
>>averages */
>>> -       unsigned long totalram;         /* Total usable main memory
>>size */
>>> -       unsigned long freeram;          /* Available memory size */
>>> -       unsigned long sharedram;        /* Amount of shared memory */
>>> -       unsigned long bufferram;        /* Memory used by buffers */
>>> -       unsigned long totalswap;        /* Total swap space size */
>>> -       unsigned long freeswap;         /* swap space still available
>>*/
>>> -       unsigned short procs;           /* Number of current
>>processes */
>>> -       unsigned short pad;             /* explicit padding for m68k
>>*/
>>> -       unsigned long totalhigh;        /* Total high memory size */
>>> -       unsigned long freehigh;         /* Available high memory size
>>*/
>>> -       unsigned int mem_unit;          /* Memory unit size in bytes
>>*/
>>> -       char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5
>>uses this.. */
>>> +       __kernel_long_t uptime;         /* Seconds since boot */
>>> +       __kernel_ulong_t loads[3];      /* 1, 5, and 15 minute load
>>averages */
>>> +       __kernel_ulong_t totalram;      /* Total usable main memory
>>size */
>>> +       __kernel_ulong_t freeram;       /* Available memory size */
>>> +       __kernel_ulong_t sharedram;     /* Amount of shared memory */
>>> +       __kernel_ulong_t bufferram;     /* Memory used by buffers */
>>> +       __kernel_ulong_t totalswap;     /* Total swap space size */
>>> +       __kernel_ulong_t freeswap;      /* swap space still available
>>*/
>>> +       __u16 procs;                    /* Number of current
>>processes */
>>> +       __u16 pad;                      /* Explicit padding for m68k
>>*/
>>
>>Fueling the discussion about natural vs. 4-byte alignment?
>>
>>> +       __kernel_ulong_t totalhigh;     /* Total high memory size */
>>> +       __kernel_ulong_t freehigh;      /* Available high memory size
>>*/
>>> +       __u32 mem_unit;                 /* Memory unit size in bytes
>>*/
>>> +       char _f[20-2*sizeof(__kernel_ulong_t)-sizeof(__u32)];   /*
>>Padding: libc5 uses this.. */
>>>  };

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 06/30] sysinfo: Use explicit types in <linux/sysinfo.h>
  2012-02-20 20:01       ` Geert Uytterhoeven
@ 2012-02-20 20:44         ` H. Peter Anvin
  0 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-20 20:44 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, hjl.tools

On 02/20/2012 12:01 PM, Geert Uytterhoeven wrote:
> On Mon, Feb 20, 2012 at 18:29, H. Peter Anvin <hpa@zytor.com> wrote:
>> Not really... it comes down to "implicit padding in kernel ABI structures is bad".  They can easily become security holes.
> 
> On 64-bit platforms with natural alignment of long, there's an implicit padding.
> 

We should try to make those explicit, but it sometimes gets hard
retroactively.  Note that the particular patch you're pointing to is
just an identity patch.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 30/30] x32: Add x32 VDSO support
  2012-02-20  0:08 ` [PATCH 30/30] x32: Add x32 VDSO support H. Peter Anvin
@ 2012-02-21  0:12   ` Andy Lutomirski
  2012-02-21  3:58     ` H. Peter Anvin
  2012-02-23  4:49     ` [tip:x86/x32] x32: Drop non-__vdso weak symbols from the x32 VDSO tip-bot for H. Peter Anvin
  0 siblings, 2 replies; 106+ messages in thread
From: Andy Lutomirski @ 2012-02-21  0:12 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, hjl.tools

On 02/19/2012 04:08 PM, H. Peter Anvin wrote:
> From: "H. J. Lu" <hjl.tools@gmail.com>
> 
> Add support for the x32 VDSO.  The x32 VDSO takes advantage of the
> similarity between the x86-64 and the x32 ABIs to contain the same
> content, only the container is different, as the x32 VDSO obviously is
> an x32 shared object.

> +
> +/*
> + * This controls what userland symbols we export from the vDSO.
> + */
> +VERSION {
> +	LINUX_2.6 {
> +	global:
> +		clock_gettime;
> +		__vdso_clock_gettime;
> +		gettimeofday;
> +		__vdso_gettimeofday;
> +		getcpu;
> +		__vdso_getcpu;
> +		time;
> +		__vdso_time;
> +	local: *;
> +	};
> +}
> +

Would it make sense to remove the non-__vdso-prefixed weak symbols?
AFAICT they are somewhere between useless (because the __vdso symbols
are unambiguous), confusing (has anyone not read this and said "huh?"),
and wrong (they are not interchangeable with glibc's symbols as they
return different values).

We're stuck with them on x86-64, but x32 is new and has no
backwards-compatibility issues.

--Andy

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 30/30] x32: Add x32 VDSO support
  2012-02-21  0:12   ` Andy Lutomirski
@ 2012-02-21  3:58     ` H. Peter Anvin
  2012-02-21 16:52       ` Andrew Lutomirski
  2012-02-23  4:49     ` [tip:x86/x32] x32: Drop non-__vdso weak symbols from the x32 VDSO tip-bot for H. Peter Anvin
  1 sibling, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-21  3:58 UTC (permalink / raw)
  To: Andy Lutomirski
  Cc: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, hjl.tools

On 02/20/2012 04:12 PM, Andy Lutomirski wrote:
> 
> Would it make sense to remove the non-__vdso-prefixed weak symbols?
> AFAICT they are somewhere between useless (because the __vdso symbols
> are unambiguous), confusing (has anyone not read this and said "huh?"),
> and wrong (they are not interchangeable with glibc's symbols as they
> return different values).
> 
> We're stuck with them on x86-64, but x32 is new and has no
> backwards-compatibility issues.
> 

What about non-glibc?

	-hpa


-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 30/30] x32: Add x32 VDSO support
  2012-02-21  3:58     ` H. Peter Anvin
@ 2012-02-21 16:52       ` Andrew Lutomirski
  2012-02-21 17:51         ` H. Peter Anvin
  0 siblings, 1 reply; 106+ messages in thread
From: Andrew Lutomirski @ 2012-02-21 16:52 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, hjl.tools

On Mon, Feb 20, 2012 at 7:58 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 02/20/2012 04:12 PM, Andy Lutomirski wrote:
>>
>> Would it make sense to remove the non-__vdso-prefixed weak symbols?
>> AFAICT they are somewhere between useless (because the __vdso symbols
>> are unambiguous), confusing (has anyone not read this and said "huh?"),
>> and wrong (they are not interchangeable with glibc's symbols as they
>> return different values).
>>
>> We're stuck with them on x86-64, but x32 is new and has no
>> backwards-compatibility issues.
>>
>
> What about non-glibc?

IMO non-glibc users should just call __vdso_clock_gettime, etc.
Currently, code like:

if (clock_gettime(whatever) == -1)
  handle_the_error();

is correct when linked against glibc but incorrect when linked
directly against the vdso.

--Andy

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 30/30] x32: Add x32 VDSO support
  2012-02-21 16:52       ` Andrew Lutomirski
@ 2012-02-21 17:51         ` H. Peter Anvin
  2012-02-21 18:54           ` Andrew Lutomirski
  0 siblings, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-21 17:51 UTC (permalink / raw)
  To: Andrew Lutomirski
  Cc: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, hjl.tools

On 02/21/2012 08:52 AM, Andrew Lutomirski wrote:
>>
>> What about non-glibc?
>
> IMO non-glibc users should just call __vdso_clock_gettime, etc.
> Currently, code like:
>
> if (clock_gettime(whatever) == -1)
>    handle_the_error();
>
> is correct when linked against glibc but incorrect when linked
> directly against the vdso.
>

The issue is what uclibc, Bionic, etc. actually do.

	-hpa


^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 30/30] x32: Add x32 VDSO support
  2012-02-21 17:51         ` H. Peter Anvin
@ 2012-02-21 18:54           ` Andrew Lutomirski
  2012-02-21 19:03             ` H. Peter Anvin
  0 siblings, 1 reply; 106+ messages in thread
From: Andrew Lutomirski @ 2012-02-21 18:54 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, hjl.tools

On Tue, Feb 21, 2012 at 9:51 AM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 02/21/2012 08:52 AM, Andrew Lutomirski wrote:
>>>
>>>
>>> What about non-glibc?
>>
>>
>> IMO non-glibc users should just call __vdso_clock_gettime, etc.
>> Currently, code like:
>>
>> if (clock_gettime(whatever) == -1)
>>   handle_the_error();
>>
>> is correct when linked against glibc but incorrect when linked
>> directly against the vdso.
>>
>
> The issue is what uclibc, Bionic, etc. actually do.

AFAICS Bionic only works on x86-32 and calls clock_gettime via
hardcoded int 0x80, written in assembly (!).  uclibc calls
__vdso_getcpu and does not seem to use the other vdso calls.  On a
cursory inspection, klibc uses neither the vsyscall page nor the vdso.

I doubt that there's any existing libc replacement that uses the
non-prefixed vdso entries and that already works on x32 -- that would
be impressive.  I'm not suggesting changing anything in the x86-64
vdso.

uclibc hardcodes a call to the vsyscall gettimeofday implementation in
its locking primitives, which probably gives terrible performance, but
that's a separate issue.  I think do_emulate_vsyscall should send a
segfault if called by an x32 task -- there's some security benefit to
doing so, and there's unlikely to be any downside.

--Andy

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 30/30] x32: Add x32 VDSO support
  2012-02-21 18:54           ` Andrew Lutomirski
@ 2012-02-21 19:03             ` H. Peter Anvin
  2012-02-21 19:29               ` Andrew Lutomirski
  0 siblings, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-21 19:03 UTC (permalink / raw)
  To: Andrew Lutomirski
  Cc: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, hjl.tools

On 02/21/2012 10:54 AM, Andrew Lutomirski wrote:
> 
> uclibc hardcodes a call to the vsyscall gettimeofday implementation in
> its locking primitives, which probably gives terrible performance, but
> that's a separate issue.  I think do_emulate_vsyscall should send a
> segfault if called by an x32 task -- there's some security benefit to
> doing so, and there's unlikely to be any downside.
> 

The vsyscall page shouldn't be mapped for x32 tasks...

	-hpa



^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 10/30] compat: Use COMPAT_USE_64BIT_TIME in the Bluetooth subsystem
  2012-02-20  0:07 ` [PATCH 10/30] compat: Use COMPAT_USE_64BIT_TIME in the Bluetooth subsystem H. Peter Anvin
@ 2012-02-21 19:05   ` Gustavo Padovan
  2012-02-21 19:15     ` H. Peter Anvin
  2012-02-22 13:47     ` Jiri Kosina
  0 siblings, 2 replies; 106+ messages in thread
From: Gustavo Padovan @ 2012-02-21 19:05 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, hjl.tools,
	Marcel Holtmann, David S. Miller


* H. Peter Anvin <hpa@zytor.com> [2012-02-19 16:07:48 -0800]:

> From: "H. J. Lu" <hjl.tools@gmail.com>
> 
> Enable the Bluetooth subsystem to be used with a compat ABI with
> 64-bit time.
> 
> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
> Cc: Marcel Holtmann <marcel@holtmann.org>
> Cc: Gustavo F. Padovan <padovan@profusion.mobi>
> Cc: David S. Miller <davem@davemloft.net>
> ---
>  net/bluetooth/hci_sock.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)

Applied, thanks.

	Gustavo

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 10/30] compat: Use COMPAT_USE_64BIT_TIME in the Bluetooth subsystem
  2012-02-21 19:05   ` Gustavo Padovan
@ 2012-02-21 19:15     ` H. Peter Anvin
  2012-02-22 13:47     ` Jiri Kosina
  1 sibling, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-21 19:15 UTC (permalink / raw)
  To: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, hjl.tools,
	Marcel Holtmann, David S. Miller

On 02/21/2012 11:05 AM, Gustavo Padovan wrote:
> 
> * H. Peter Anvin <hpa@zytor.com> [2012-02-19 16:07:48 -0800]:
> 
>> From: "H. J. Lu" <hjl.tools@gmail.com>
>>
>> Enable the Bluetooth subsystem to be used with a compat ABI with
>> 64-bit time.
>>
>> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
>> Cc: Marcel Holtmann <marcel@holtmann.org>
>> Cc: Gustavo F. Padovan <padovan@profusion.mobi>
>> Cc: David S. Miller <davem@davemloft.net>
>> ---
>>  net/bluetooth/hci_sock.c |    3 ++-
>>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> Applied, thanks.
> 

OK, I have it in my x86/x32 tree; you don't want to have this patch
without the prior patch for obvious reasons.

	-hpa



^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 30/30] x32: Add x32 VDSO support
  2012-02-21 19:03             ` H. Peter Anvin
@ 2012-02-21 19:29               ` Andrew Lutomirski
  2012-02-21 19:37                 ` H. Peter Anvin
  0 siblings, 1 reply; 106+ messages in thread
From: Andrew Lutomirski @ 2012-02-21 19:29 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, hjl.tools

On Tue, Feb 21, 2012 at 11:03 AM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 02/21/2012 10:54 AM, Andrew Lutomirski wrote:
>>
>> uclibc hardcodes a call to the vsyscall gettimeofday implementation in
>> its locking primitives, which probably gives terrible performance, but
>> that's a separate issue.  I think do_emulate_vsyscall should send a
>> segfault if called by an x32 task -- there's some security benefit to
>> doing so, and there's unlikely to be any downside.
>>
>
> The vsyscall page shouldn't be mapped for x32 tasks...

How is that possible?  It lives in the fixmap and is presumably
visible from any 64-bit code.

Admittedly, x32 tasks are probably somewhat difficult to trick into
calling addresses with high bits set, but it's not necessarily
impossible.

--Andy

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 30/30] x32: Add x32 VDSO support
  2012-02-21 19:29               ` Andrew Lutomirski
@ 2012-02-21 19:37                 ` H. Peter Anvin
  2012-02-21 19:40                   ` Andrew Lutomirski
  0 siblings, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-21 19:37 UTC (permalink / raw)
  To: Andrew Lutomirski
  Cc: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, hjl.tools

On 02/21/2012 11:29 AM, Andrew Lutomirski wrote:
>>
>> The vsyscall page shouldn't be mapped for x32 tasks...
> 
> How is that possible?  It lives in the fixmap and is presumably
> visible from any 64-bit code.
> 
> Admittedly, x32 tasks are probably somewhat difficult to trick into
> calling addresses with high bits set, but it's not necessarily
> impossible.
> 

Fair enough, and it's not necessarily all that hard either.

And it's visible even in a 32-bit task, although a 32-bit task has to
switch into 64-bit mode.  Yet another reason the vsyscall page needs to die.

I was having delusions that we could have a task-owned PDT in negative
space, but that would require unsharing the third level, too, which is
just way too messy.

	-hpa

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 30/30] x32: Add x32 VDSO support
  2012-02-21 19:37                 ` H. Peter Anvin
@ 2012-02-21 19:40                   ` Andrew Lutomirski
  2012-02-21 19:49                     ` H. Peter Anvin
  0 siblings, 1 reply; 106+ messages in thread
From: Andrew Lutomirski @ 2012-02-21 19:40 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, hjl.tools

On Tue, Feb 21, 2012 at 11:37 AM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 02/21/2012 11:29 AM, Andrew Lutomirski wrote:
>>>
>>> The vsyscall page shouldn't be mapped for x32 tasks...
>>
>> How is that possible?  It lives in the fixmap and is presumably
>> visible from any 64-bit code.
>>
>> Admittedly, x32 tasks are probably somewhat difficult to trick into
>> calling addresses with high bits set, but it's not necessarily
>> impossible.
>>
>
> Fair enough, and it's not necessarily all that hard either.
>
> And it's visible even in a 32-bit task, although a 32-bit task has to
> switch into 64-bit mode.  Yet another reason the vsyscall page needs to die.
>
> I was having delusions that we could have a task-owned PDT in negative
> space, but that would require unsharing the third level, too, which is
> just way too messy.

I'd like to do that, too, and I'd also like to have a per-cpu
kernel-only page in there, but that's even worse.  If we had a
separate cr3-like register for negative addresses, life would be good
:)

--Andy

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 30/30] x32: Add x32 VDSO support
  2012-02-21 19:40                   ` Andrew Lutomirski
@ 2012-02-21 19:49                     ` H. Peter Anvin
  2012-02-21 19:51                       ` Andrew Lutomirski
  0 siblings, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-21 19:49 UTC (permalink / raw)
  To: Andrew Lutomirski
  Cc: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, hjl.tools

On 02/21/2012 11:40 AM, Andrew Lutomirski wrote:
>>
>> I was having delusions that we could have a task-owned PDT in negative
>> space, but that would require unsharing the third level, too, which is
>> just way too messy.
> 
> I'd like to do that, too, and I'd also like to have a per-cpu
> kernel-only page in there, but that's even worse.  If we had a
> separate cr3-like register for negative addresses, life would be good
> :)
> 

No, that wouldn't help.  The situation is actually quite similar to the
current situation where we have an unshared fourth level, but since the
fourth entries are 512G per entry, we would have to push unsharing of
the kernel address space at least one more level (1G), possibly two
(2M).  Painful.

The main advantage of a separate cr3 would be that we wouldn't need the
unshared top level for the kernel side.

	-hpa

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 30/30] x32: Add x32 VDSO support
  2012-02-21 19:49                     ` H. Peter Anvin
@ 2012-02-21 19:51                       ` Andrew Lutomirski
  2012-02-21 19:56                         ` H. Peter Anvin
  0 siblings, 1 reply; 106+ messages in thread
From: Andrew Lutomirski @ 2012-02-21 19:51 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, hjl.tools

On Tue, Feb 21, 2012 at 11:49 AM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 02/21/2012 11:40 AM, Andrew Lutomirski wrote:
>>>
>>> I was having delusions that we could have a task-owned PDT in negative
>>> space, but that would require unsharing the third level, too, which is
>>> just way too messy.
>>
>> I'd like to do that, too, and I'd also like to have a per-cpu
>> kernel-only page in there, but that's even worse.  If we had a
>> separate cr3-like register for negative addresses, life would be good
>> :)
>>
>
> No, that wouldn't help.  The situation is actually quite similar to the
> current situation where we have an unshared fourth level, but since the
> fourth entries are 512G per entry, we would have to push unsharing of
> the kernel address space at least one more level (1G), possibly two
> (2M).  Painful.
>
> The main advantage of a separate cr3 would be that we wouldn't need the
> unshared top level for the kernel side.

Also, as is, if the top level wants to be per-cpu *and* per-task,
that's a big explosion of page tables that all need to stay in sync.

Oh well.

--Andy

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 30/30] x32: Add x32 VDSO support
  2012-02-21 19:51                       ` Andrew Lutomirski
@ 2012-02-21 19:56                         ` H. Peter Anvin
  0 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-21 19:56 UTC (permalink / raw)
  To: Andrew Lutomirski
  Cc: linux-kernel, linux-arch, mingo, tglx, torvalds, akpm, hjl.tools

On 02/21/2012 11:51 AM, Andrew Lutomirski wrote:
>>
>> No, that wouldn't help.  The situation is actually quite similar to the
>> current situation where we have an unshared fourth level, but since the
>> fourth entries are 512G per entry, we would have to push unsharing of
>> the kernel address space at least one more level (1G), possibly two
>> (2M).  Painful.
>>
>> The main advantage of a separate cr3 would be that we wouldn't need the
>> unshared top level for the kernel side.
> 
> Also, as is, if the top level wants to be per-cpu *and* per-task,
> that's a big explosion of page tables that all need to stay in sync.
> 

Fair enough.

	-hpa


^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 02/30] x86-64: Use explicit sizes in sigcontext.h, prepare for x32
  2012-02-20  0:56     ` H. Peter Anvin
@ 2012-02-22 12:22       ` Arnd Bergmann
  2012-02-22 18:14         ` H. Peter Anvin
  0 siblings, 1 reply; 106+ messages in thread
From: Arnd Bergmann @ 2012-02-22 12:22 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Linus Torvalds, linux-kernel, linux-arch, mingo, tglx, akpm, hjl.tools

On Monday 20 February 2012, H. Peter Anvin wrote:
> We are using __u64 as x86-32 compatible since we are sharing most of the
> really complex path (like ioctl) with i386 much more so than x86-64.  So
> it is defined in userspace as:
> 
> typedef unsigned long long __u64 __attribute__((aligned(4)));
> 
> __aligned_u64 obviously is naturally aligned, which matches uint64_t is
> userspace.

Has someone audited the interfaces to check if there are data structures that
use a plain signed or unsigned "long long" instead of __s64/__u64 in places
where i386 differs from the other compat implementations?

I found DRM_IOCTL_UPDATE_DRAW, but there could be more like this one.

	Arnd

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 10/30] compat: Use COMPAT_USE_64BIT_TIME in the Bluetooth subsystem
  2012-02-21 19:05   ` Gustavo Padovan
  2012-02-21 19:15     ` H. Peter Anvin
@ 2012-02-22 13:47     ` Jiri Kosina
  2012-02-22 14:45       ` Gustavo Padovan
  1 sibling, 1 reply; 106+ messages in thread
From: Jiri Kosina @ 2012-02-22 13:47 UTC (permalink / raw)
  To: Gustavo Padovan
  Cc: H. Peter Anvin, linux-kernel, linux-arch, mingo, tglx, torvalds,
	akpm, hjl.tools, Marcel Holtmann, David S. Miller

On Tue, 21 Feb 2012, Gustavo Padovan wrote:

> > From: "H. J. Lu" <hjl.tools@gmail.com>
> > 
> > Enable the Bluetooth subsystem to be used with a compat ABI with
> > 64-bit time.
> > 
> > Signed-off-by: H. Peter Anvin <hpa@zytor.com>
> > Cc: Marcel Holtmann <marcel@holtmann.org>
> > Cc: Gustavo F. Padovan <padovan@profusion.mobi>
> > Cc: David S. Miller <davem@davemloft.net>
> > ---
> >  net/bluetooth/hci_sock.c |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> Applied, thanks.

How much sense does it make to apply this single patch without the 
previous x32 infrastructure changes?

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 10/30] compat: Use COMPAT_USE_64BIT_TIME in the Bluetooth subsystem
  2012-02-22 13:47     ` Jiri Kosina
@ 2012-02-22 14:45       ` Gustavo Padovan
  0 siblings, 0 replies; 106+ messages in thread
From: Gustavo Padovan @ 2012-02-22 14:45 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: H. Peter Anvin, linux-kernel, linux-arch, mingo, tglx, torvalds,
	akpm, hjl.tools, Marcel Holtmann, David S. Miller

Hi Jiri,

* Jiri Kosina <jkosina@suse.cz> [2012-02-22 14:47:29 +0100]:

> On Tue, 21 Feb 2012, Gustavo Padovan wrote:
> 
> > > From: "H. J. Lu" <hjl.tools@gmail.com>
> > > 
> > > Enable the Bluetooth subsystem to be used with a compat ABI with
> > > 64-bit time.
> > > 
> > > Signed-off-by: H. Peter Anvin <hpa@zytor.com>
> > > Cc: Marcel Holtmann <marcel@holtmann.org>
> > > Cc: Gustavo F. Padovan <padovan@profusion.mobi>
> > > Cc: David S. Miller <davem@davemloft.net>
> > > ---
> > >  net/bluetooth/hci_sock.c |    3 ++-
> > >  1 files changed, 2 insertions(+), 1 deletions(-)
> > 
> > Applied, thanks.
> 
> How much sense does it make to apply this single patch without the 
> previous x32 infrastructure changes?

No sense, I already stepped back with this changes. That's what happens when
you try to apply patches in the middle of the Brazilian Carnival. :)

	Gustavo

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 02/30] x86-64: Use explicit sizes in sigcontext.h, prepare for x32
  2012-02-22 12:22       ` Arnd Bergmann
@ 2012-02-22 18:14         ` H. Peter Anvin
  2012-02-22 21:23           ` Arnd Bergmann
  0 siblings, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-22 18:14 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Linus Torvalds, linux-kernel, linux-arch, mingo, tglx, akpm, hjl.tools

On 02/22/2012 04:22 AM, Arnd Bergmann wrote:
> On Monday 20 February 2012, H. Peter Anvin wrote:
>> We are using __u64 as x86-32 compatible since we are sharing most of the
>> really complex path (like ioctl) with i386 much more so than x86-64.  So
>> it is defined in userspace as:
>>
>> typedef unsigned long long __u64 __attribute__((aligned(4)));
>>
>> __aligned_u64 obviously is naturally aligned, which matches uint64_t is
>> userspace.
> 
> Has someone audited the interfaces to check if there are data structures that
> use a plain signed or unsigned "long long" instead of __s64/__u64 in places
> where i386 differs from the other compat implementations?
> 
> I found DRM_IOCTL_UPDATE_DRAW, but there could be more like this one.
> 

Has someone audited every single ioctl in the kernel?  Definitely not,
which is why x32 is marked EXPERIMENTAL.  I think it is still time for
this work to switch to happening in the upstream, however.

	-hpa


-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 02/30] x86-64: Use explicit sizes in sigcontext.h, prepare for x32
  2012-02-22 18:14         ` H. Peter Anvin
@ 2012-02-22 21:23           ` Arnd Bergmann
  2012-02-22 21:55             ` H. Peter Anvin
  2012-02-24  2:33             ` H. Peter Anvin
  0 siblings, 2 replies; 106+ messages in thread
From: Arnd Bergmann @ 2012-02-22 21:23 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Linus Torvalds, linux-kernel, linux-arch, mingo, tglx, akpm, hjl.tools

On Wednesday 22 February 2012, H. Peter Anvin wrote:
> On 02/22/2012 04:22 AM, Arnd Bergmann wrote:
> > On Monday 20 February 2012, H. Peter Anvin wrote:
> >> We are using __u64 as x86-32 compatible since we are sharing most of the
> >> really complex path (like ioctl) with i386 much more so than x86-64.  So
> >> it is defined in userspace as:
> >>
> >> typedef unsigned long long __u64 __attribute__((aligned(4)));
> >>
> >> __aligned_u64 obviously is naturally aligned, which matches uint64_t is
> >> userspace.
> > 
> > Has someone audited the interfaces to check if there are data structures that
> > use a plain signed or unsigned "long long" instead of __s64/__u64 in places
> > where i386 differs from the other compat implementations?
> > 
> > I found DRM_IOCTL_UPDATE_DRAW, but there could be more like this one.
> > 
> 
> Has someone audited every single ioctl in the kernel?  Definitely not,
> which is why x32 is marked EXPERIMENTAL.  I think it is still time for
> this work to switch to happening in the upstream, however.

Depends on how you want to do it. In some cases, the easiest answer
would be to change the data structure to use __u64 and be compatible
with i386. Once there are distros built using data structure with
padding around a long long, you have to use a run-time conditional
in the compat handler.

I'd say we should fix at least the ones that are easy to spot because
they already use compat_u64 or have an #ifdef CONFIG_X86_64 in compat
code. I've looked at everything I could find that fits into that category
and found only two locations. My expectation is that all other data
structures that would fall into this category are already broken
for 32 bit emulation on x86.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/include/drm/drm.h b/include/drm/drm.h
index 49d94ed..73b7c33 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -438,7 +438,7 @@ struct drm_update_draw {
 	drm_drawable_t handle;
 	unsigned int type;
 	unsigned int num;
-	unsigned long long data;
+	__u64 data;
 };
 
 /**
diff --git a/include/sound/asound.h b/include/sound/asound.h
index a2e4ff5..a17e96c 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -824,8 +824,8 @@ struct snd_ctl_elem_value {
 			long *value_ptr;	/* obsoleted */
 		} integer;
 		union {
-			long long value[64];
-			long long *value_ptr;	/* obsoleted */
+			__s64 value[64];
+			__s64 *value_ptr;	/* obsoleted */
 		} integer64;
 		union {
 			unsigned int item[128];
	Arnd

^ permalink raw reply related	[flat|nested] 106+ messages in thread

* Re: [PATCH 02/30] x86-64: Use explicit sizes in sigcontext.h, prepare for x32
  2012-02-22 21:23           ` Arnd Bergmann
@ 2012-02-22 21:55             ` H. Peter Anvin
  2012-02-24  2:33             ` H. Peter Anvin
  1 sibling, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-22 21:55 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Linus Torvalds, linux-kernel, linux-arch, mingo, tglx, akpm, hjl.tools

On 02/22/2012 01:23 PM, Arnd Bergmann wrote:
> 
> Depends on how you want to do it. In some cases, the easiest answer
> would be to change the data structure to use __u64 and be compatible
> with i386. Once there are distros built using data structure with
> padding around a long long, you have to use a run-time conditional
> in the compat handler.
> 

That we'd like to avoid, but as you said, they'd be broken or might
already be broken.

> I'd say we should fix at least the ones that are easy to spot because
> they already use compat_u64 or have an #ifdef CONFIG_X86_64 in compat
> code. I've looked at everything I could find that fits into that category
> and found only two locations. My expectation is that all other data
> structures that would fall into this category are already broken
> for 32 bit emulation on x86.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> diff --git a/include/drm/drm.h b/include/drm/drm.h
> index 49d94ed..73b7c33 100644
> --- a/include/drm/drm.h
> +++ b/include/drm/drm.h
> @@ -438,7 +438,7 @@ struct drm_update_draw {
>  	drm_drawable_t handle;
>  	unsigned int type;
>  	unsigned int num;
> -	unsigned long long data;
> +	__u64 data;
>  };
>  
>  /**
> diff --git a/include/sound/asound.h b/include/sound/asound.h
> index a2e4ff5..a17e96c 100644
> --- a/include/sound/asound.h
> +++ b/include/sound/asound.h
> @@ -824,8 +824,8 @@ struct snd_ctl_elem_value {
>  			long *value_ptr;	/* obsoleted */
>  		} integer;
>  		union {
> -			long long value[64];
> -			long long *value_ptr;	/* obsoleted */
> +			__s64 value[64];
> +			__s64 *value_ptr;	/* obsoleted */
>  		} integer64;
>  		union {
>  			unsigned int item[128];
> 	Arnd

Right, those are good starts.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 106+ messages in thread

* [tip:x86/x32] x32: Drop non-__vdso weak symbols from the x32 VDSO
  2012-02-21  0:12   ` Andy Lutomirski
  2012-02-21  3:58     ` H. Peter Anvin
@ 2012-02-23  4:49     ` tip-bot for H. Peter Anvin
  2012-02-23 10:55       ` Ingo Molnar
  1 sibling, 1 reply; 106+ messages in thread
From: tip-bot for H. Peter Anvin @ 2012-02-23  4:49 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, luto, tglx, hjl.tools

Commit-ID:  862ae3132dc393ab6ea750b9ee9e0e1c276b9abb
Gitweb:     http://git.kernel.org/tip/862ae3132dc393ab6ea750b9ee9e0e1c276b9abb
Author:     H. Peter Anvin <hpa@zytor.com>
AuthorDate: Wed, 22 Feb 2012 20:37:10 -0800
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Wed, 22 Feb 2012 20:40:07 -0800

x32: Drop non-__vdso weak symbols from the x32 VDSO

Drop the legacy weak symbols that don't carry the __vdso prefix from
the x32 VDSO.  This is a new ABI and we don't need to support that
legacy; the actual libc will export the proper symbols.

Suggested-by: Andy Lutomirski <luto@mit.edu>
Link: http://lkml.kernel.org/r/4F42E171.9080005@mit.edu
Cc: H. J. Lu <hjl.tools@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/vdso/vdsox32.lds.S |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/arch/x86/vdso/vdsox32.lds.S b/arch/x86/vdso/vdsox32.lds.S
index 373ca9a..62272aa 100644
--- a/arch/x86/vdso/vdsox32.lds.S
+++ b/arch/x86/vdso/vdsox32.lds.S
@@ -17,13 +17,9 @@
 VERSION {
 	LINUX_2.6 {
 	global:
-		clock_gettime;
 		__vdso_clock_gettime;
-		gettimeofday;
 		__vdso_gettimeofday;
-		getcpu;
 		__vdso_getcpu;
-		time;
 		__vdso_time;
 	local: *;
 	};

^ permalink raw reply related	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Drop non-__vdso weak symbols from the x32 VDSO
  2012-02-23  4:49     ` [tip:x86/x32] x32: Drop non-__vdso weak symbols from the x32 VDSO tip-bot for H. Peter Anvin
@ 2012-02-23 10:55       ` Ingo Molnar
  2012-02-23 14:36         ` H. Peter Anvin
  0 siblings, 1 reply; 106+ messages in thread
From: Ingo Molnar @ 2012-02-23 10:55 UTC (permalink / raw)
  To: tip-bot for H. Peter Anvin
  Cc: linux-tip-commits, linux-kernel, mingo, luto, tglx, hjl.tools

[-- Attachment #1: Type: text/plain, Size: 821 bytes --]


* tip-bot for H. Peter Anvin <hpa@zytor.com> wrote:

> Commit-ID:  862ae3132dc393ab6ea750b9ee9e0e1c276b9abb
> Gitweb:     http://git.kernel.org/tip/862ae3132dc393ab6ea750b9ee9e0e1c276b9abb
> Author:     H. Peter Anvin <hpa@zytor.com>
> AuthorDate: Wed, 22 Feb 2012 20:37:10 -0800
> Committer:  H. Peter Anvin <hpa@zytor.com>
> CommitDate: Wed, 22 Feb 2012 20:40:07 -0800
> 
> x32: Drop non-__vdso weak symbols from the x32 VDSO

One of the recent x32 commit broke the build on some configs:

  VDSO    arch/x86/vdso/vdsox32.so.dbg
/usr/bin/ld: arch/x86/vdso/vgetcpu-x32.o: relocation R_X86_64_64 
against symbol `.rodata' isn't supported in x32 mode
arch/x86/vdso/vgetcpu-x32.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status

config attached.

binutils-2.21.51, gcc-4.7.0.

Thanks,

	Ingo

[-- Attachment #2: config --]
[-- Type: text/plain, Size: 76373 bytes --]

#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 3.3.0-rc4 Kernel Configuration
#
CONFIG_64BIT=y
# CONFIG_X86_32 is not set
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
CONFIG_GENERIC_CMOS_UPDATE=y
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_ARCH_CLOCKSOURCE_DATA=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_MMU=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_GPIO=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
# CONFIG_RWSEM_GENERIC_SPINLOCK is not set
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_ARCH_HAS_CPU_RELAX=y
CONFIG_ARCH_HAS_DEFAULT_IDLE=y
CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ZONE_DMA32=y
CONFIG_AUDIT_ARCH=y
CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11"
# CONFIG_KTIME_SCALAR is not set
CONFIG_ARCH_SUPPORTS_UPROBES=y
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_CONSTRUCTORS=y
CONFIG_HAVE_IRQ_WORK=y
CONFIG_IRQ_WORK=y

#
# General setup
#
CONFIG_EXPERIMENTAL=y
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=""
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
# CONFIG_KERNEL_GZIP is not set
# CONFIG_KERNEL_BZIP2 is not set
CONFIG_KERNEL_LZMA=y
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_SWAP=y
# CONFIG_SYSVIPC is not set
# CONFIG_POSIX_MQUEUE is not set
# CONFIG_BSD_PROCESS_ACCT is not set
CONFIG_FHANDLE=y
# CONFIG_TASKSTATS is not set
CONFIG_AUDIT=y
# CONFIG_AUDITSYSCALL is not set
CONFIG_AUDIT_LOGINUID_IMMUTABLE=y
CONFIG_HAVE_GENERIC_HARDIRQS=y

#
# IRQ subsystem
#
CONFIG_GENERIC_HARDIRQS=y
CONFIG_HAVE_SPARSE_IRQ=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_CHIP=y
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_SPARSE_IRQ=y

#
# RCU Subsystem
#
CONFIG_TINY_RCU=y
# CONFIG_PREEMPT_RCU is not set
CONFIG_RCU_TRACE=y
# CONFIG_TREE_RCU_TRACE is not set
# CONFIG_IKCONFIG is not set
CONFIG_LOG_BUF_SHIFT=20
CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
# CONFIG_CGROUPS is not set
# CONFIG_CHECKPOINT_RESTORE is not set
CONFIG_NAMESPACES=y
CONFIG_UTS_NS=y
CONFIG_USER_NS=y
# CONFIG_PID_NS is not set
CONFIG_NET_NS=y
# CONFIG_SCHED_AUTOGROUP is not set
CONFIG_SYSFS_DEPRECATED=y
# CONFIG_SYSFS_DEPRECATED_V2 is not set
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
CONFIG_RD_LZMA=y
CONFIG_RD_XZ=y
CONFIG_RD_LZO=y
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
CONFIG_SYSCTL=y
CONFIG_ANON_INODES=y
# CONFIG_EXPERT is not set
CONFIG_UID16=y
# CONFIG_SYSCTL_SYSCALL is not set
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_PCSPKR_PLATFORM=y
CONFIG_HAVE_PCSPKR_PLATFORM=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
CONFIG_AIO=y
# CONFIG_EMBEDDED is not set
CONFIG_HAVE_PERF_EVENTS=y
CONFIG_PERF_USE_VMALLOC=y

#
# Kernel Performance Events And Counters
#
CONFIG_PERF_EVENTS=y
# CONFIG_PERF_COUNTERS is not set
CONFIG_DEBUG_PERF_USE_VMALLOC=y
CONFIG_VM_EVENT_COUNTERS=y
CONFIG_PCI_QUIRKS=y
CONFIG_SLUB_DEBUG=y
# CONFIG_COMPAT_BRK is not set
# CONFIG_SLAB is not set
CONFIG_SLUB=y
CONFIG_PROFILING=y
CONFIG_TRACEPOINTS=y
# CONFIG_OPROFILE is not set
CONFIG_HAVE_OPROFILE=y
CONFIG_OPROFILE_NMI_TIMER=y
CONFIG_JUMP_LABEL=y
# CONFIG_UPROBES is not set
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
CONFIG_HAVE_IOREMAP_PROT=y
CONFIG_HAVE_KPROBES=y
CONFIG_HAVE_KRETPROBES=y
CONFIG_HAVE_OPTPROBES=y
CONFIG_HAVE_ARCH_TRACEHOOK=y
CONFIG_HAVE_DMA_ATTRS=y
CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
CONFIG_HAVE_DMA_API_DEBUG=y
CONFIG_HAVE_HW_BREAKPOINT=y
CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y
CONFIG_HAVE_USER_RETURN_NOTIFIER=y
CONFIG_HAVE_PERF_EVENTS_NMI=y
CONFIG_HAVE_ARCH_JUMP_LABEL=y
CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y
CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y
CONFIG_HAVE_CMPXCHG_LOCAL=y
CONFIG_HAVE_CMPXCHG_DOUBLE=y

#
# GCOV-based kernel profiling
#
CONFIG_GCOV_KERNEL=y
# CONFIG_GCOV_PROFILE_ALL is not set
# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
CONFIG_SLABINFO=y
CONFIG_RT_MUTEXES=y
CONFIG_BASE_SMALL=0
# CONFIG_MODULES is not set
CONFIG_BLOCK=y
CONFIG_BLK_DEV_BSG=y
CONFIG_BLK_DEV_BSGLIB=y
# CONFIG_BLK_DEV_INTEGRITY is not set

#
# Partition Types
#
CONFIG_PARTITION_ADVANCED=y
CONFIG_ACORN_PARTITION=y
CONFIG_ACORN_PARTITION_CUMANA=y
CONFIG_ACORN_PARTITION_EESOX=y
CONFIG_ACORN_PARTITION_ICS=y
CONFIG_ACORN_PARTITION_ADFS=y
CONFIG_ACORN_PARTITION_POWERTEC=y
# CONFIG_ACORN_PARTITION_RISCIX is not set
# CONFIG_OSF_PARTITION is not set
# CONFIG_AMIGA_PARTITION is not set
# CONFIG_ATARI_PARTITION is not set
CONFIG_MAC_PARTITION=y
CONFIG_MSDOS_PARTITION=y
CONFIG_BSD_DISKLABEL=y
CONFIG_MINIX_SUBPARTITION=y
CONFIG_SOLARIS_X86_PARTITION=y
CONFIG_UNIXWARE_DISKLABEL=y
# CONFIG_LDM_PARTITION is not set
# CONFIG_SGI_PARTITION is not set
# CONFIG_ULTRIX_PARTITION is not set
CONFIG_SUN_PARTITION=y
CONFIG_KARMA_PARTITION=y
CONFIG_EFI_PARTITION=y
# CONFIG_SYSV68_PARTITION is not set
CONFIG_BLOCK_COMPAT=y

#
# IO Schedulers
#
CONFIG_IOSCHED_NOOP=y
# CONFIG_IOSCHED_DEADLINE is not set
CONFIG_IOSCHED_CFQ=y
CONFIG_DEFAULT_CFQ=y
# CONFIG_DEFAULT_NOOP is not set
CONFIG_DEFAULT_IOSCHED="cfq"
# CONFIG_INLINE_SPIN_TRYLOCK is not set
# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
# CONFIG_INLINE_SPIN_LOCK is not set
# CONFIG_INLINE_SPIN_LOCK_BH is not set
# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
# CONFIG_INLINE_SPIN_UNLOCK is not set
# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
# CONFIG_INLINE_READ_TRYLOCK is not set
# CONFIG_INLINE_READ_LOCK is not set
# CONFIG_INLINE_READ_LOCK_BH is not set
# CONFIG_INLINE_READ_LOCK_IRQ is not set
# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
# CONFIG_INLINE_READ_UNLOCK is not set
# CONFIG_INLINE_READ_UNLOCK_BH is not set
# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
# CONFIG_INLINE_WRITE_TRYLOCK is not set
# CONFIG_INLINE_WRITE_LOCK is not set
# CONFIG_INLINE_WRITE_LOCK_BH is not set
# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
# CONFIG_INLINE_WRITE_UNLOCK is not set
# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
# CONFIG_MUTEX_SPIN_ON_OWNER is not set
# CONFIG_FREEZER is not set

#
# Processor type and features
#
CONFIG_ZONE_DMA=y
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ=y
# CONFIG_HIGH_RES_TIMERS is not set
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y
# CONFIG_SMP is not set
# CONFIG_X86_MPPARSE is not set
# CONFIG_X86_EXTENDED_PLATFORM is not set
CONFIG_X86_SUPPORTS_MEMORY_FAILURE=y
CONFIG_SCHED_OMIT_FRAME_POINTER=y
CONFIG_KVMTOOL_TEST_ENABLE=y
# CONFIG_PARAVIRT_GUEST is not set
CONFIG_NO_BOOTMEM=y
# CONFIG_MEMTEST is not set
# CONFIG_MK8 is not set
# CONFIG_MPSC is not set
# CONFIG_MCORE2 is not set
# CONFIG_MATOM is not set
CONFIG_GENERIC_CPU=y
CONFIG_X86_INTERNODE_CACHE_SHIFT=6
CONFIG_X86_CMPXCHG=y
CONFIG_X86_L1_CACHE_SHIFT=6
CONFIG_X86_XADD=y
CONFIG_X86_WP_WORKS_OK=y
CONFIG_X86_TSC=y
CONFIG_X86_CMPXCHG64=y
CONFIG_X86_CMOV=y
CONFIG_X86_MINIMUM_CPU_FAMILY=64
CONFIG_X86_DEBUGCTLMSR=y
CONFIG_CPU_SUP_INTEL=y
CONFIG_CPU_SUP_AMD=y
CONFIG_CPU_SUP_CENTAUR=y
CONFIG_HPET_TIMER=y
CONFIG_DMI=y
CONFIG_GART_IOMMU=y
CONFIG_CALGARY_IOMMU=y
CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT=y
CONFIG_SWIOTLB=y
CONFIG_IOMMU_HELPER=y
CONFIG_NR_CPUS=1
CONFIG_IRQ_TIME_ACCOUNTING=y
# CONFIG_PREEMPT_NONE is not set
CONFIG_PREEMPT_VOLUNTARY=y
# CONFIG_PREEMPT is not set
CONFIG_X86_LOCAL_APIC=y
CONFIG_X86_IO_APIC=y
CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y
CONFIG_X86_MCE=y
CONFIG_X86_MCE_INTEL=y
# CONFIG_X86_MCE_AMD is not set
CONFIG_X86_MCE_THRESHOLD=y
# CONFIG_X86_MCE_INJECT is not set
CONFIG_X86_THERMAL_VECTOR=y
# CONFIG_I8K is not set
CONFIG_MICROCODE=y
# CONFIG_MICROCODE_INTEL is not set
# CONFIG_MICROCODE_AMD is not set
CONFIG_MICROCODE_OLD_INTERFACE=y
CONFIG_X86_MSR=y
# CONFIG_X86_CPUID is not set
CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
CONFIG_DIRECT_GBPAGES=y
CONFIG_ARCH_SPARSEMEM_ENABLE=y
CONFIG_ARCH_SPARSEMEM_DEFAULT=y
CONFIG_ARCH_SELECT_MEMORY_MODEL=y
CONFIG_ARCH_MEMORY_PROBE=y
CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000
CONFIG_SELECT_MEMORY_MODEL=y
CONFIG_SPARSEMEM_MANUAL=y
CONFIG_SPARSEMEM=y
CONFIG_HAVE_MEMORY_PRESENT=y
CONFIG_SPARSEMEM_EXTREME=y
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER=y
# CONFIG_SPARSEMEM_VMEMMAP is not set
CONFIG_HAVE_MEMBLOCK=y
CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
CONFIG_ARCH_DISCARD_MEMBLOCK=y
CONFIG_MEMORY_HOTPLUG=y
CONFIG_MEMORY_HOTPLUG_SPARSE=y
CONFIG_MEMORY_HOTREMOVE=y
CONFIG_PAGEFLAGS_EXTENDED=y
CONFIG_SPLIT_PTLOCK_CPUS=999999
# CONFIG_COMPACTION is not set
CONFIG_MIGRATION=y
CONFIG_PHYS_ADDR_T_64BIT=y
CONFIG_ZONE_DMA_FLAG=1
CONFIG_BOUNCE=y
CONFIG_VIRT_TO_BUS=y
CONFIG_KSM=y
CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
CONFIG_ARCH_SUPPORTS_MEMORY_FAILURE=y
CONFIG_MEMORY_FAILURE=y
# CONFIG_HWPOISON_INJECT is not set
# CONFIG_TRANSPARENT_HUGEPAGE is not set
CONFIG_NEED_PER_CPU_KM=y
# CONFIG_CLEANCACHE is not set
CONFIG_X86_CHECK_BIOS_CORRUPTION=y
# CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK is not set
CONFIG_X86_RESERVE_LOW=64
CONFIG_MTRR=y
CONFIG_MTRR_SANITIZER=y
CONFIG_MTRR_SANITIZER_ENABLE_DEFAULT=0
CONFIG_MTRR_SANITIZER_SPARE_REG_NR_DEFAULT=1
CONFIG_X86_PAT=y
CONFIG_ARCH_USES_PG_UNCACHED=y
CONFIG_ARCH_RANDOM=y
CONFIG_EFI=y
# CONFIG_EFI_STUB is not set
CONFIG_SECCOMP=y
CONFIG_CC_STACKPROTECTOR=y
# CONFIG_HZ_100 is not set
CONFIG_HZ_250=y
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not set
CONFIG_HZ=250
# CONFIG_SCHED_HRTICK is not set
# CONFIG_KEXEC is not set
# CONFIG_CRASH_DUMP is not set
CONFIG_PHYSICAL_START=0x1000000
# CONFIG_RELOCATABLE is not set
CONFIG_PHYSICAL_ALIGN=0x1000000
CONFIG_COMPAT_VDSO=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_OVERRIDE is not set
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y

#
# Power management and ACPI options
#
# CONFIG_SUSPEND is not set
# CONFIG_HIBERNATION is not set
# CONFIG_PM_RUNTIME is not set
CONFIG_ACPI=y
# CONFIG_ACPI_PROCFS is not set
# CONFIG_ACPI_PROCFS_POWER is not set
CONFIG_ACPI_EC_DEBUGFS=y
# CONFIG_ACPI_PROC_EVENT is not set
CONFIG_ACPI_AC=y
CONFIG_ACPI_BATTERY=y
CONFIG_ACPI_BUTTON=y
# CONFIG_ACPI_VIDEO is not set
# CONFIG_ACPI_FAN is not set
# CONFIG_ACPI_DOCK is not set
CONFIG_ACPI_PROCESSOR=y
CONFIG_ACPI_PROCESSOR_AGGREGATOR=y
CONFIG_ACPI_THERMAL=y
# CONFIG_ACPI_CUSTOM_DSDT is not set
CONFIG_ACPI_BLACKLIST_YEAR=0
# CONFIG_ACPI_DEBUG is not set
# CONFIG_ACPI_PCI_SLOT is not set
CONFIG_X86_PM_TIMER=y
CONFIG_ACPI_CONTAINER=y
CONFIG_ACPI_HOTPLUG_MEMORY=y
# CONFIG_ACPI_SBS is not set
CONFIG_ACPI_HED=y
# CONFIG_ACPI_CUSTOM_METHOD is not set
# CONFIG_ACPI_APEI is not set
# CONFIG_SFI is not set

#
# CPU Frequency scaling
#
# CONFIG_CPU_FREQ is not set
CONFIG_CPU_IDLE=y
CONFIG_CPU_IDLE_GOV_LADDER=y
CONFIG_CPU_IDLE_GOV_MENU=y
CONFIG_INTEL_IDLE=y

#
# Memory power savings
#
CONFIG_I7300_IDLE_IOAT_CHANNEL=y
CONFIG_I7300_IDLE=y

#
# Bus options (PCI etc.)
#
CONFIG_PCI=y
CONFIG_PCI_DIRECT=y
CONFIG_PCI_MMCONFIG=y
CONFIG_PCI_DOMAINS=y
# CONFIG_PCI_CNB20LE_QUIRK is not set
CONFIG_PCIEPORTBUS=y
CONFIG_HOTPLUG_PCI_PCIE=y
# CONFIG_PCIEAER is not set
CONFIG_PCIEASPM=y
# CONFIG_PCIEASPM_DEBUG is not set
CONFIG_ARCH_SUPPORTS_MSI=y
CONFIG_PCI_MSI=y
# CONFIG_PCI_DEBUG is not set
# CONFIG_PCI_STUB is not set
CONFIG_HT_IRQ=y
CONFIG_PCI_ATS=y
# CONFIG_PCI_IOV is not set
CONFIG_PCI_PRI=y
# CONFIG_PCI_PASID is not set
# CONFIG_PCI_IOAPIC is not set
CONFIG_PCI_LABEL=y
CONFIG_ISA_DMA_API=y
CONFIG_AMD_NB=y
CONFIG_PCCARD=y
# CONFIG_PCMCIA is not set
CONFIG_CARDBUS=y

#
# PC-card bridges
#
CONFIG_YENTA=y
CONFIG_YENTA_O2=y
CONFIG_YENTA_RICOH=y
CONFIG_YENTA_TI=y
CONFIG_YENTA_ENE_TUNE=y
CONFIG_YENTA_TOSHIBA=y
CONFIG_HOTPLUG_PCI=y
CONFIG_HOTPLUG_PCI_FAKE=y
# CONFIG_HOTPLUG_PCI_ACPI is not set
# CONFIG_HOTPLUG_PCI_CPCI is not set
# CONFIG_HOTPLUG_PCI_SHPC is not set
CONFIG_RAPIDIO=y
# CONFIG_RAPIDIO_TSI721 is not set
CONFIG_RAPIDIO_DISC_TIMEOUT=30
# CONFIG_RAPIDIO_ENABLE_RX_TX_PORTS is not set
CONFIG_RAPIDIO_DEBUG=y
CONFIG_RAPIDIO_TSI57X=y
# CONFIG_RAPIDIO_CPS_XX is not set
# CONFIG_RAPIDIO_TSI568 is not set
# CONFIG_RAPIDIO_CPS_GEN2 is not set
# CONFIG_RAPIDIO_TSI500 is not set

#
# Executable file formats / Emulations
#
CONFIG_BINFMT_ELF=y
CONFIG_COMPAT_BINFMT_ELF=y
CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
# CONFIG_HAVE_AOUT is not set
CONFIG_BINFMT_MISC=y
CONFIG_IA32_EMULATION=y
CONFIG_IA32_AOUT=y
CONFIG_X86_X32_ABI=y
CONFIG_COMPAT=y
CONFIG_COMPAT_FOR_U64_ALIGNMENT=y
CONFIG_KEYS_COMPAT=y
CONFIG_HAVE_TEXT_POKE_SMP=y
CONFIG_NET=y

#
# Networking options
#
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_UNIX_DIAG=y
CONFIG_XFRM=y
# CONFIG_XFRM_USER is not set
# CONFIG_XFRM_SUB_POLICY is not set
# CONFIG_XFRM_MIGRATE is not set
# CONFIG_XFRM_STATISTICS is not set
# CONFIG_NET_KEY is not set
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
# CONFIG_IP_ADVANCED_ROUTER is not set
CONFIG_IP_ROUTE_CLASSID=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
CONFIG_IP_PNP_RARP=y
# CONFIG_NET_IPIP is not set
CONFIG_NET_IPGRE_DEMUX=y
CONFIG_NET_IPGRE=y
# CONFIG_NET_IPGRE_BROADCAST is not set
# CONFIG_IP_MROUTE is not set
# CONFIG_ARPD is not set
# CONFIG_SYN_COOKIES is not set
# CONFIG_INET_AH is not set
# CONFIG_INET_ESP is not set
# CONFIG_INET_IPCOMP is not set
# CONFIG_INET_XFRM_TUNNEL is not set
# CONFIG_INET_TUNNEL is not set
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
CONFIG_INET_XFRM_MODE_TUNNEL=y
# CONFIG_INET_XFRM_MODE_BEET is not set
CONFIG_INET_LRO=y
# CONFIG_INET_DIAG is not set
# CONFIG_TCP_CONG_ADVANCED is not set
CONFIG_TCP_CONG_CUBIC=y
CONFIG_DEFAULT_TCP_CONG="cubic"
CONFIG_TCP_MD5SIG=y
CONFIG_IPV6=y
CONFIG_IPV6_PRIVACY=y
# CONFIG_IPV6_ROUTER_PREF is not set
CONFIG_IPV6_OPTIMISTIC_DAD=y
# CONFIG_INET6_AH is not set
# CONFIG_INET6_ESP is not set
# CONFIG_INET6_IPCOMP is not set
# CONFIG_IPV6_MIP6 is not set
# CONFIG_INET6_XFRM_TUNNEL is not set
# CONFIG_INET6_TUNNEL is not set
# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set
# CONFIG_INET6_XFRM_MODE_TUNNEL is not set
CONFIG_INET6_XFRM_MODE_BEET=y
CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=y
# CONFIG_IPV6_SIT is not set
# CONFIG_IPV6_TUNNEL is not set
# CONFIG_IPV6_MULTIPLE_TABLES is not set
# CONFIG_IPV6_MROUTE is not set
# CONFIG_NETLABEL is not set
CONFIG_NETWORK_SECMARK=y
CONFIG_NETWORK_PHY_TIMESTAMPING=y
CONFIG_NETFILTER=y
CONFIG_NETFILTER_DEBUG=y
# CONFIG_NETFILTER_ADVANCED is not set

#
# Core Netfilter Configuration
#
# CONFIG_NETFILTER_NETLINK_LOG is not set
# CONFIG_NF_CONNTRACK is not set
CONFIG_NETFILTER_XTABLES=y

#
# Xtables combined modules
#
# CONFIG_NETFILTER_XT_MARK is not set

#
# Xtables targets
#
# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
CONFIG_NETFILTER_XT_TARGET_SECMARK=y
# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set

#
# Xtables matches
#
# CONFIG_NETFILTER_XT_MATCH_POLICY is not set
# CONFIG_IP_VS is not set

#
# IP: Netfilter Configuration
#
# CONFIG_NF_DEFRAG_IPV4 is not set
CONFIG_IP_NF_IPTABLES=y
# CONFIG_IP_NF_FILTER is not set
# CONFIG_IP_NF_TARGET_LOG is not set
# CONFIG_IP_NF_TARGET_ULOG is not set
CONFIG_IP_NF_MANGLE=y
CONFIG_IP_NF_RAW=y

#
# IPv6: Netfilter Configuration
#
# CONFIG_NF_DEFRAG_IPV6 is not set
# CONFIG_IP6_NF_IPTABLES is not set
CONFIG_IP_DCCP=y

#
# DCCP CCIDs Configuration (EXPERIMENTAL)
#
# CONFIG_IP_DCCP_CCID2_DEBUG is not set
# CONFIG_IP_DCCP_CCID3 is not set

#
# DCCP Kernel Hacking
#
CONFIG_IP_DCCP_DEBUG=y
CONFIG_IP_SCTP=y
# CONFIG_SCTP_DBG_MSG is not set
CONFIG_SCTP_DBG_OBJCNT=y
# CONFIG_SCTP_HMAC_NONE is not set
# CONFIG_SCTP_HMAC_SHA1 is not set
CONFIG_SCTP_HMAC_MD5=y
CONFIG_RDS=y
# CONFIG_RDS_TCP is not set
CONFIG_RDS_DEBUG=y
# CONFIG_TIPC is not set
# CONFIG_ATM is not set
CONFIG_L2TP=y
# CONFIG_L2TP_DEBUGFS is not set
# CONFIG_L2TP_V3 is not set
# CONFIG_BRIDGE is not set
# CONFIG_NET_DSA is not set
CONFIG_VLAN_8021Q=y
# CONFIG_VLAN_8021Q_GVRP is not set
CONFIG_DECNET=y
CONFIG_DECNET_ROUTER=y
# CONFIG_LLC2 is not set
# CONFIG_IPX is not set
# CONFIG_ATALK is not set
CONFIG_X25=y
CONFIG_LAPB=y
# CONFIG_ECONET is not set
CONFIG_WAN_ROUTER=y
# CONFIG_PHONET is not set
CONFIG_IEEE802154=y
# CONFIG_IEEE802154_6LOWPAN is not set
CONFIG_NET_SCHED=y

#
# Queueing/Scheduling
#
CONFIG_NET_SCH_CBQ=y
CONFIG_NET_SCH_HTB=y
# CONFIG_NET_SCH_HFSC is not set
# CONFIG_NET_SCH_PRIO is not set
# CONFIG_NET_SCH_MULTIQ is not set
# CONFIG_NET_SCH_RED is not set
# CONFIG_NET_SCH_SFB is not set
CONFIG_NET_SCH_SFQ=y
CONFIG_NET_SCH_TEQL=y
CONFIG_NET_SCH_TBF=y
CONFIG_NET_SCH_GRED=y
# CONFIG_NET_SCH_DSMARK is not set
CONFIG_NET_SCH_NETEM=y
# CONFIG_NET_SCH_DRR is not set
# CONFIG_NET_SCH_MQPRIO is not set
CONFIG_NET_SCH_CHOKE=y
# CONFIG_NET_SCH_QFQ is not set
# CONFIG_NET_SCH_INGRESS is not set

#
# Classification
#
CONFIG_NET_CLS=y
CONFIG_NET_CLS_BASIC=y
# CONFIG_NET_CLS_TCINDEX is not set
CONFIG_NET_CLS_ROUTE4=y
CONFIG_NET_CLS_FW=y
# CONFIG_NET_CLS_U32 is not set
# CONFIG_NET_CLS_RSVP is not set
# CONFIG_NET_CLS_RSVP6 is not set
CONFIG_NET_CLS_FLOW=y
CONFIG_NET_EMATCH=y
CONFIG_NET_EMATCH_STACK=32
# CONFIG_NET_EMATCH_CMP is not set
CONFIG_NET_EMATCH_NBYTE=y
# CONFIG_NET_EMATCH_U32 is not set
# CONFIG_NET_EMATCH_META is not set
# CONFIG_NET_EMATCH_TEXT is not set
CONFIG_NET_CLS_ACT=y
# CONFIG_NET_ACT_POLICE is not set
CONFIG_NET_ACT_GACT=y
# CONFIG_GACT_PROB is not set
# CONFIG_NET_ACT_MIRRED is not set
CONFIG_NET_ACT_IPT=y
CONFIG_NET_ACT_NAT=y
CONFIG_NET_ACT_PEDIT=y
CONFIG_NET_ACT_SIMP=y
CONFIG_NET_ACT_SKBEDIT=y
# CONFIG_NET_ACT_CSUM is not set
# CONFIG_NET_CLS_IND is not set
CONFIG_NET_SCH_FIFO=y
# CONFIG_DCB is not set
CONFIG_DNS_RESOLVER=y
# CONFIG_BATMAN_ADV is not set
# CONFIG_OPENVSWITCH is not set
CONFIG_BQL=y
CONFIG_HAVE_BPF_JIT=y

#
# Network testing
#
CONFIG_NET_PKTGEN=y
# CONFIG_NET_DROP_MONITOR is not set
CONFIG_HAMRADIO=y

#
# Packet Radio protocols
#
# CONFIG_AX25 is not set
# CONFIG_CAN is not set
CONFIG_IRDA=y

#
# IrDA protocols
#
CONFIG_IRLAN=y
CONFIG_IRNET=y
CONFIG_IRCOMM=y
# CONFIG_IRDA_ULTRA is not set

#
# IrDA options
#
# CONFIG_IRDA_CACHE_LAST_LSAP is not set
CONFIG_IRDA_FAST_RR=y
CONFIG_IRDA_DEBUG=y

#
# Infrared-port device drivers
#

#
# SIR device drivers
#
CONFIG_IRTTY_SIR=y

#
# Dongle support
#
CONFIG_DONGLE=y
CONFIG_ESI_DONGLE=y
CONFIG_ACTISYS_DONGLE=y
CONFIG_TEKRAM_DONGLE=y
CONFIG_TOIM3232_DONGLE=y
CONFIG_LITELINK_DONGLE=y
CONFIG_MA600_DONGLE=y
CONFIG_GIRBIL_DONGLE=y
CONFIG_MCP2120_DONGLE=y
CONFIG_OLD_BELKIN_DONGLE=y
CONFIG_ACT200L_DONGLE=y
# CONFIG_KINGSUN_DONGLE is not set
CONFIG_KSDAZZLE_DONGLE=y
CONFIG_KS959_DONGLE=y

#
# FIR device drivers
#
CONFIG_USB_IRDA=y
# CONFIG_SIGMATEL_FIR is not set
# CONFIG_NSC_FIR is not set
CONFIG_WINBOND_FIR=y
# CONFIG_SMC_IRCC_FIR is not set
# CONFIG_ALI_FIR is not set
CONFIG_VLSI_FIR=y
CONFIG_VIA_FIR=y
# CONFIG_MCS_FIR is not set
# CONFIG_BT is not set
CONFIG_AF_RXRPC=y
CONFIG_AF_RXRPC_DEBUG=y
# CONFIG_RXKAD is not set
CONFIG_FIB_RULES=y
CONFIG_WIRELESS=y
# CONFIG_CFG80211 is not set
# CONFIG_LIB80211 is not set

#
# CFG80211 needs to be enabled for MAC80211
#
# CONFIG_WIMAX is not set
# CONFIG_RFKILL is not set
CONFIG_NET_9P=y
CONFIG_NET_9P_VIRTIO=y
# CONFIG_NET_9P_DEBUG is not set
CONFIG_CAIF=y
CONFIG_CAIF_DEBUG=y
# CONFIG_CAIF_NETDEV is not set
CONFIG_CAIF_USB=y
CONFIG_CEPH_LIB=y
CONFIG_CEPH_LIB_PRETTYDEBUG=y
# CONFIG_CEPH_LIB_USE_DNS_RESOLVER is not set
# CONFIG_NFC is not set

#
# Device Drivers
#

#
# Generic Driver Options
#
CONFIG_UEVENT_HELPER_PATH=""
# CONFIG_DEVTMPFS is not set
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y
CONFIG_FW_LOADER=y
CONFIG_FIRMWARE_IN_KERNEL=y
CONFIG_EXTRA_FIRMWARE=""
# CONFIG_DEBUG_DRIVER is not set
CONFIG_DEBUG_DEVRES=y
# CONFIG_SYS_HYPERVISOR is not set
# CONFIG_GENERIC_CPU_DEVICES is not set
CONFIG_REGMAP=y
CONFIG_REGMAP_I2C=y
CONFIG_REGMAP_SPI=y
CONFIG_REGMAP_IRQ=y
# CONFIG_DMA_SHARED_BUFFER is not set
CONFIG_CONNECTOR=y
# CONFIG_PROC_EVENTS is not set
# CONFIG_MTD is not set
# CONFIG_PARPORT is not set
CONFIG_PNP=y
CONFIG_PNP_DEBUG_MESSAGES=y

#
# Protocols
#
CONFIG_PNPACPI=y
CONFIG_BLK_DEV=y
CONFIG_BLK_DEV_FD=y
# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set
CONFIG_BLK_CPQ_DA=y
CONFIG_BLK_CPQ_CISS_DA=y
CONFIG_CISS_SCSI_TAPE=y
# CONFIG_BLK_DEV_DAC960 is not set
# CONFIG_BLK_DEV_UMEM is not set
# CONFIG_BLK_DEV_COW_COMMON is not set
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
CONFIG_BLK_DEV_CRYPTOLOOP=y
CONFIG_BLK_DEV_DRBD=y
CONFIG_DRBD_FAULT_INJECTION=y
# CONFIG_BLK_DEV_NBD is not set
# CONFIG_BLK_DEV_NVME is not set
CONFIG_BLK_DEV_OSD=y
CONFIG_BLK_DEV_SX8=y
# CONFIG_BLK_DEV_UB is not set
# CONFIG_BLK_DEV_RAM is not set
CONFIG_CDROM_PKTCDVD=y
CONFIG_CDROM_PKTCDVD_BUFFERS=8
# CONFIG_CDROM_PKTCDVD_WCACHE is not set
# CONFIG_ATA_OVER_ETH is not set
CONFIG_VIRTIO_BLK=y
CONFIG_BLK_DEV_HD=y
CONFIG_BLK_DEV_RBD=y

#
# Misc devices
#
# CONFIG_SENSORS_LIS3LV02D is not set
CONFIG_AD525X_DPOT=y
# CONFIG_AD525X_DPOT_I2C is not set
# CONFIG_AD525X_DPOT_SPI is not set
CONFIG_IBM_ASM=y
# CONFIG_PHANTOM is not set
CONFIG_INTEL_MID_PTI=y
# CONFIG_SGI_IOC4 is not set
CONFIG_TIFM_CORE=y
CONFIG_TIFM_7XX1=y
CONFIG_ICS932S401=y
# CONFIG_ENCLOSURE_SERVICES is not set
# CONFIG_CS5535_MFGPT is not set
CONFIG_HP_ILO=y
# CONFIG_APDS9802ALS is not set
CONFIG_ISL29003=y
# CONFIG_ISL29020 is not set
CONFIG_SENSORS_TSL2550=y
# CONFIG_SENSORS_BH1780 is not set
CONFIG_SENSORS_BH1770=y
# CONFIG_SENSORS_APDS990X is not set
# CONFIG_HMC6352 is not set
# CONFIG_DS1682 is not set
# CONFIG_TI_DAC7512 is not set
# CONFIG_VMWARE_BALLOON is not set
# CONFIG_BMP085 is not set
# CONFIG_PCH_PHUB is not set
# CONFIG_USB_SWITCH_FSA9480 is not set
# CONFIG_C2PORT is not set

#
# EEPROM support
#
# CONFIG_EEPROM_AT24 is not set
# CONFIG_EEPROM_AT25 is not set
# CONFIG_EEPROM_LEGACY is not set
# CONFIG_EEPROM_MAX6875 is not set
CONFIG_EEPROM_93CX6=y
CONFIG_EEPROM_93XX46=y
CONFIG_CB710_CORE=y
CONFIG_CB710_DEBUG=y
CONFIG_CB710_DEBUG_ASSUMPTIONS=y

#
# Texas Instruments shared transport line discipline
#
# CONFIG_TI_ST is not set
# CONFIG_SENSORS_LIS3_I2C is not set

#
# Altera FPGA firmware download module
#
# CONFIG_ALTERA_STAPL is not set
CONFIG_HAVE_IDE=y
# CONFIG_IDE is not set

#
# SCSI device support
#
CONFIG_SCSI_MOD=y
# CONFIG_RAID_ATTRS is not set
CONFIG_SCSI=y
CONFIG_SCSI_DMA=y
CONFIG_SCSI_TGT=y
CONFIG_SCSI_NETLINK=y
# CONFIG_SCSI_PROC_FS is not set

#
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=y
# CONFIG_CHR_DEV_ST is not set
# CONFIG_CHR_DEV_OSST is not set
# CONFIG_BLK_DEV_SR is not set
# CONFIG_CHR_DEV_SG is not set
# CONFIG_CHR_DEV_SCH is not set
# CONFIG_SCSI_MULTI_LUN is not set
# CONFIG_SCSI_CONSTANTS is not set
# CONFIG_SCSI_LOGGING is not set
# CONFIG_SCSI_SCAN_ASYNC is not set

#
# SCSI Transports
#
CONFIG_SCSI_SPI_ATTRS=y
CONFIG_SCSI_FC_ATTRS=y
CONFIG_SCSI_FC_TGT_ATTRS=y
CONFIG_SCSI_ISCSI_ATTRS=y
CONFIG_SCSI_SAS_ATTRS=y
CONFIG_SCSI_SAS_LIBSAS=y
CONFIG_SCSI_SAS_ATA=y
# CONFIG_SCSI_SAS_HOST_SMP is not set
# CONFIG_SCSI_SRP_ATTRS is not set
CONFIG_SCSI_LOWLEVEL=y
CONFIG_ISCSI_TCP=y
CONFIG_ISCSI_BOOT_SYSFS=y
CONFIG_SCSI_CXGB3_ISCSI=y
CONFIG_SCSI_CXGB4_ISCSI=y
CONFIG_SCSI_BNX2_ISCSI=y
CONFIG_SCSI_BNX2X_FCOE=y
# CONFIG_BE2ISCSI is not set
CONFIG_BLK_DEV_3W_XXXX_RAID=y
# CONFIG_SCSI_HPSA is not set
# CONFIG_SCSI_3W_9XXX is not set
# CONFIG_SCSI_3W_SAS is not set
CONFIG_SCSI_ACARD=y
# CONFIG_SCSI_AACRAID is not set
CONFIG_SCSI_AIC7XXX=y
CONFIG_AIC7XXX_CMDS_PER_DEVICE=32
CONFIG_AIC7XXX_RESET_DELAY_MS=5000
CONFIG_AIC7XXX_DEBUG_ENABLE=y
CONFIG_AIC7XXX_DEBUG_MASK=0
CONFIG_AIC7XXX_REG_PRETTY_PRINT=y
# CONFIG_SCSI_AIC7XXX_OLD is not set
CONFIG_SCSI_AIC79XX=y
CONFIG_AIC79XX_CMDS_PER_DEVICE=32
CONFIG_AIC79XX_RESET_DELAY_MS=5000
# CONFIG_AIC79XX_DEBUG_ENABLE is not set
CONFIG_AIC79XX_DEBUG_MASK=0
CONFIG_AIC79XX_REG_PRETTY_PRINT=y
# CONFIG_SCSI_AIC94XX is not set
# CONFIG_SCSI_MVSAS is not set
CONFIG_SCSI_MVUMI=y
CONFIG_SCSI_DPT_I2O=y
CONFIG_SCSI_ADVANSYS=y
# CONFIG_SCSI_ARCMSR is not set
CONFIG_MEGARAID_NEWGEN=y
CONFIG_MEGARAID_MM=y
CONFIG_MEGARAID_MAILBOX=y
# CONFIG_MEGARAID_LEGACY is not set
CONFIG_MEGARAID_SAS=y
# CONFIG_SCSI_MPT2SAS is not set
CONFIG_SCSI_HPTIOP=y
CONFIG_SCSI_BUSLOGIC=y
CONFIG_VMWARE_PVSCSI=y
CONFIG_LIBFC=y
CONFIG_LIBFCOE=y
CONFIG_FCOE=y
CONFIG_FCOE_FNIC=y
CONFIG_SCSI_DMX3191D=y
# CONFIG_SCSI_EATA is not set
CONFIG_SCSI_FUTURE_DOMAIN=y
CONFIG_SCSI_GDTH=y
CONFIG_SCSI_ISCI=y
CONFIG_SCSI_IPS=y
CONFIG_SCSI_INITIO=y
# CONFIG_SCSI_INIA100 is not set
CONFIG_SCSI_STEX=y
# CONFIG_SCSI_SYM53C8XX_2 is not set
CONFIG_SCSI_IPR=y
# CONFIG_SCSI_IPR_TRACE is not set
# CONFIG_SCSI_IPR_DUMP is not set
# CONFIG_SCSI_QLOGIC_1280 is not set
# CONFIG_SCSI_QLA_FC is not set
CONFIG_SCSI_QLA_ISCSI=y
# CONFIG_SCSI_LPFC is not set
CONFIG_SCSI_DC395x=y
# CONFIG_SCSI_DC390T is not set
CONFIG_SCSI_DEBUG=y
CONFIG_SCSI_PMCRAID=y
# CONFIG_SCSI_PM8001 is not set
# CONFIG_SCSI_SRP is not set
CONFIG_SCSI_BFA_FC=y
CONFIG_SCSI_DH=y
# CONFIG_SCSI_DH_RDAC is not set
# CONFIG_SCSI_DH_HP_SW is not set
# CONFIG_SCSI_DH_EMC is not set
CONFIG_SCSI_DH_ALUA=y
CONFIG_SCSI_OSD_INITIATOR=y
CONFIG_SCSI_OSD_ULD=y
CONFIG_SCSI_OSD_DPRINT_SENSE=1
CONFIG_SCSI_OSD_DEBUG=y
CONFIG_ATA=y
# CONFIG_ATA_NONSTANDARD is not set
CONFIG_ATA_VERBOSE_ERROR=y
# CONFIG_ATA_ACPI is not set
CONFIG_SATA_PMP=y

#
# Controllers with non-SFF native interface
#
CONFIG_SATA_AHCI=y
# CONFIG_SATA_AHCI_PLATFORM is not set
# CONFIG_SATA_INIC162X is not set
CONFIG_SATA_ACARD_AHCI=y
# CONFIG_SATA_SIL24 is not set
CONFIG_ATA_SFF=y

#
# SFF controllers with custom DMA interface
#
# CONFIG_PDC_ADMA is not set
CONFIG_SATA_QSTOR=y
# CONFIG_SATA_SX4 is not set
CONFIG_ATA_BMDMA=y

#
# SATA SFF controllers with BMDMA
#
CONFIG_ATA_PIIX=y
# CONFIG_SATA_MV is not set
CONFIG_SATA_NV=y
# CONFIG_SATA_PROMISE is not set
# CONFIG_SATA_SIL is not set
CONFIG_SATA_SIS=y
CONFIG_SATA_SVW=y
CONFIG_SATA_ULI=y
CONFIG_SATA_VIA=y
CONFIG_SATA_VITESSE=y

#
# PATA SFF controllers with BMDMA
#
CONFIG_PATA_ALI=y
CONFIG_PATA_AMD=y
CONFIG_PATA_ARASAN_CF=y
# CONFIG_PATA_ARTOP is not set
CONFIG_PATA_ATIIXP=y
CONFIG_PATA_ATP867X=y
CONFIG_PATA_CMD64X=y
CONFIG_PATA_CS5520=y
# CONFIG_PATA_CS5530 is not set
# CONFIG_PATA_CS5536 is not set
# CONFIG_PATA_CYPRESS is not set
CONFIG_PATA_EFAR=y
CONFIG_PATA_HPT366=y
CONFIG_PATA_HPT37X=y
# CONFIG_PATA_HPT3X2N is not set
# CONFIG_PATA_HPT3X3 is not set
# CONFIG_PATA_IT8213 is not set
CONFIG_PATA_IT821X=y
# CONFIG_PATA_JMICRON is not set
# CONFIG_PATA_MARVELL is not set
CONFIG_PATA_NETCELL=y
# CONFIG_PATA_NINJA32 is not set
CONFIG_PATA_NS87415=y
CONFIG_PATA_OLDPIIX=y
# CONFIG_PATA_OPTIDMA is not set
# CONFIG_PATA_PDC2027X is not set
# CONFIG_PATA_PDC_OLD is not set
CONFIG_PATA_RADISYS=y
CONFIG_PATA_RDC=y
CONFIG_PATA_SC1200=y
CONFIG_PATA_SCH=y
# CONFIG_PATA_SERVERWORKS is not set
# CONFIG_PATA_SIL680 is not set
CONFIG_PATA_SIS=y
CONFIG_PATA_TOSHIBA=y
CONFIG_PATA_TRIFLEX=y
# CONFIG_PATA_VIA is not set
CONFIG_PATA_WINBOND=y

#
# PIO-only SFF controllers
#
# CONFIG_PATA_CMD640_PCI is not set
CONFIG_PATA_MPIIX=y
CONFIG_PATA_NS87410=y
CONFIG_PATA_OPTI=y
CONFIG_PATA_RZ1000=y

#
# Generic fallback / legacy drivers
#
CONFIG_ATA_GENERIC=y
CONFIG_PATA_LEGACY=y
CONFIG_MD=y
CONFIG_BLK_DEV_MD=y
CONFIG_MD_AUTODETECT=y
# CONFIG_MD_LINEAR is not set
# CONFIG_MD_RAID0 is not set
CONFIG_MD_RAID1=y
CONFIG_MD_RAID10=y
# CONFIG_MD_RAID456 is not set
# CONFIG_MD_MULTIPATH is not set
CONFIG_MD_FAULTY=y
# CONFIG_BLK_DEV_DM is not set
CONFIG_TARGET_CORE=y
# CONFIG_TCM_IBLOCK is not set
CONFIG_TCM_FILEIO=y
# CONFIG_TCM_PSCSI is not set
# CONFIG_LOOPBACK_TARGET is not set
CONFIG_TCM_FC=y
CONFIG_ISCSI_TARGET=y
CONFIG_FUSION=y
# CONFIG_FUSION_SPI is not set
# CONFIG_FUSION_FC is not set
# CONFIG_FUSION_SAS is not set
CONFIG_FUSION_MAX_SGE=128
CONFIG_FUSION_LOGGING=y

#
# IEEE 1394 (FireWire) support
#
CONFIG_FIREWIRE=y
CONFIG_FIREWIRE_OHCI=y
CONFIG_FIREWIRE_OHCI_DEBUG=y
CONFIG_FIREWIRE_SBP2=y
CONFIG_FIREWIRE_NET=y
CONFIG_FIREWIRE_NOSY=y
CONFIG_I2O=y
CONFIG_I2O_LCT_NOTIFY_ON_CHANGES=y
# CONFIG_I2O_EXT_ADAPTEC is not set
CONFIG_I2O_CONFIG=y
CONFIG_I2O_CONFIG_OLD_IOCTL=y
# CONFIG_I2O_BUS is not set
CONFIG_I2O_BLOCK=y
CONFIG_I2O_SCSI=y
CONFIG_I2O_PROC=y
CONFIG_MACINTOSH_DRIVERS=y
# CONFIG_MAC_EMUMOUSEBTN is not set
CONFIG_NETDEVICES=y
CONFIG_NET_CORE=y
CONFIG_BONDING=y
CONFIG_DUMMY=y
CONFIG_EQUALIZER=y
CONFIG_NET_FC=y
CONFIG_MII=y
CONFIG_IEEE802154_DRIVERS=y
# CONFIG_IEEE802154_FAKEHARD is not set
CONFIG_IFB=y
# CONFIG_NET_TEAM is not set
# CONFIG_MACVLAN is not set
CONFIG_NETCONSOLE=y
# CONFIG_NETCONSOLE_DYNAMIC is not set
CONFIG_NETPOLL=y
# CONFIG_NETPOLL_TRAP is not set
CONFIG_NET_POLL_CONTROLLER=y
# CONFIG_RIONET is not set
CONFIG_TUN=y
# CONFIG_VETH is not set
CONFIG_VIRTIO_NET=y
CONFIG_ARCNET=y
# CONFIG_ARCNET_1201 is not set
# CONFIG_ARCNET_1051 is not set
# CONFIG_ARCNET_RAW is not set
CONFIG_ARCNET_CAP=y
# CONFIG_ARCNET_COM90xx is not set
CONFIG_ARCNET_COM90xxIO=y
# CONFIG_ARCNET_RIM_I is not set
CONFIG_ARCNET_COM20020=y
CONFIG_ARCNET_COM20020_PCI=y

#
# CAIF transport drivers
#
CONFIG_CAIF_TTY=y
CONFIG_CAIF_SPI_SLAVE=y
# CONFIG_CAIF_SPI_SYNC is not set
CONFIG_CAIF_HSI=y
CONFIG_ETHERNET=y
CONFIG_MDIO=y
# CONFIG_NET_VENDOR_3COM is not set
CONFIG_NET_VENDOR_ADAPTEC=y
# CONFIG_ADAPTEC_STARFIRE is not set
# CONFIG_NET_VENDOR_ALTEON is not set
# CONFIG_NET_VENDOR_AMD is not set
CONFIG_NET_VENDOR_ATHEROS=y
# CONFIG_ATL2 is not set
# CONFIG_ATL1 is not set
# CONFIG_ATL1E is not set
CONFIG_ATL1C=y
CONFIG_NET_VENDOR_BROADCOM=y
CONFIG_B44=y
CONFIG_B44_PCI_AUTOSELECT=y
CONFIG_B44_PCICORE_AUTOSELECT=y
CONFIG_B44_PCI=y
CONFIG_BNX2=y
CONFIG_CNIC=y
CONFIG_TIGON3=y
CONFIG_BNX2X=y
# CONFIG_NET_VENDOR_BROCADE is not set
# CONFIG_NET_CALXEDA_XGMAC is not set
CONFIG_NET_VENDOR_CHELSIO=y
# CONFIG_CHELSIO_T1 is not set
CONFIG_CHELSIO_T3=y
CONFIG_CHELSIO_T4=y
# CONFIG_CHELSIO_T4VF is not set
# CONFIG_NET_VENDOR_CISCO is not set
CONFIG_DNET=y
# CONFIG_NET_VENDOR_DEC is not set
CONFIG_NET_VENDOR_DLINK=y
CONFIG_DL2K=y
# CONFIG_SUNDANCE is not set
# CONFIG_NET_VENDOR_EMULEX is not set
CONFIG_NET_VENDOR_EXAR=y
# CONFIG_S2IO is not set
# CONFIG_VXGE is not set
CONFIG_NET_VENDOR_HP=y
CONFIG_HP100=y
# CONFIG_NET_VENDOR_INTEL is not set
CONFIG_IP1000=y
# CONFIG_JME is not set
CONFIG_NET_VENDOR_MARVELL=y
# CONFIG_SKGE is not set
# CONFIG_SKY2 is not set
CONFIG_NET_VENDOR_MELLANOX=y
# CONFIG_MLX4_EN is not set
# CONFIG_MLX4_CORE is not set
CONFIG_NET_VENDOR_MICREL=y
# CONFIG_KS8842 is not set
CONFIG_KS8851=y
# CONFIG_KS8851_MLL is not set
CONFIG_KSZ884X_PCI=y
# CONFIG_NET_VENDOR_MICROCHIP is not set
CONFIG_NET_VENDOR_MYRI=y
# CONFIG_MYRI10GE is not set
CONFIG_FEALNX=y
# CONFIG_NET_VENDOR_NATSEMI is not set
CONFIG_NET_VENDOR_NVIDIA=y
CONFIG_FORCEDETH=y
CONFIG_NET_VENDOR_OKI=y
# CONFIG_PCH_GBE is not set
# CONFIG_ETHOC is not set
# CONFIG_NET_PACKET_ENGINE is not set
# CONFIG_NET_VENDOR_QLOGIC is not set
# CONFIG_NET_VENDOR_REALTEK is not set
CONFIG_NET_VENDOR_RDC=y
# CONFIG_R6040 is not set
CONFIG_NET_VENDOR_SEEQ=y
# CONFIG_SEEQ8005 is not set
# CONFIG_NET_VENDOR_SILAN is not set
CONFIG_NET_VENDOR_SIS=y
# CONFIG_SIS900 is not set
CONFIG_SIS190=y
CONFIG_SFC=y
CONFIG_NET_VENDOR_SMSC=y
CONFIG_EPIC100=y
CONFIG_SMSC9420=y
# CONFIG_NET_VENDOR_STMICRO is not set
# CONFIG_NET_VENDOR_SUN is not set
# CONFIG_NET_VENDOR_TEHUTI is not set
CONFIG_NET_VENDOR_TI=y
# CONFIG_TLAN is not set
# CONFIG_NET_VENDOR_VIA is not set
CONFIG_FDDI=y
# CONFIG_DEFXX is not set
CONFIG_SKFP=y
# CONFIG_HIPPI is not set
# CONFIG_NET_SB1000 is not set
CONFIG_PHYLIB=y

#
# MII PHY device drivers
#
CONFIG_MARVELL_PHY=y
CONFIG_DAVICOM_PHY=y
CONFIG_QSEMI_PHY=y
# CONFIG_LXT_PHY is not set
# CONFIG_CICADA_PHY is not set
CONFIG_VITESSE_PHY=y
CONFIG_SMSC_PHY=y
CONFIG_BROADCOM_PHY=y
CONFIG_ICPLUS_PHY=y
CONFIG_REALTEK_PHY=y
CONFIG_NATIONAL_PHY=y
# CONFIG_STE10XP is not set
# CONFIG_LSI_ET1011C_PHY is not set
CONFIG_MICREL_PHY=y
CONFIG_FIXED_PHY=y
CONFIG_MDIO_BITBANG=y
# CONFIG_MDIO_GPIO is not set
# CONFIG_MICREL_KS8995MA is not set
CONFIG_PPP=y
CONFIG_PPP_BSDCOMP=y
# CONFIG_PPP_DEFLATE is not set
# CONFIG_PPP_FILTER is not set
# CONFIG_PPP_MPPE is not set
# CONFIG_PPP_MULTILINK is not set
CONFIG_PPPOE=y
# CONFIG_PPTP is not set
CONFIG_PPPOL2TP=y
CONFIG_PPP_ASYNC=y
# CONFIG_PPP_SYNC_TTY is not set
# CONFIG_SLIP is not set
CONFIG_SLHC=y
# CONFIG_TR is not set

#
# USB Network Adapters
#
# CONFIG_USB_CATC is not set
CONFIG_USB_KAWETH=y
# CONFIG_USB_PEGASUS is not set
# CONFIG_USB_RTL8150 is not set
# CONFIG_USB_USBNET is not set
CONFIG_USB_IPHETH=y
# CONFIG_WLAN is not set

#
# Enable WiMAX (Networking options) to see the WiMAX drivers
#
CONFIG_WAN=y
# CONFIG_HDLC is not set
CONFIG_DLCI=y
CONFIG_DLCI_MAX=8
CONFIG_WAN_ROUTER_DRIVERS=y
CONFIG_CYCLADES_SYNC=y
# CONFIG_CYCLOMX_X25 is not set
CONFIG_LAPBETHER=y
CONFIG_X25_ASY=y
# CONFIG_SBNI is not set
CONFIG_VMXNET3=y
# CONFIG_HYPERV_NET is not set
# CONFIG_ISDN is not set
CONFIG_PHONE=y
# CONFIG_PHONE_IXJ is not set

#
# Input device support
#
CONFIG_INPUT=y
# CONFIG_INPUT_FF_MEMLESS is not set
CONFIG_INPUT_POLLDEV=y
CONFIG_INPUT_SPARSEKMAP=y

#
# Userland interfaces
#
CONFIG_INPUT_MOUSEDEV=y
CONFIG_INPUT_MOUSEDEV_PSAUX=y
CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
# CONFIG_INPUT_JOYDEV is not set
CONFIG_INPUT_EVDEV=y
CONFIG_INPUT_EVBUG=y

#
# Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
# CONFIG_KEYBOARD_ADP5520 is not set
CONFIG_KEYBOARD_ADP5588=y
CONFIG_KEYBOARD_ADP5589=y
CONFIG_KEYBOARD_ATKBD=y
# CONFIG_KEYBOARD_QT1070 is not set
CONFIG_KEYBOARD_QT2160=y
# CONFIG_KEYBOARD_LKKBD is not set
# CONFIG_KEYBOARD_GPIO is not set
# CONFIG_KEYBOARD_GPIO_POLLED is not set
# CONFIG_KEYBOARD_TCA6416 is not set
CONFIG_KEYBOARD_TCA8418=y
# CONFIG_KEYBOARD_MATRIX is not set
# CONFIG_KEYBOARD_LM8323 is not set
CONFIG_KEYBOARD_MAX7359=y
# CONFIG_KEYBOARD_MCS is not set
CONFIG_KEYBOARD_MPR121=y
# CONFIG_KEYBOARD_NEWTON is not set
# CONFIG_KEYBOARD_OPENCORES is not set
CONFIG_KEYBOARD_STOWAWAY=y
# CONFIG_KEYBOARD_SUNKBD is not set
CONFIG_KEYBOARD_STMPE=y
CONFIG_KEYBOARD_TC3589X=y
CONFIG_KEYBOARD_TWL4030=y
# CONFIG_KEYBOARD_XTKBD is not set
# CONFIG_INPUT_MOUSE is not set
# CONFIG_INPUT_JOYSTICK is not set
CONFIG_INPUT_TABLET=y
CONFIG_TABLET_USB_ACECAD=y
# CONFIG_TABLET_USB_AIPTEK is not set
# CONFIG_TABLET_USB_GTCO is not set
CONFIG_TABLET_USB_HANWANG=y
# CONFIG_TABLET_USB_KBTAB is not set
# CONFIG_TABLET_USB_WACOM is not set
# CONFIG_INPUT_TOUCHSCREEN is not set
CONFIG_INPUT_MISC=y
# CONFIG_INPUT_88PM860X_ONKEY is not set
CONFIG_INPUT_AD714X=y
# CONFIG_INPUT_AD714X_I2C is not set
# CONFIG_INPUT_AD714X_SPI is not set
CONFIG_INPUT_BMA150=y
CONFIG_INPUT_PCSPKR=y
CONFIG_INPUT_MAX8925_ONKEY=y
CONFIG_INPUT_MMA8450=y
CONFIG_INPUT_MPU3050=y
# CONFIG_INPUT_APANEL is not set
CONFIG_INPUT_GP2A=y
# CONFIG_INPUT_GPIO_TILT_POLLED is not set
CONFIG_INPUT_ATLAS_BTNS=y
# CONFIG_INPUT_ATI_REMOTE2 is not set
# CONFIG_INPUT_KEYSPAN_REMOTE is not set
CONFIG_INPUT_KXTJ9=y
CONFIG_INPUT_KXTJ9_POLLED_MODE=y
CONFIG_INPUT_POWERMATE=y
CONFIG_INPUT_YEALINK=y
CONFIG_INPUT_CM109=y
CONFIG_INPUT_TWL4030_PWRBUTTON=y
# CONFIG_INPUT_TWL4030_VIBRA is not set
# CONFIG_INPUT_TWL6040_VIBRA is not set
CONFIG_INPUT_UINPUT=y
CONFIG_INPUT_PCF50633_PMU=y
# CONFIG_INPUT_PCF8574 is not set
CONFIG_INPUT_GPIO_ROTARY_ENCODER=y
CONFIG_INPUT_WM831X_ON=y
# CONFIG_INPUT_PCAP is not set
CONFIG_INPUT_ADXL34X=y
CONFIG_INPUT_ADXL34X_I2C=y
# CONFIG_INPUT_ADXL34X_SPI is not set
# CONFIG_INPUT_CMA3000 is not set

#
# Hardware I/O ports
#
CONFIG_SERIO=y
CONFIG_SERIO_I8042=y
CONFIG_SERIO_SERPORT=y
CONFIG_SERIO_CT82C710=y
CONFIG_SERIO_PCIPS2=y
CONFIG_SERIO_LIBPS2=y
CONFIG_SERIO_RAW=y
CONFIG_SERIO_ALTERA_PS2=y
CONFIG_SERIO_PS2MULT=y
# CONFIG_GAMEPORT is not set

#
# Character devices
#
CONFIG_VT=y
CONFIG_CONSOLE_TRANSLATIONS=y
CONFIG_VT_CONSOLE=y
CONFIG_HW_CONSOLE=y
# CONFIG_VT_HW_CONSOLE_BINDING is not set
CONFIG_UNIX98_PTYS=y
CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=256
CONFIG_SERIAL_NONSTANDARD=y
# CONFIG_ROCKETPORT is not set
CONFIG_CYCLADES=y
CONFIG_CYZ_INTR=y
# CONFIG_MOXA_INTELLIO is not set
# CONFIG_MOXA_SMARTIO is not set
CONFIG_SYNCLINK=y
# CONFIG_SYNCLINKMP is not set
CONFIG_SYNCLINK_GT=y
# CONFIG_NOZOMI is not set
CONFIG_ISI=y
CONFIG_N_HDLC=y
# CONFIG_N_GSM is not set
# CONFIG_TRACE_SINK is not set
CONFIG_DEVKMEM=y
CONFIG_STALDRV=y

#
# Serial drivers
#
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_SERIAL_8250_PCI=y
CONFIG_SERIAL_8250_PNP=y
CONFIG_SERIAL_8250_NR_UARTS=4
CONFIG_SERIAL_8250_RUNTIME_UARTS=4
# CONFIG_SERIAL_8250_EXTENDED is not set

#
# Non-8250 serial port support
#
CONFIG_SERIAL_MAX3100=y
CONFIG_SERIAL_MAX3107=y
CONFIG_SERIAL_MFD_HSU=y
CONFIG_SERIAL_MFD_HSU_CONSOLE=y
CONFIG_SERIAL_UARTLITE=y
# CONFIG_SERIAL_UARTLITE_CONSOLE is not set
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
CONFIG_CONSOLE_POLL=y
# CONFIG_SERIAL_JSM is not set
# CONFIG_SERIAL_TIMBERDALE is not set
# CONFIG_SERIAL_ALTERA_JTAGUART is not set
CONFIG_SERIAL_ALTERA_UART=y
CONFIG_SERIAL_ALTERA_UART_MAXPORTS=4
CONFIG_SERIAL_ALTERA_UART_BAUDRATE=115200
# CONFIG_SERIAL_ALTERA_UART_CONSOLE is not set
# CONFIG_SERIAL_IFX6X60 is not set
# CONFIG_SERIAL_PCH_UART is not set
# CONFIG_SERIAL_XILINX_PS_UART is not set
CONFIG_HVC_DRIVER=y
CONFIG_VIRTIO_CONSOLE=y
# CONFIG_IPMI_HANDLER is not set
CONFIG_HW_RANDOM=y
CONFIG_HW_RANDOM_TIMERIOMEM=y
CONFIG_HW_RANDOM_INTEL=y
# CONFIG_HW_RANDOM_AMD is not set
# CONFIG_HW_RANDOM_VIA is not set
# CONFIG_HW_RANDOM_VIRTIO is not set
CONFIG_NVRAM=y
# CONFIG_R3964 is not set
# CONFIG_APPLICOM is not set
# CONFIG_MWAVE is not set
# CONFIG_RAW_DRIVER is not set
# CONFIG_HPET is not set
CONFIG_HANGCHECK_TIMER=y
CONFIG_TCG_TPM=y
CONFIG_TCG_TIS=y
# CONFIG_TCG_NSC is not set
# CONFIG_TCG_ATMEL is not set
CONFIG_TCG_INFINEON=y
# CONFIG_TELCLOCK is not set
CONFIG_DEVPORT=y
# CONFIG_RAMOOPS is not set
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_COMPAT=y
CONFIG_I2C_CHARDEV=y
# CONFIG_I2C_MUX is not set
# CONFIG_I2C_HELPER_AUTO is not set
CONFIG_I2C_SMBUS=y

#
# I2C Algorithms
#
CONFIG_I2C_ALGOBIT=y
# CONFIG_I2C_ALGOPCF is not set
CONFIG_I2C_ALGOPCA=y

#
# I2C Hardware Bus support
#

#
# PC SMBus host controller drivers
#
CONFIG_I2C_ALI1535=y
CONFIG_I2C_ALI1563=y
# CONFIG_I2C_ALI15X3 is not set
CONFIG_I2C_AMD756=y
# CONFIG_I2C_AMD756_S4882 is not set
CONFIG_I2C_AMD8111=y
CONFIG_I2C_I801=y
CONFIG_I2C_ISCH=y
# CONFIG_I2C_PIIX4 is not set
CONFIG_I2C_NFORCE2=y
CONFIG_I2C_NFORCE2_S4985=y
CONFIG_I2C_SIS5595=y
# CONFIG_I2C_SIS630 is not set
CONFIG_I2C_SIS96X=y
CONFIG_I2C_VIA=y
# CONFIG_I2C_VIAPRO is not set

#
# ACPI drivers
#
# CONFIG_I2C_SCMI is not set

#
# I2C system bus drivers (mostly embedded / system-on-chip)
#
CONFIG_I2C_DESIGNWARE_PCI=y
# CONFIG_I2C_GPIO is not set
CONFIG_I2C_INTEL_MID=y
# CONFIG_I2C_OCORES is not set
CONFIG_I2C_PCA_PLATFORM=y
# CONFIG_I2C_PXA_PCI is not set
CONFIG_I2C_SIMTEC=y
CONFIG_I2C_XILINX=y
# CONFIG_I2C_EG20T is not set

#
# External I2C/SMBus adapter drivers
#
# CONFIG_I2C_DIOLAN_U2C is not set
# CONFIG_I2C_PARPORT_LIGHT is not set
# CONFIG_I2C_TAOS_EVM is not set
CONFIG_I2C_TINY_USB=y

#
# Other I2C/SMBus bus drivers
#
# CONFIG_I2C_DEBUG_CORE is not set
# CONFIG_I2C_DEBUG_ALGO is not set
CONFIG_I2C_DEBUG_BUS=y
CONFIG_SPI=y
CONFIG_SPI_DEBUG=y
CONFIG_SPI_MASTER=y

#
# SPI Master Controller Drivers
#
# CONFIG_SPI_ALTERA is not set
CONFIG_SPI_BITBANG=y
# CONFIG_SPI_GPIO is not set
CONFIG_SPI_OC_TINY=y
# CONFIG_SPI_PXA2XX_PCI is not set
# CONFIG_SPI_TOPCLIFF_PCH is not set
# CONFIG_SPI_XILINX is not set
# CONFIG_SPI_DESIGNWARE is not set

#
# SPI Protocol Masters
#
# CONFIG_SPI_SPIDEV is not set
CONFIG_SPI_TLE62X0=y

#
# PPS support
#
CONFIG_PPS=y
# CONFIG_PPS_DEBUG is not set

#
# PPS clients support
#
# CONFIG_PPS_CLIENT_KTIMER is not set
CONFIG_PPS_CLIENT_LDISC=y
# CONFIG_PPS_CLIENT_GPIO is not set

#
# PPS generators support
#

#
# PTP clock support
#
CONFIG_PTP_1588_CLOCK=y
# CONFIG_DP83640_PHY is not set
CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
CONFIG_GPIOLIB=y
CONFIG_DEBUG_GPIO=y
CONFIG_GPIO_SYSFS=y
CONFIG_GPIO_GENERIC=y

#
# Memory mapped GPIO drivers:
#
CONFIG_GPIO_GENERIC_PLATFORM=y
CONFIG_GPIO_IT8761E=y
# CONFIG_GPIO_SCH is not set
CONFIG_GPIO_VX855=y

#
# I2C GPIO expanders:
#
# CONFIG_GPIO_MAX7300 is not set
# CONFIG_GPIO_MAX732X is not set
# CONFIG_GPIO_PCA953X is not set
# CONFIG_GPIO_PCF857X is not set
# CONFIG_GPIO_SX150X is not set
# CONFIG_GPIO_STMPE is not set
CONFIG_GPIO_TC3589X=y
CONFIG_GPIO_TPS65912=y
# CONFIG_GPIO_TWL4030 is not set
CONFIG_GPIO_WM831X=y
CONFIG_GPIO_WM8350=y
CONFIG_GPIO_WM8994=y
CONFIG_GPIO_ADP5520=y
# CONFIG_GPIO_ADP5588 is not set

#
# PCI GPIO expanders:
#
# CONFIG_GPIO_CS5535 is not set
CONFIG_GPIO_BT8XX=y
# CONFIG_GPIO_LANGWELL is not set
CONFIG_GPIO_PCH=y
CONFIG_GPIO_ML_IOH=y
# CONFIG_GPIO_TIMBERDALE is not set
CONFIG_GPIO_RDC321X=y

#
# SPI GPIO expanders:
#
# CONFIG_GPIO_MAX7301 is not set
CONFIG_GPIO_MCP23S08=y
CONFIG_GPIO_MC33880=y
CONFIG_GPIO_74X164=y

#
# AC97 GPIO expanders:
#

#
# MODULbus GPIO expanders:
#
CONFIG_W1=y
CONFIG_W1_CON=y

#
# 1-wire Bus Masters
#
# CONFIG_W1_MASTER_MATROX is not set
# CONFIG_W1_MASTER_DS2490 is not set
CONFIG_W1_MASTER_DS2482=y
# CONFIG_W1_MASTER_DS1WM is not set
CONFIG_W1_MASTER_GPIO=y

#
# 1-wire Slaves
#
CONFIG_W1_SLAVE_THERM=y
# CONFIG_W1_SLAVE_SMEM is not set
CONFIG_W1_SLAVE_DS2408=y
CONFIG_W1_SLAVE_DS2423=y
CONFIG_W1_SLAVE_DS2431=y
# CONFIG_W1_SLAVE_DS2433 is not set
# CONFIG_W1_SLAVE_DS2760 is not set
# CONFIG_W1_SLAVE_DS2780 is not set
CONFIG_W1_SLAVE_BQ27000=y
CONFIG_POWER_SUPPLY=y
# CONFIG_POWER_SUPPLY_DEBUG is not set
# CONFIG_PDA_POWER is not set
# CONFIG_MAX8925_POWER is not set
# CONFIG_WM831X_BACKUP is not set
# CONFIG_WM831X_POWER is not set
CONFIG_WM8350_POWER=y
# CONFIG_TEST_POWER is not set
# CONFIG_BATTERY_DS2780 is not set
# CONFIG_BATTERY_DS2782 is not set
CONFIG_BATTERY_SBS=y
CONFIG_BATTERY_BQ27x00=y
# CONFIG_BATTERY_BQ27X00_I2C is not set
CONFIG_BATTERY_BQ27X00_PLATFORM=y
CONFIG_BATTERY_DA9030=y
CONFIG_BATTERY_MAX17040=y
CONFIG_BATTERY_MAX17042=y
CONFIG_CHARGER_PCF50633=y
# CONFIG_CHARGER_ISP1704 is not set
# CONFIG_CHARGER_MAX8903 is not set
CONFIG_CHARGER_TWL4030=y
# CONFIG_CHARGER_LP8727 is not set
# CONFIG_CHARGER_GPIO is not set
# CONFIG_HWMON is not set
CONFIG_THERMAL=y
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_CORE=y
CONFIG_WATCHDOG_NOWAYOUT=y

#
# Watchdog Device Drivers
#
CONFIG_SOFT_WATCHDOG=y
# CONFIG_WM831X_WATCHDOG is not set
CONFIG_WM8350_WATCHDOG=y
# CONFIG_TWL4030_WATCHDOG is not set
CONFIG_ACQUIRE_WDT=y
CONFIG_ADVANTECH_WDT=y
CONFIG_ALIM1535_WDT=y
# CONFIG_ALIM7101_WDT is not set
CONFIG_F71808E_WDT=y
# CONFIG_SP5100_TCO is not set
CONFIG_SC520_WDT=y
CONFIG_SBC_FITPC2_WATCHDOG=y
# CONFIG_EUROTECH_WDT is not set
# CONFIG_IB700_WDT is not set
# CONFIG_IBMASR is not set
CONFIG_WAFER_WDT=y
# CONFIG_I6300ESB_WDT is not set
# CONFIG_ITCO_WDT is not set
# CONFIG_IT8712F_WDT is not set
CONFIG_IT87_WDT=y
CONFIG_HP_WATCHDOG=y
# CONFIG_HPWDT_NMI_DECODING is not set
# CONFIG_SC1200_WDT is not set
CONFIG_PC87413_WDT=y
# CONFIG_NV_TCO is not set
# CONFIG_60XX_WDT is not set
# CONFIG_SBC8360_WDT is not set
CONFIG_CPU5_WDT=y
CONFIG_SMSC_SCH311X_WDT=y
CONFIG_SMSC37B787_WDT=y
CONFIG_VIA_WDT=y
CONFIG_W83627HF_WDT=y
# CONFIG_W83697HF_WDT is not set
# CONFIG_W83697UG_WDT is not set
CONFIG_W83877F_WDT=y
CONFIG_W83977F_WDT=y
# CONFIG_MACHZ_WDT is not set
CONFIG_SBC_EPX_C3_WATCHDOG=y

#
# PCI-based Watchdog Cards
#
CONFIG_PCIPCWATCHDOG=y
# CONFIG_WDTPCI is not set

#
# USB-based Watchdog Cards
#
# CONFIG_USBPCWATCHDOG is not set
CONFIG_SSB_POSSIBLE=y

#
# Sonics Silicon Backplane
#
CONFIG_SSB=y
CONFIG_SSB_SPROM=y
CONFIG_SSB_PCIHOST_POSSIBLE=y
CONFIG_SSB_PCIHOST=y
# CONFIG_SSB_B43_PCI_BRIDGE is not set
CONFIG_SSB_DEBUG=y
CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y
CONFIG_SSB_DRIVER_PCICORE=y
CONFIG_BCMA_POSSIBLE=y

#
# Broadcom specific AMBA
#
CONFIG_BCMA=y
CONFIG_BCMA_HOST_PCI_POSSIBLE=y
CONFIG_BCMA_HOST_PCI=y
# CONFIG_BCMA_DEBUG is not set

#
# Multifunction device drivers
#
CONFIG_MFD_CORE=y
CONFIG_MFD_88PM860X=y
CONFIG_MFD_SM501=y
CONFIG_MFD_SM501_GPIO=y
# CONFIG_HTC_PASIC3 is not set
CONFIG_HTC_I2CPLD=y
# CONFIG_TPS6105X is not set
CONFIG_TPS65010=y
CONFIG_TPS6507X=y
# CONFIG_MFD_TPS6586X is not set
# CONFIG_MFD_TPS65910 is not set
CONFIG_MFD_TPS65912=y
# CONFIG_MFD_TPS65912_I2C is not set
CONFIG_MFD_TPS65912_SPI=y
CONFIG_TWL4030_CORE=y
# CONFIG_TWL4030_MADC is not set
# CONFIG_MFD_TWL4030_AUDIO is not set
# CONFIG_TWL6030_PWM is not set
# CONFIG_TWL6040_CORE is not set
CONFIG_MFD_STMPE=y

#
# STMPE Interface Drivers
#
CONFIG_STMPE_I2C=y
CONFIG_STMPE_SPI=y
CONFIG_MFD_TC3589X=y
# CONFIG_MFD_TMIO is not set
CONFIG_PMIC_DA903X=y
CONFIG_PMIC_DA9052=y
# CONFIG_MFD_DA9052_SPI is not set
CONFIG_MFD_DA9052_I2C=y
CONFIG_PMIC_ADP5520=y
CONFIG_MFD_MAX8925=y
# CONFIG_MFD_MAX8997 is not set
# CONFIG_MFD_MAX8998 is not set
CONFIG_MFD_S5M_CORE=y
# CONFIG_MFD_WM8400 is not set
CONFIG_MFD_WM831X=y
CONFIG_MFD_WM831X_I2C=y
CONFIG_MFD_WM831X_SPI=y
CONFIG_MFD_WM8350=y
CONFIG_MFD_WM8350_I2C=y
CONFIG_MFD_WM8994=y
CONFIG_MFD_PCF50633=y
CONFIG_PCF50633_ADC=y
CONFIG_PCF50633_GPIO=y
# CONFIG_MFD_MC13XXX is not set
CONFIG_ABX500_CORE=y
CONFIG_AB3100_CORE=y
# CONFIG_AB3100_OTP is not set
CONFIG_EZX_PCAP=y
# CONFIG_AB8500_CORE is not set
CONFIG_MFD_CS5535=y
CONFIG_MFD_TIMBERDALE=y
CONFIG_LPC_SCH=y
CONFIG_MFD_RDC321X=y
# CONFIG_MFD_JANZ_CMODIO is not set
CONFIG_MFD_VX855=y
# CONFIG_MFD_WL1273_CORE is not set
CONFIG_MFD_AAT2870_CORE=y
# CONFIG_REGULATOR is not set
CONFIG_MEDIA_SUPPORT=y

#
# Multimedia core support
#
CONFIG_MEDIA_CONTROLLER=y
CONFIG_VIDEO_DEV=y
CONFIG_VIDEO_V4L2_COMMON=y
CONFIG_VIDEO_V4L2_SUBDEV_API=y
# CONFIG_DVB_CORE is not set
CONFIG_VIDEO_MEDIA=y

#
# Multimedia drivers
#
CONFIG_RC_CORE=y
CONFIG_LIRC=y
CONFIG_RC_MAP=y
# CONFIG_IR_NEC_DECODER is not set
# CONFIG_IR_RC5_DECODER is not set
CONFIG_IR_RC6_DECODER=y
CONFIG_IR_JVC_DECODER=y
CONFIG_IR_SONY_DECODER=y
# CONFIG_IR_RC5_SZ_DECODER is not set
CONFIG_IR_SANYO_DECODER=y
# CONFIG_IR_MCE_KBD_DECODER is not set
# CONFIG_IR_LIRC_CODEC is not set
CONFIG_RC_ATI_REMOTE=y
CONFIG_IR_ENE=y
CONFIG_IR_IMON=y
CONFIG_IR_MCEUSB=y
# CONFIG_IR_ITE_CIR is not set
# CONFIG_IR_FINTEK is not set
CONFIG_IR_NUVOTON=y
# CONFIG_IR_REDRAT3 is not set
CONFIG_IR_STREAMZAP=y
# CONFIG_IR_WINBOND_CIR is not set
# CONFIG_RC_LOOPBACK is not set
CONFIG_MEDIA_TUNER=y
CONFIG_MEDIA_TUNER_CUSTOMISE=y

#
# Customize TV tuners
#
# CONFIG_MEDIA_TUNER_SIMPLE is not set
CONFIG_MEDIA_TUNER_TDA8290=y
CONFIG_MEDIA_TUNER_TDA827X=y
CONFIG_MEDIA_TUNER_TDA18271=y
CONFIG_MEDIA_TUNER_TDA9887=y
# CONFIG_MEDIA_TUNER_TEA5761 is not set
CONFIG_MEDIA_TUNER_TEA5767=y
CONFIG_MEDIA_TUNER_MT20XX=y
# CONFIG_MEDIA_TUNER_MT2060 is not set
# CONFIG_MEDIA_TUNER_MT2063 is not set
# CONFIG_MEDIA_TUNER_MT2266 is not set
# CONFIG_MEDIA_TUNER_MT2131 is not set
# CONFIG_MEDIA_TUNER_QT1010 is not set
# CONFIG_MEDIA_TUNER_XC2028 is not set
# CONFIG_MEDIA_TUNER_XC5000 is not set
CONFIG_MEDIA_TUNER_XC4000=y
# CONFIG_MEDIA_TUNER_MXL5005S is not set
# CONFIG_MEDIA_TUNER_MXL5007T is not set
# CONFIG_MEDIA_TUNER_MC44S803 is not set
CONFIG_MEDIA_TUNER_MAX2165=y
# CONFIG_MEDIA_TUNER_TDA18218 is not set
# CONFIG_MEDIA_TUNER_TDA18212 is not set
CONFIG_VIDEO_V4L2=y
CONFIG_V4L2_MEM2MEM_DEV=y
CONFIG_VIDEOBUF2_CORE=y
CONFIG_VIDEOBUF2_MEMOPS=y
CONFIG_VIDEOBUF2_VMALLOC=y
# CONFIG_VIDEO_CAPTURE_DRIVERS is not set
CONFIG_V4L_MEM2MEM_DRIVERS=y
CONFIG_VIDEO_MEM2MEM_TESTDEV=y
CONFIG_RADIO_ADAPTERS=y
# CONFIG_RADIO_SI470X is not set
# CONFIG_USB_MR800 is not set
# CONFIG_USB_DSBR is not set
# CONFIG_RADIO_MAXIRADIO is not set
CONFIG_I2C_SI4713=y
CONFIG_RADIO_SI4713=y
# CONFIG_RADIO_TEA5764 is not set
# CONFIG_RADIO_SAA7706H is not set
# CONFIG_RADIO_TEF6862 is not set
# CONFIG_RADIO_TIMBERDALE is not set
# CONFIG_RADIO_WL1273 is not set

#
# Texas Instruments WL128x FM driver (ST based)
#

#
# Graphics support
#
CONFIG_AGP=y
# CONFIG_AGP_AMD64 is not set
# CONFIG_AGP_INTEL is not set
CONFIG_AGP_SIS=y
CONFIG_AGP_VIA=y
CONFIG_VGA_ARB=y
CONFIG_VGA_ARB_MAX_GPUS=16
CONFIG_VGA_SWITCHEROO=y
# CONFIG_DRM is not set
# CONFIG_STUB_POULSBO is not set
CONFIG_VGASTATE=y
CONFIG_VIDEO_OUTPUT_CONTROL=y
CONFIG_FB=y
# CONFIG_FIRMWARE_EDID is not set
CONFIG_FB_DDC=y
# CONFIG_FB_BOOT_VESA_SUPPORT is not set
CONFIG_FB_CFB_FILLRECT=y
CONFIG_FB_CFB_COPYAREA=y
CONFIG_FB_CFB_IMAGEBLIT=y
# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
CONFIG_FB_SYS_FILLRECT=y
CONFIG_FB_SYS_COPYAREA=y
CONFIG_FB_SYS_IMAGEBLIT=y
CONFIG_FB_FOREIGN_ENDIAN=y
# CONFIG_FB_BOTH_ENDIAN is not set
# CONFIG_FB_BIG_ENDIAN is not set
CONFIG_FB_LITTLE_ENDIAN=y
CONFIG_FB_SYS_FOPS=y
# CONFIG_FB_WMT_GE_ROPS is not set
CONFIG_FB_DEFERRED_IO=y
CONFIG_FB_HECUBA=y
CONFIG_FB_SVGALIB=y
# CONFIG_FB_MACMODES is not set
CONFIG_FB_BACKLIGHT=y
CONFIG_FB_MODE_HELPERS=y
CONFIG_FB_TILEBLITTING=y

#
# Frame buffer hardware drivers
#
# CONFIG_FB_CIRRUS is not set
CONFIG_FB_PM2=y
# CONFIG_FB_PM2_FIFO_DISCONNECT is not set
# CONFIG_FB_CYBER2000 is not set
# CONFIG_FB_ARC is not set
# CONFIG_FB_ASILIANT is not set
# CONFIG_FB_IMSTT is not set
# CONFIG_FB_VGA16 is not set
# CONFIG_FB_UVESA is not set
# CONFIG_FB_VESA is not set
# CONFIG_FB_EFI is not set
CONFIG_FB_N411=y
CONFIG_FB_HGA=y
CONFIG_FB_S1D13XXX=y
# CONFIG_FB_NVIDIA is not set
CONFIG_FB_RIVA=y
# CONFIG_FB_RIVA_I2C is not set
CONFIG_FB_RIVA_DEBUG=y
# CONFIG_FB_RIVA_BACKLIGHT is not set
# CONFIG_FB_LE80578 is not set
CONFIG_FB_MATROX=y
# CONFIG_FB_MATROX_MILLENIUM is not set
# CONFIG_FB_MATROX_MYSTIQUE is not set
CONFIG_FB_MATROX_G=y
CONFIG_FB_MATROX_I2C=y
# CONFIG_FB_MATROX_MAVEN is not set
# CONFIG_FB_RADEON is not set
# CONFIG_FB_ATY128 is not set
CONFIG_FB_ATY=y
# CONFIG_FB_ATY_CT is not set
CONFIG_FB_ATY_GX=y
CONFIG_FB_ATY_BACKLIGHT=y
# CONFIG_FB_S3 is not set
# CONFIG_FB_SAVAGE is not set
# CONFIG_FB_SIS is not set
CONFIG_FB_VIA=y
CONFIG_FB_VIA_DIRECT_PROCFS=y
# CONFIG_FB_VIA_X_COMPATIBILITY is not set
CONFIG_FB_NEOMAGIC=y
# CONFIG_FB_KYRO is not set
# CONFIG_FB_3DFX is not set
# CONFIG_FB_VOODOO1 is not set
CONFIG_FB_VT8623=y
# CONFIG_FB_TRIDENT is not set
# CONFIG_FB_ARK is not set
CONFIG_FB_PM3=y
CONFIG_FB_CARMINE=y
# CONFIG_FB_CARMINE_DRAM_EVAL is not set
CONFIG_CARMINE_DRAM_CUSTOM=y
# CONFIG_FB_GEODE is not set
# CONFIG_FB_TMIO is not set
# CONFIG_FB_SM501 is not set
CONFIG_FB_SMSCUFX=y
# CONFIG_FB_UDL is not set
# CONFIG_FB_VIRTUAL is not set
CONFIG_FB_METRONOME=y
CONFIG_FB_MB862XX=y
CONFIG_FB_MB862XX_PCI_GDC=y
CONFIG_FB_MB862XX_I2C=y
CONFIG_FB_BROADSHEET=y
CONFIG_BACKLIGHT_LCD_SUPPORT=y
# CONFIG_LCD_CLASS_DEVICE is not set
CONFIG_BACKLIGHT_CLASS_DEVICE=y
CONFIG_BACKLIGHT_GENERIC=y
CONFIG_BACKLIGHT_PROGEAR=y
CONFIG_BACKLIGHT_DA903X=y
CONFIG_BACKLIGHT_MAX8925=y
CONFIG_BACKLIGHT_APPLE=y
CONFIG_BACKLIGHT_SAHARA=y
# CONFIG_BACKLIGHT_WM831X is not set
# CONFIG_BACKLIGHT_ADP5520 is not set
CONFIG_BACKLIGHT_ADP8860=y
CONFIG_BACKLIGHT_ADP8870=y
CONFIG_BACKLIGHT_88PM860X=y
# CONFIG_BACKLIGHT_PCF50633 is not set
CONFIG_BACKLIGHT_AAT2870=y

#
# Console display driver support
#
CONFIG_VGA_CONSOLE=y
# CONFIG_VGACON_SOFT_SCROLLBACK is not set
CONFIG_DUMMY_CONSOLE=y
# CONFIG_FRAMEBUFFER_CONSOLE is not set
CONFIG_FONT_8x16=y
# CONFIG_LOGO is not set
CONFIG_SOUND=y
CONFIG_SOUND_OSS_CORE=y
# CONFIG_SOUND_OSS_CORE_PRECLAIM is not set
CONFIG_SND=y
CONFIG_SND_TIMER=y
CONFIG_SND_PCM=y
CONFIG_SND_HWDEP=y
CONFIG_SND_RAWMIDI=y
# CONFIG_SND_SEQUENCER is not set
# CONFIG_SND_MIXER_OSS is not set
# CONFIG_SND_PCM_OSS is not set
CONFIG_SND_DYNAMIC_MINORS=y
CONFIG_SND_SUPPORT_OLD_API=y
CONFIG_SND_VERBOSE_PROCFS=y
# CONFIG_SND_VERBOSE_PRINTK is not set
CONFIG_SND_DEBUG=y
# CONFIG_SND_DEBUG_VERBOSE is not set
# CONFIG_SND_PCM_XRUN_DEBUG is not set
CONFIG_SND_DMA_SGBUF=y
# CONFIG_SND_RAWMIDI_SEQ is not set
# CONFIG_SND_OPL3_LIB_SEQ is not set
# CONFIG_SND_OPL4_LIB_SEQ is not set
# CONFIG_SND_SBAWE_SEQ is not set
# CONFIG_SND_EMU10K1_SEQ is not set
CONFIG_SND_MPU401_UART=y
CONFIG_SND_DRIVERS=y
# CONFIG_SND_DUMMY is not set
# CONFIG_SND_ALOOP is not set
CONFIG_SND_MTPAV=y
# CONFIG_SND_SERIAL_U16550 is not set
CONFIG_SND_MPU401=y
# CONFIG_SND_PCI is not set
# CONFIG_SND_SPI is not set
CONFIG_SND_USB=y
# CONFIG_SND_USB_AUDIO is not set
# CONFIG_SND_USB_UA101 is not set
CONFIG_SND_USB_USX2Y=y
CONFIG_SND_USB_CAIAQ=y
CONFIG_SND_USB_CAIAQ_INPUT=y
CONFIG_SND_USB_US122L=y
CONFIG_SND_USB_6FIRE=y
# CONFIG_SND_FIREWIRE is not set
# CONFIG_SND_SOC is not set
CONFIG_SOUND_PRIME=y
CONFIG_SOUND_OSS=y
CONFIG_SOUND_TRACEINIT=y
# CONFIG_SOUND_DMAP is not set
CONFIG_SOUND_VMIDI=y
CONFIG_SOUND_TRIX=y
CONFIG_SOUND_MSS=y
# CONFIG_SOUND_MPU401 is not set
CONFIG_SOUND_PAS=y
# CONFIG_PAS_JOYSTICK is not set
CONFIG_SOUND_PSS=y
CONFIG_PSS_MIXER=y
CONFIG_SOUND_SB=y
# CONFIG_SOUND_YM3812 is not set
# CONFIG_SOUND_UART6850 is not set
# CONFIG_SOUND_AEDSP16 is not set
# CONFIG_SOUND_KAHLUA is not set
CONFIG_HID_SUPPORT=y
CONFIG_HID=y
CONFIG_HID_BATTERY_STRENGTH=y
CONFIG_HIDRAW=y

#
# USB Input Devices
#
# CONFIG_USB_HID is not set
# CONFIG_HID_PID is not set

#
# Special HID drivers
#
CONFIG_HID_HYPERV_MOUSE=y
CONFIG_USB_SUPPORT=y
CONFIG_USB_COMMON=y
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB_ARCH_HAS_OHCI=y
CONFIG_USB_ARCH_HAS_EHCI=y
CONFIG_USB_ARCH_HAS_XHCI=y
CONFIG_USB=y
CONFIG_USB_DEBUG=y
CONFIG_USB_ANNOUNCE_NEW_DEVICES=y

#
# Miscellaneous USB options
#
# CONFIG_USB_DEVICEFS is not set
# CONFIG_USB_DEVICE_CLASS is not set
CONFIG_USB_DYNAMIC_MINORS=y
CONFIG_USB_DWC3=y
# CONFIG_USB_DWC3_DEBUG is not set
# CONFIG_USB_MON is not set
# CONFIG_USB_WUSB_CBAF is not set

#
# USB Host Controller Drivers
#
CONFIG_USB_C67X00_HCD=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_HCD_DEBUGGING=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_ROOT_HUB_TT=y
# CONFIG_USB_EHCI_TT_NEWSCHED is not set
CONFIG_USB_EHCI_MV=y
CONFIG_USB_OXU210HP_HCD=y
CONFIG_USB_ISP116X_HCD=y
CONFIG_USB_ISP1760_HCD=y
CONFIG_USB_ISP1362_HCD=y
CONFIG_USB_OHCI_HCD=y
# CONFIG_USB_OHCI_HCD_SSB is not set
# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
CONFIG_USB_OHCI_LITTLE_ENDIAN=y
CONFIG_USB_UHCI_HCD=y
# CONFIG_USB_SL811_HCD is not set
# CONFIG_USB_R8A66597_HCD is not set
# CONFIG_USB_MUSB_HDRC is not set
# CONFIG_USB_RENESAS_USBHS is not set

#
# USB Device Class drivers
#
CONFIG_USB_ACM=y
# CONFIG_USB_PRINTER is not set
CONFIG_USB_WDM=y
# CONFIG_USB_TMC is not set

#
# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
#

#
# also be needed; see USB_STORAGE Help for more info
#
CONFIG_USB_STORAGE=y
# CONFIG_USB_STORAGE_DEBUG is not set
# CONFIG_USB_STORAGE_REALTEK is not set
CONFIG_USB_STORAGE_DATAFAB=y
CONFIG_USB_STORAGE_FREECOM=y
# CONFIG_USB_STORAGE_ISD200 is not set
CONFIG_USB_STORAGE_USBAT=y
# CONFIG_USB_STORAGE_SDDR09 is not set
CONFIG_USB_STORAGE_SDDR55=y
CONFIG_USB_STORAGE_JUMPSHOT=y
CONFIG_USB_STORAGE_ALAUDA=y
CONFIG_USB_STORAGE_ONETOUCH=y
CONFIG_USB_STORAGE_KARMA=y
CONFIG_USB_STORAGE_CYPRESS_ATACB=y
CONFIG_USB_STORAGE_ENE_UB6250=y
# CONFIG_USB_UAS is not set
CONFIG_USB_LIBUSUAL=y

#
# USB Imaging devices
#
CONFIG_USB_MDC800=y
CONFIG_USB_MICROTEK=y

#
# USB port drivers
#
# CONFIG_USB_SERIAL is not set

#
# USB Miscellaneous drivers
#
# CONFIG_USB_EMI62 is not set
# CONFIG_USB_EMI26 is not set
CONFIG_USB_ADUTUX=y
# CONFIG_USB_SEVSEG is not set
CONFIG_USB_RIO500=y
# CONFIG_USB_LEGOTOWER is not set
CONFIG_USB_LCD=y
# CONFIG_USB_LED is not set
# CONFIG_USB_CYPRESS_CY7C63 is not set
CONFIG_USB_CYTHERM=y
CONFIG_USB_IDMOUSE=y
# CONFIG_USB_FTDI_ELAN is not set
# CONFIG_USB_APPLEDISPLAY is not set
CONFIG_USB_SISUSBVGA=y
CONFIG_USB_SISUSBVGA_CON=y
# CONFIG_USB_LD is not set
CONFIG_USB_TRANCEVIBRATOR=y
# CONFIG_USB_IOWARRIOR is not set
CONFIG_USB_TEST=y
# CONFIG_USB_ISIGHTFW is not set
CONFIG_USB_YUREX=y
CONFIG_USB_GADGET=y
# CONFIG_USB_GADGET_DEBUG is not set
CONFIG_USB_GADGET_DEBUG_FILES=y
# CONFIG_USB_GADGET_DEBUG_FS is not set
CONFIG_USB_GADGET_VBUS_DRAW=2
CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
CONFIG_USB_R8A66597=y
# CONFIG_USB_MV_UDC is not set
# CONFIG_USB_M66592 is not set
# CONFIG_USB_AMD5536UDC is not set
# CONFIG_USB_CI13XXX_PCI is not set
# CONFIG_USB_NET2272 is not set
# CONFIG_USB_NET2280 is not set
# CONFIG_USB_GOKU is not set
# CONFIG_USB_EG20T is not set
# CONFIG_USB_DUMMY_HCD is not set
CONFIG_USB_GADGET_DUALSPEED=y
CONFIG_USB_GADGET_SUPERSPEED=y
# CONFIG_USB_ZERO is not set
# CONFIG_USB_AUDIO is not set
# CONFIG_USB_ETH is not set
# CONFIG_USB_G_NCM is not set
# CONFIG_USB_GADGETFS is not set
# CONFIG_USB_FUNCTIONFS is not set
CONFIG_USB_FILE_STORAGE=y
# CONFIG_USB_FILE_STORAGE_TEST is not set
# CONFIG_USB_MASS_STORAGE is not set
# CONFIG_USB_G_SERIAL is not set
# CONFIG_USB_MIDI_GADGET is not set
# CONFIG_USB_G_PRINTER is not set
# CONFIG_USB_CDC_COMPOSITE is not set
# CONFIG_USB_G_ACM_MS is not set
# CONFIG_USB_G_MULTI is not set
# CONFIG_USB_G_HID is not set
# CONFIG_USB_G_DBGP is not set
# CONFIG_USB_G_WEBCAM is not set

#
# OTG and related infrastructure
#
CONFIG_USB_OTG_UTILS=y
# CONFIG_USB_GPIO_VBUS is not set
CONFIG_TWL6030_USB=y
# CONFIG_NOP_USB_XCEIV is not set
# CONFIG_UWB is not set
# CONFIG_MMC is not set
CONFIG_MEMSTICK=y
CONFIG_MEMSTICK_DEBUG=y

#
# MemoryStick drivers
#
# CONFIG_MEMSTICK_UNSAFE_RESUME is not set
CONFIG_MSPRO_BLOCK=y

#
# MemoryStick Host Controller Drivers
#
CONFIG_MEMSTICK_TIFM_MS=y
# CONFIG_MEMSTICK_JMICRON_38X is not set
CONFIG_MEMSTICK_R592=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y

#
# LED drivers
#
CONFIG_LEDS_88PM860X=y
# CONFIG_LEDS_LM3530 is not set
CONFIG_LEDS_PCA9532=y
# CONFIG_LEDS_PCA9532_GPIO is not set
CONFIG_LEDS_GPIO=y
CONFIG_LEDS_LP3944=y
CONFIG_LEDS_LP5521=y
# CONFIG_LEDS_LP5523 is not set
CONFIG_LEDS_CLEVO_MAIL=y
CONFIG_LEDS_PCA955X=y
CONFIG_LEDS_WM831X_STATUS=y
# CONFIG_LEDS_WM8350 is not set
# CONFIG_LEDS_DA903X is not set
CONFIG_LEDS_DAC124S085=y
CONFIG_LEDS_BD2802=y
# CONFIG_LEDS_INTEL_SS4200 is not set
# CONFIG_LEDS_LT3593 is not set
# CONFIG_LEDS_ADP5520 is not set
# CONFIG_LEDS_TCA6507 is not set
CONFIG_LEDS_OT200=y
CONFIG_LEDS_TRIGGERS=y

#
# LED Triggers
#
CONFIG_LEDS_TRIGGER_TIMER=y
# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
CONFIG_LEDS_TRIGGER_GPIO=y
CONFIG_LEDS_TRIGGER_DEFAULT_ON=y

#
# iptables trigger is under Netfilter config (LED target)
#
CONFIG_ACCESSIBILITY=y
# CONFIG_A11Y_BRAILLE_CONSOLE is not set
# CONFIG_INFINIBAND is not set
CONFIG_EDAC=y

#
# Reporting subsystems
#
# CONFIG_EDAC_DEBUG is not set
CONFIG_EDAC_MM_EDAC=y
CONFIG_EDAC_E752X=y
# CONFIG_EDAC_I82975X is not set
# CONFIG_EDAC_I3000 is not set
# CONFIG_EDAC_I3200 is not set
CONFIG_EDAC_X38=y
CONFIG_EDAC_I5400=y
CONFIG_EDAC_I7CORE=y
# CONFIG_EDAC_I5000 is not set
CONFIG_EDAC_I5100=y
CONFIG_EDAC_I7300=y
CONFIG_EDAC_SBRIDGE=y
CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y
# CONFIG_RTC_HCTOSYS is not set
CONFIG_RTC_DEBUG=y

#
# RTC interfaces
#
# CONFIG_RTC_INTF_SYSFS is not set
CONFIG_RTC_INTF_PROC=y
CONFIG_RTC_INTF_DEV=y
CONFIG_RTC_INTF_DEV_UIE_EMUL=y
CONFIG_RTC_DRV_TEST=y

#
# I2C RTC drivers
#
# CONFIG_RTC_DRV_88PM860X is not set
# CONFIG_RTC_DRV_DS1307 is not set
CONFIG_RTC_DRV_DS1374=y
# CONFIG_RTC_DRV_DS1672 is not set
CONFIG_RTC_DRV_DS3232=y
# CONFIG_RTC_DRV_MAX6900 is not set
CONFIG_RTC_DRV_MAX8925=y
CONFIG_RTC_DRV_RS5C372=y
CONFIG_RTC_DRV_ISL1208=y
# CONFIG_RTC_DRV_ISL12022 is not set
# CONFIG_RTC_DRV_X1205 is not set
CONFIG_RTC_DRV_PCF8563=y
CONFIG_RTC_DRV_PCF8583=y
CONFIG_RTC_DRV_M41T80=y
CONFIG_RTC_DRV_M41T80_WDT=y
CONFIG_RTC_DRV_BQ32K=y
# CONFIG_RTC_DRV_TWL4030 is not set
CONFIG_RTC_DRV_S35390A=y
CONFIG_RTC_DRV_FM3130=y
# CONFIG_RTC_DRV_RX8581 is not set
# CONFIG_RTC_DRV_RX8025 is not set
CONFIG_RTC_DRV_EM3027=y
# CONFIG_RTC_DRV_RV3029C2 is not set

#
# SPI RTC drivers
#
# CONFIG_RTC_DRV_M41T93 is not set
# CONFIG_RTC_DRV_M41T94 is not set
CONFIG_RTC_DRV_DS1305=y
CONFIG_RTC_DRV_DS1390=y
# CONFIG_RTC_DRV_MAX6902 is not set
CONFIG_RTC_DRV_R9701=y
CONFIG_RTC_DRV_RS5C348=y
CONFIG_RTC_DRV_DS3234=y
# CONFIG_RTC_DRV_PCF2123 is not set

#
# Platform RTC drivers
#
# CONFIG_RTC_DRV_CMOS is not set
# CONFIG_RTC_DRV_DS1286 is not set
CONFIG_RTC_DRV_DS1511=y
# CONFIG_RTC_DRV_DS1553 is not set
CONFIG_RTC_DRV_DS1742=y
# CONFIG_RTC_DRV_STK17TA8 is not set
CONFIG_RTC_DRV_M48T86=y
CONFIG_RTC_DRV_M48T35=y
# CONFIG_RTC_DRV_M48T59 is not set
# CONFIG_RTC_DRV_MSM6242 is not set
# CONFIG_RTC_DRV_BQ4802 is not set
# CONFIG_RTC_DRV_RP5C01 is not set
# CONFIG_RTC_DRV_V3020 is not set
# CONFIG_RTC_DRV_WM831X is not set
# CONFIG_RTC_DRV_WM8350 is not set
# CONFIG_RTC_DRV_PCF50633 is not set
CONFIG_RTC_DRV_AB3100=y

#
# on-CPU RTC drivers
#
CONFIG_RTC_DRV_PCAP=y
CONFIG_DMADEVICES=y
CONFIG_DMADEVICES_DEBUG=y
# CONFIG_DMADEVICES_VDEBUG is not set

#
# DMA Devices
#
# CONFIG_INTEL_MID_DMAC is not set
CONFIG_INTEL_IOATDMA=y
CONFIG_TIMB_DMA=y
# CONFIG_PCH_DMA is not set
CONFIG_DMA_ENGINE=y

#
# DMA Clients
#
# CONFIG_NET_DMA is not set
CONFIG_ASYNC_TX_DMA=y
# CONFIG_DMATEST is not set
CONFIG_DCA=y
CONFIG_AUXDISPLAY=y
CONFIG_UIO=y
# CONFIG_UIO_CIF is not set
CONFIG_UIO_PDRV=y
CONFIG_UIO_PDRV_GENIRQ=y
# CONFIG_UIO_AEC is not set
# CONFIG_UIO_SERCOS3 is not set
# CONFIG_UIO_PCI_GENERIC is not set
# CONFIG_UIO_NETX is not set
CONFIG_VIRTIO=y
CONFIG_VIRTIO_RING=y

#
# Virtio drivers
#
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_BALLOON=y
# CONFIG_VIRTIO_MMIO is not set

#
# Microsoft Hyper-V guest support
#
CONFIG_HYPERV=y
# CONFIG_HYPERV_UTILS is not set
# CONFIG_STAGING is not set
# CONFIG_X86_PLATFORM_DEVICES is not set

#
# Hardware Spinlock drivers
#
CONFIG_CLKEVT_I8253=y
CONFIG_I8253_LOCK=y
CONFIG_CLKBLD_I8253=y
# CONFIG_IOMMU_SUPPORT is not set
# CONFIG_VIRT_DRIVERS is not set
CONFIG_PM_DEVFREQ=y

#
# DEVFREQ Governors
#
# CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND is not set
# CONFIG_DEVFREQ_GOV_PERFORMANCE is not set
CONFIG_DEVFREQ_GOV_POWERSAVE=y
# CONFIG_DEVFREQ_GOV_USERSPACE is not set

#
# DEVFREQ Drivers
#

#
# Firmware Drivers
#
# CONFIG_EDD is not set
CONFIG_FIRMWARE_MEMMAP=y
# CONFIG_EFI_VARS is not set
# CONFIG_DELL_RBU is not set
CONFIG_DCDBAS=y
CONFIG_DMIID=y
CONFIG_DMI_SYSFS=y
# CONFIG_ISCSI_IBFT_FIND is not set
# CONFIG_GOOGLE_FIRMWARE is not set

#
# File systems
#
CONFIG_EXT2_FS=y
CONFIG_EXT2_FS_XATTR=y
# CONFIG_EXT2_FS_POSIX_ACL is not set
CONFIG_EXT2_FS_SECURITY=y
CONFIG_EXT2_FS_XIP=y
CONFIG_EXT3_FS=y
# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
CONFIG_EXT3_FS_XATTR=y
CONFIG_EXT3_FS_POSIX_ACL=y
CONFIG_EXT3_FS_SECURITY=y
CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_XATTR=y
# CONFIG_EXT4_FS_POSIX_ACL is not set
CONFIG_EXT4_FS_SECURITY=y
CONFIG_EXT4_DEBUG=y
CONFIG_FS_XIP=y
CONFIG_JBD=y
CONFIG_JBD_DEBUG=y
CONFIG_JBD2=y
# CONFIG_JBD2_DEBUG is not set
CONFIG_FS_MBCACHE=y
CONFIG_REISERFS_FS=y
CONFIG_REISERFS_CHECK=y
CONFIG_REISERFS_PROC_INFO=y
# CONFIG_REISERFS_FS_XATTR is not set
# CONFIG_JFS_FS is not set
CONFIG_XFS_FS=y
# CONFIG_XFS_QUOTA is not set
# CONFIG_XFS_POSIX_ACL is not set
# CONFIG_XFS_RT is not set
# CONFIG_XFS_DEBUG is not set
CONFIG_GFS2_FS=y
CONFIG_GFS2_FS_LOCKING_DLM=y
CONFIG_OCFS2_FS=y
# CONFIG_OCFS2_FS_O2CB is not set
# CONFIG_OCFS2_FS_USERSPACE_CLUSTER is not set
CONFIG_OCFS2_FS_STATS=y
CONFIG_OCFS2_DEBUG_MASKLOG=y
# CONFIG_OCFS2_DEBUG_FS is not set
CONFIG_BTRFS_FS=y
CONFIG_BTRFS_FS_POSIX_ACL=y
CONFIG_BTRFS_FS_CHECK_INTEGRITY=y
CONFIG_NILFS2_FS=y
CONFIG_FS_POSIX_ACL=y
CONFIG_EXPORTFS=y
CONFIG_FILE_LOCKING=y
CONFIG_FSNOTIFY=y
CONFIG_DNOTIFY=y
CONFIG_INOTIFY_USER=y
# CONFIG_FANOTIFY is not set
CONFIG_QUOTA=y
# CONFIG_QUOTA_NETLINK_INTERFACE is not set
CONFIG_PRINT_QUOTA_WARNING=y
# CONFIG_QUOTA_DEBUG is not set
CONFIG_QUOTA_TREE=y
# CONFIG_QFMT_V1 is not set
# CONFIG_QFMT_V2 is not set
CONFIG_QUOTACTL=y
CONFIG_QUOTACTL_COMPAT=y
# CONFIG_AUTOFS4_FS is not set
CONFIG_FUSE_FS=y
CONFIG_CUSE=y

#
# Caches
#
CONFIG_FSCACHE=y
# CONFIG_FSCACHE_STATS is not set
# CONFIG_FSCACHE_HISTOGRAM is not set
# CONFIG_FSCACHE_DEBUG is not set
# CONFIG_FSCACHE_OBJECT_LIST is not set
CONFIG_CACHEFILES=y
# CONFIG_CACHEFILES_DEBUG is not set
CONFIG_CACHEFILES_HISTOGRAM=y

#
# CD-ROM/DVD Filesystems
#
CONFIG_ISO9660_FS=y
# CONFIG_JOLIET is not set
# CONFIG_ZISOFS is not set
CONFIG_UDF_FS=y
CONFIG_UDF_NLS=y

#
# DOS/FAT/NT Filesystems
#
# CONFIG_MSDOS_FS is not set
# CONFIG_VFAT_FS is not set
CONFIG_NTFS_FS=y
CONFIG_NTFS_DEBUG=y
# CONFIG_NTFS_RW is not set

#
# Pseudo filesystems
#
CONFIG_PROC_FS=y
# CONFIG_PROC_KCORE is not set
CONFIG_PROC_SYSCTL=y
CONFIG_PROC_PAGE_MONITOR=y
CONFIG_SYSFS=y
# CONFIG_TMPFS is not set
CONFIG_HUGETLBFS=y
CONFIG_HUGETLB_PAGE=y
CONFIG_CONFIGFS_FS=y
# CONFIG_MISC_FILESYSTEMS is not set
CONFIG_ORE=y
CONFIG_NETWORK_FILESYSTEMS=y
CONFIG_NFS_FS=y
# CONFIG_NFS_V3 is not set
CONFIG_NFS_V4=y
CONFIG_NFS_V4_1=y
CONFIG_PNFS_FILE_LAYOUT=y
CONFIG_PNFS_OBJLAYOUT=y
# CONFIG_ROOT_NFS is not set
CONFIG_NFS_FSCACHE=y
# CONFIG_NFS_USE_LEGACY_DNS is not set
CONFIG_NFS_USE_KERNEL_DNS=y
CONFIG_NFS_USE_NEW_IDMAPPER=y
CONFIG_NFSD=y
CONFIG_NFSD_V3=y
# CONFIG_NFSD_V3_ACL is not set
CONFIG_NFSD_V4=y
# CONFIG_NFSD_FAULT_INJECTION is not set
CONFIG_LOCKD=y
CONFIG_LOCKD_V4=y
CONFIG_NFS_COMMON=y
CONFIG_SUNRPC=y
CONFIG_SUNRPC_GSS=y
CONFIG_SUNRPC_BACKCHANNEL=y
# CONFIG_CEPH_FS is not set
# CONFIG_CIFS is not set
CONFIG_NCP_FS=y
CONFIG_NCPFS_PACKET_SIGNING=y
# CONFIG_NCPFS_IOCTL_LOCKING is not set
# CONFIG_NCPFS_STRONG is not set
CONFIG_NCPFS_NFS_NS=y
CONFIG_NCPFS_OS2_NS=y
# CONFIG_NCPFS_SMALLDOS is not set
# CONFIG_NCPFS_NLS is not set
CONFIG_NCPFS_EXTRAS=y
CONFIG_CODA_FS=y
CONFIG_AFS_FS=y
# CONFIG_AFS_DEBUG is not set
CONFIG_AFS_FSCACHE=y
CONFIG_9P_FS=y
# CONFIG_9P_FSCACHE is not set
# CONFIG_9P_FS_POSIX_ACL is not set
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
# CONFIG_NLS_CODEPAGE_437 is not set
# CONFIG_NLS_CODEPAGE_737 is not set
CONFIG_NLS_CODEPAGE_775=y
# CONFIG_NLS_CODEPAGE_850 is not set
# CONFIG_NLS_CODEPAGE_852 is not set
# CONFIG_NLS_CODEPAGE_855 is not set
CONFIG_NLS_CODEPAGE_857=y
CONFIG_NLS_CODEPAGE_860=y
CONFIG_NLS_CODEPAGE_861=y
# CONFIG_NLS_CODEPAGE_862 is not set
CONFIG_NLS_CODEPAGE_863=y
CONFIG_NLS_CODEPAGE_864=y
CONFIG_NLS_CODEPAGE_865=y
# CONFIG_NLS_CODEPAGE_866 is not set
# CONFIG_NLS_CODEPAGE_869 is not set
# CONFIG_NLS_CODEPAGE_936 is not set
# CONFIG_NLS_CODEPAGE_950 is not set
# CONFIG_NLS_CODEPAGE_932 is not set
CONFIG_NLS_CODEPAGE_949=y
# CONFIG_NLS_CODEPAGE_874 is not set
CONFIG_NLS_ISO8859_8=y
CONFIG_NLS_CODEPAGE_1250=y
# CONFIG_NLS_CODEPAGE_1251 is not set
# CONFIG_NLS_ASCII is not set
# CONFIG_NLS_ISO8859_1 is not set
# CONFIG_NLS_ISO8859_2 is not set
CONFIG_NLS_ISO8859_3=y
CONFIG_NLS_ISO8859_4=y
# CONFIG_NLS_ISO8859_5 is not set
CONFIG_NLS_ISO8859_6=y
CONFIG_NLS_ISO8859_7=y
CONFIG_NLS_ISO8859_9=y
# CONFIG_NLS_ISO8859_13 is not set
CONFIG_NLS_ISO8859_14=y
# CONFIG_NLS_ISO8859_15 is not set
CONFIG_NLS_KOI8_R=y
# CONFIG_NLS_KOI8_U is not set
CONFIG_NLS_UTF8=y
CONFIG_DLM=y
# CONFIG_DLM_DEBUG is not set

#
# Kernel hacking
#
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
# CONFIG_PRINTK_TIME is not set
CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4
CONFIG_ENABLE_WARN_DEPRECATED=y
CONFIG_ENABLE_MUST_CHECK=y
CONFIG_FRAME_WARN=2048
CONFIG_MAGIC_SYSRQ=y
CONFIG_STRIP_ASM_SYMS=y
CONFIG_UNUSED_SYMBOLS=y
CONFIG_DEBUG_FS=y
CONFIG_HEADERS_CHECK=y
# CONFIG_DEBUG_SECTION_MISMATCH is not set
CONFIG_DEBUG_KERNEL=y
CONFIG_DEBUG_SHIRQ=y
# CONFIG_LOCKUP_DETECTOR is not set
# CONFIG_HARDLOCKUP_DETECTOR is not set
# CONFIG_DETECT_HUNG_TASK is not set
CONFIG_SCHED_DEBUG=y
CONFIG_SCHEDSTATS=y
# CONFIG_TIMER_STATS is not set
CONFIG_DEBUG_OBJECTS=y
# CONFIG_DEBUG_OBJECTS_SELFTEST is not set
# CONFIG_DEBUG_OBJECTS_FREE is not set
# CONFIG_DEBUG_OBJECTS_TIMERS is not set
# CONFIG_DEBUG_OBJECTS_WORK is not set
# CONFIG_DEBUG_OBJECTS_RCU_HEAD is not set
CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER=y
CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT=1
CONFIG_SLUB_DEBUG_ON=y
CONFIG_SLUB_STATS=y
CONFIG_DEBUG_KMEMLEAK=y
CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=400
# CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF is not set
# CONFIG_DEBUG_RT_MUTEXES is not set
# CONFIG_RT_MUTEX_TESTER is not set
CONFIG_DEBUG_SPINLOCK=y
CONFIG_DEBUG_MUTEXES=y
CONFIG_DEBUG_LOCK_ALLOC=y
CONFIG_PROVE_LOCKING=y
# CONFIG_PROVE_RCU is not set
# CONFIG_SPARSE_RCU_POINTER is not set
CONFIG_LOCKDEP=y
CONFIG_LOCK_STAT=y
CONFIG_DEBUG_LOCKDEP=y
CONFIG_TRACE_IRQFLAGS=y
# CONFIG_DEBUG_ATOMIC_SLEEP is not set
CONFIG_DEBUG_LOCKING_API_SELFTESTS=y
CONFIG_STACKTRACE=y
# CONFIG_DEBUG_STACK_USAGE is not set
# CONFIG_DEBUG_KOBJECT is not set
CONFIG_DEBUG_BUGVERBOSE=y
# CONFIG_DEBUG_INFO is not set
# CONFIG_DEBUG_VM is not set
# CONFIG_DEBUG_VIRTUAL is not set
# CONFIG_DEBUG_WRITECOUNT is not set
CONFIG_DEBUG_MEMORY_INIT=y
# CONFIG_DEBUG_LIST is not set
# CONFIG_TEST_LIST_SORT is not set
# CONFIG_DEBUG_SG is not set
CONFIG_DEBUG_NOTIFIERS=y
CONFIG_DEBUG_CREDENTIALS=y
CONFIG_ARCH_WANT_FRAME_POINTERS=y
CONFIG_FRAME_POINTER=y
# CONFIG_BOOT_PRINTK_DELAY is not set
# CONFIG_RCU_TORTURE_TEST is not set
CONFIG_BACKTRACE_SELF_TEST=y
# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y
CONFIG_LKDTM=y
CONFIG_FAULT_INJECTION=y
# CONFIG_FAILSLAB is not set
CONFIG_FAIL_PAGE_ALLOC=y
CONFIG_FAIL_MAKE_REQUEST=y
CONFIG_FAIL_IO_TIMEOUT=y
# CONFIG_FAULT_INJECTION_DEBUG_FS is not set
CONFIG_LATENCYTOP=y
# CONFIG_SYSCTL_SYSCALL_CHECK is not set
CONFIG_DEBUG_PAGEALLOC=y
CONFIG_WANT_PAGE_DEBUG_FLAGS=y
CONFIG_PAGE_GUARD=y
CONFIG_USER_STACKTRACE_SUPPORT=y
CONFIG_NOP_TRACER=y
CONFIG_HAVE_FTRACE_NMI_ENTER=y
CONFIG_HAVE_FUNCTION_TRACER=y
CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST=y
CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
CONFIG_HAVE_DYNAMIC_FTRACE=y
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_TRACER_MAX_TRACE=y
CONFIG_RING_BUFFER=y
CONFIG_FTRACE_NMI_ENTER=y
CONFIG_EVENT_TRACING=y
CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_TRACING=y
CONFIG_GENERIC_TRACER=y
CONFIG_TRACING_SUPPORT=y
CONFIG_FTRACE=y
CONFIG_FUNCTION_TRACER=y
CONFIG_FUNCTION_GRAPH_TRACER=y
# CONFIG_IRQSOFF_TRACER is not set
CONFIG_SCHED_TRACER=y
# CONFIG_FTRACE_SYSCALLS is not set
CONFIG_TRACE_BRANCH_PROFILING=y
# CONFIG_BRANCH_PROFILE_NONE is not set
# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
CONFIG_PROFILE_ALL_BRANCHES=y
CONFIG_TRACING_BRANCHES=y
CONFIG_BRANCH_TRACER=y
CONFIG_STACK_TRACER=y
# CONFIG_BLK_DEV_IO_TRACE is not set
CONFIG_DYNAMIC_FTRACE=y
# CONFIG_FUNCTION_PROFILER is not set
CONFIG_FTRACE_MCOUNT_RECORD=y
# CONFIG_FTRACE_STARTUP_TEST is not set
CONFIG_MMIOTRACE=y
# CONFIG_RING_BUFFER_BENCHMARK is not set
# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set
CONFIG_FIREWIRE_OHCI_REMOTE_DMA=y
# CONFIG_BUILD_DOCSRC is not set
# CONFIG_DYNAMIC_DEBUG is not set
CONFIG_DMA_API_DEBUG=y
# CONFIG_ATOMIC64_SELFTEST is not set
CONFIG_SAMPLES=y
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_KGDB=y
CONFIG_KGDB_SERIAL_CONSOLE=y
CONFIG_KGDB_TESTS=y
CONFIG_KGDB_TESTS_ON_BOOT=y
CONFIG_KGDB_TESTS_BOOT_STRING="V1F100"
# CONFIG_KGDB_LOW_LEVEL_TRAP is not set
# CONFIG_KGDB_KDB is not set
CONFIG_HAVE_ARCH_KMEMCHECK=y
CONFIG_TEST_KSTRTOX=y
CONFIG_STRICT_DEVMEM=y
CONFIG_X86_VERBOSE_BOOTUP=y
CONFIG_EARLY_PRINTK=y
CONFIG_EARLY_PRINTK_DBGP=y
# CONFIG_DEBUG_STACKOVERFLOW is not set
CONFIG_X86_PTDUMP=y
CONFIG_DEBUG_RODATA=y
CONFIG_DEBUG_RODATA_TEST=y
CONFIG_IOMMU_DEBUG=y
# CONFIG_IOMMU_STRESS is not set
CONFIG_IOMMU_LEAK=y
CONFIG_HAVE_MMIOTRACE_SUPPORT=y
CONFIG_IO_DELAY_TYPE_0X80=0
CONFIG_IO_DELAY_TYPE_0XED=1
CONFIG_IO_DELAY_TYPE_UDELAY=2
CONFIG_IO_DELAY_TYPE_NONE=3
# CONFIG_IO_DELAY_0X80 is not set
CONFIG_IO_DELAY_0XED=y
# CONFIG_IO_DELAY_UDELAY is not set
# CONFIG_IO_DELAY_NONE is not set
CONFIG_DEFAULT_IO_DELAY_TYPE=1
# CONFIG_DEBUG_BOOT_PARAMS is not set
CONFIG_CPA_DEBUG=y
CONFIG_OPTIMIZE_INLINING=y
CONFIG_DEBUG_NMI_SELFTEST=y

#
# Security options
#
CONFIG_KEYS=y
# CONFIG_TRUSTED_KEYS is not set
CONFIG_ENCRYPTED_KEYS=y
# CONFIG_KEYS_DEBUG_PROC_KEYS is not set
# CONFIG_SECURITY_DMESG_RESTRICT is not set
CONFIG_SECURITY=y
CONFIG_SECURITYFS=y
# CONFIG_SECURITY_NETWORK is not set
CONFIG_SECURITY_PATH=y
# CONFIG_SECURITY_TOMOYO is not set
# CONFIG_SECURITY_APPARMOR is not set
CONFIG_INTEGRITY=y
CONFIG_INTEGRITY_SIGNATURE=y
CONFIG_IMA=y
CONFIG_IMA_MEASURE_PCR_IDX=10
CONFIG_IMA_AUDIT=y
# CONFIG_EVM is not set
CONFIG_DEFAULT_SECURITY_DAC=y
CONFIG_DEFAULT_SECURITY=""
CONFIG_XOR_BLOCKS=y
CONFIG_ASYNC_CORE=y
CONFIG_ASYNC_XOR=y
CONFIG_ASYNC_TX_DISABLE_PQ_VAL_DMA=y
CONFIG_ASYNC_TX_DISABLE_XOR_VAL_DMA=y
CONFIG_CRYPTO=y

#
# Crypto core or helper
#
CONFIG_CRYPTO_ALGAPI=y
CONFIG_CRYPTO_ALGAPI2=y
CONFIG_CRYPTO_AEAD=y
CONFIG_CRYPTO_AEAD2=y
CONFIG_CRYPTO_BLKCIPHER=y
CONFIG_CRYPTO_BLKCIPHER2=y
CONFIG_CRYPTO_HASH=y
CONFIG_CRYPTO_HASH2=y
CONFIG_CRYPTO_RNG=y
CONFIG_CRYPTO_RNG2=y
CONFIG_CRYPTO_PCOMP=y
CONFIG_CRYPTO_PCOMP2=y
CONFIG_CRYPTO_MANAGER=y
CONFIG_CRYPTO_MANAGER2=y
# CONFIG_CRYPTO_USER is not set
CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
CONFIG_CRYPTO_GF128MUL=y
CONFIG_CRYPTO_NULL=y
CONFIG_CRYPTO_WORKQUEUE=y
CONFIG_CRYPTO_CRYPTD=y
CONFIG_CRYPTO_AUTHENC=y

#
# Authenticated Encryption with Associated Data
#
# CONFIG_CRYPTO_CCM is not set
# CONFIG_CRYPTO_GCM is not set
CONFIG_CRYPTO_SEQIV=y

#
# Block modes
#
CONFIG_CRYPTO_CBC=y
CONFIG_CRYPTO_CTR=y
# CONFIG_CRYPTO_CTS is not set
CONFIG_CRYPTO_ECB=y
CONFIG_CRYPTO_LRW=y
# CONFIG_CRYPTO_PCBC is not set
CONFIG_CRYPTO_XTS=y

#
# Hash modes
#
CONFIG_CRYPTO_HMAC=y
CONFIG_CRYPTO_XCBC=y
# CONFIG_CRYPTO_VMAC is not set

#
# Digest
#
CONFIG_CRYPTO_CRC32C=y
CONFIG_CRYPTO_CRC32C_INTEL=y
# CONFIG_CRYPTO_GHASH is not set
# CONFIG_CRYPTO_MD4 is not set
CONFIG_CRYPTO_MD5=y
CONFIG_CRYPTO_MICHAEL_MIC=y
# CONFIG_CRYPTO_RMD128 is not set
# CONFIG_CRYPTO_RMD160 is not set
# CONFIG_CRYPTO_RMD256 is not set
# CONFIG_CRYPTO_RMD320 is not set
CONFIG_CRYPTO_SHA1=y
CONFIG_CRYPTO_SHA1_SSSE3=y
CONFIG_CRYPTO_SHA256=y
# CONFIG_CRYPTO_SHA512 is not set
CONFIG_CRYPTO_TGR192=y
CONFIG_CRYPTO_WP512=y
CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL=y

#
# Ciphers
#
CONFIG_CRYPTO_AES=y
CONFIG_CRYPTO_AES_X86_64=y
# CONFIG_CRYPTO_AES_NI_INTEL is not set
CONFIG_CRYPTO_ANUBIS=y
CONFIG_CRYPTO_ARC4=y
CONFIG_CRYPTO_BLOWFISH=y
CONFIG_CRYPTO_BLOWFISH_COMMON=y
# CONFIG_CRYPTO_BLOWFISH_X86_64 is not set
CONFIG_CRYPTO_CAMELLIA=y
# CONFIG_CRYPTO_CAST5 is not set
# CONFIG_CRYPTO_CAST6 is not set
# CONFIG_CRYPTO_DES is not set
CONFIG_CRYPTO_FCRYPT=y
CONFIG_CRYPTO_KHAZAD=y
# CONFIG_CRYPTO_SALSA20 is not set
# CONFIG_CRYPTO_SALSA20_X86_64 is not set
# CONFIG_CRYPTO_SEED is not set
CONFIG_CRYPTO_SERPENT=y
CONFIG_CRYPTO_SERPENT_SSE2_X86_64=y
CONFIG_CRYPTO_TEA=y
CONFIG_CRYPTO_TWOFISH=y
CONFIG_CRYPTO_TWOFISH_COMMON=y
CONFIG_CRYPTO_TWOFISH_X86_64=y
# CONFIG_CRYPTO_TWOFISH_X86_64_3WAY is not set

#
# Compression
#
CONFIG_CRYPTO_DEFLATE=y
CONFIG_CRYPTO_ZLIB=y
# CONFIG_CRYPTO_LZO is not set

#
# Random Number Generation
#
# CONFIG_CRYPTO_ANSI_CPRNG is not set
CONFIG_CRYPTO_USER_API=y
CONFIG_CRYPTO_USER_API_HASH=y
CONFIG_CRYPTO_USER_API_SKCIPHER=y
# CONFIG_CRYPTO_HW is not set
CONFIG_HAVE_KVM=y
CONFIG_VIRTUALIZATION=y
# CONFIG_KVM is not set
CONFIG_VHOST_NET=y
CONFIG_BINARY_PRINTF=y

#
# Library routines
#
CONFIG_BITREVERSE=y
CONFIG_GENERIC_FIND_FIRST_BIT=y
CONFIG_GENERIC_PCI_IOMAP=y
CONFIG_GENERIC_IOMAP=y
CONFIG_CRC_CCITT=y
CONFIG_CRC16=y
CONFIG_CRC_T10DIF=y
CONFIG_CRC_ITU_T=y
CONFIG_CRC32=y
CONFIG_CRC7=y
CONFIG_LIBCRC32C=y
CONFIG_CRC8=y
CONFIG_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=y
CONFIG_LZO_COMPRESS=y
CONFIG_LZO_DECOMPRESS=y
CONFIG_XZ_DEC=y
CONFIG_XZ_DEC_X86=y
CONFIG_XZ_DEC_POWERPC=y
CONFIG_XZ_DEC_IA64=y
CONFIG_XZ_DEC_ARM=y
CONFIG_XZ_DEC_ARMTHUMB=y
CONFIG_XZ_DEC_SPARC=y
CONFIG_XZ_DEC_BCJ=y
# CONFIG_XZ_DEC_TEST is not set
CONFIG_DECOMPRESS_GZIP=y
CONFIG_DECOMPRESS_BZIP2=y
CONFIG_DECOMPRESS_LZMA=y
CONFIG_DECOMPRESS_XZ=y
CONFIG_DECOMPRESS_LZO=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HAS_DMA=y
CONFIG_CHECK_SIGNATURE=y
CONFIG_DQL=y
CONFIG_NLATTR=y
CONFIG_LRU_CACHE=y
CONFIG_AVERAGE=y
CONFIG_CLZ_TAB=y
CONFIG_CORDIC=y
CONFIG_MPILIB=y
CONFIG_SIGNATURE=y

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Drop non-__vdso weak symbols from the x32 VDSO
  2012-02-23 10:55       ` Ingo Molnar
@ 2012-02-23 14:36         ` H. Peter Anvin
  0 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-23 14:36 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-tip-commits, linux-kernel, mingo, luto, tglx, hjl.tools

On 02/23/2012 02:55 AM, Ingo Molnar wrote:
> 
> * tip-bot for H. Peter Anvin <hpa@zytor.com> wrote:
> 
>> Commit-ID:  862ae3132dc393ab6ea750b9ee9e0e1c276b9abb
>> Gitweb:     http://git.kernel.org/tip/862ae3132dc393ab6ea750b9ee9e0e1c276b9abb
>> Author:     H. Peter Anvin <hpa@zytor.com>
>> AuthorDate: Wed, 22 Feb 2012 20:37:10 -0800
>> Committer:  H. Peter Anvin <hpa@zytor.com>
>> CommitDate: Wed, 22 Feb 2012 20:40:07 -0800
>>
>> x32: Drop non-__vdso weak symbols from the x32 VDSO
> 
> One of the recent x32 commit broke the build on some configs:
> 
>   VDSO    arch/x86/vdso/vdsox32.so.dbg
> /usr/bin/ld: arch/x86/vdso/vgetcpu-x32.o: relocation R_X86_64_64 
> against symbol `.rodata' isn't supported in x32 mode
> arch/x86/vdso/vgetcpu-x32.o: could not read symbols: Bad value
> collect2: error: ld returned 1 exit status
> 
> config attached.
> 
> binutils-2.21.51, gcc-4.7.0.
> 
> Thanks,
> 
> 	Ingo

Yes, this is known: binutils-2.21.51 has some x32 support, but that
version of the ABI is too old for what the kernel needs; in other words
it's not functional.

	-hpa


^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [PATCH 02/30] x86-64: Use explicit sizes in sigcontext.h, prepare for x32
  2012-02-22 21:23           ` Arnd Bergmann
  2012-02-22 21:55             ` H. Peter Anvin
@ 2012-02-24  2:33             ` H. Peter Anvin
  2012-03-06  5:25               ` H. Peter Anvin
  1 sibling, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-02-24  2:33 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Linus Torvalds, linux-kernel, linux-arch, mingo, tglx, akpm, hjl.tools

On 02/22/2012 01:23 PM, Arnd Bergmann wrote:
> 
> I'd say we should fix at least the ones that are easy to spot because
> they already use compat_u64 or have an #ifdef CONFIG_X86_64 in compat
> code. I've looked at everything I could find that fits into that category
> and found only two locations. My expectation is that all other data
> structures that would fall into this category are already broken
> for 32 bit emulation on x86.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 

Would you mind sending these as patches to the respective maintainers?
Since they don't depend on the x32 patchset per se it's probably the
best way to handle this.

Feel free to include my Acked-by: H. Peter Anvin <hpa@zytor.com>.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 106+ messages in thread

* [tip:x86/x32] x32: Warn and disable rather than error if binutils too old
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (29 preceding siblings ...)
  2012-02-20  0:08 ` [PATCH 30/30] x32: Add x32 VDSO support H. Peter Anvin
@ 2012-02-27 22:21 ` tip-bot for H. Peter Anvin
  2012-02-28  9:49 ` [tip:x86/x32] x86/x32: Fix the binutils auto-detect tip-bot for Ingo Molnar
                   ` (5 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: tip-bot for H. Peter Anvin @ 2012-02-27 22:21 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, hpa, hjl.tools, mingo

Commit-ID:  0bf6276392e990dd0da0ccd8e10f42597d503f29
Gitweb:     http://git.kernel.org/tip/0bf6276392e990dd0da0ccd8e10f42597d503f29
Author:     H. Peter Anvin <hpa@linux.intel.com>
AuthorDate: Mon, 27 Feb 2012 14:09:10 -0800
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Mon, 27 Feb 2012 14:09:10 -0800

x32: Warn and disable rather than error if binutils too old

If X32 is enabled in .config, but the binutils can't build it, issue a
warning and disable the feature rather than erroring out.

In order to support this, have CONFIG_X86_X32 be the option set in
Kconfig, and CONFIG_X86_X32_ABI be the option set by the Makefile when
it is enabled and binutils has been found to be functional.

Requested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: H. J. Lu <hjl.tools@gmail.com>
Link: http://lkml.kernel.org/r/1329696488-16970-1-git-send-email-hpa@zytor.com
---
 arch/x86/Kconfig  |    4 ++--
 arch/x86/Makefile |   16 ++++++++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index c9d6c9e..e2b38b4 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2175,7 +2175,7 @@ config IA32_AOUT
 	---help---
 	  Support old a.out binaries in the 32bit emulation.
 
-config X86_X32_ABI
+config X86_X32
 	bool "x32 ABI for 64-bit mode (EXPERIMENTAL)"
 	depends on X86_64 && IA32_EMULATION && EXPERIMENTAL
 	---help---
@@ -2190,7 +2190,7 @@ config X86_X32_ABI
 
 config COMPAT
 	def_bool y
-	depends on IA32_EMULATION || X86_X32_ABI
+	depends on IA32_EMULATION || X86_X32
 
 config COMPAT_FOR_U64_ALIGNMENT
 	def_bool COMPAT
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 209ba12..31bb1eb 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -82,6 +82,22 @@ ifdef CONFIG_CC_STACKPROTECTOR
         endif
 endif
 
+ifdef CONFIG_X86_X32
+	x32_ld_ok := $(call try-run,\
+			/bin/echo -e '1: .quad 1b' | \
+			$(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" - && \
+			$(OBJCOPY) -O elf32-x86-64 "$$TMP" "$$TMPO" && \
+			$(LD) -m elf32_x86_64 "$$TMPO" -o "$$TMP",y,n)
+	ifeq ($(x32_ld_ok),y)
+		CONFIG_X86_X32_ABI := y
+		KBUILD_AFLAGS += -DCONFIG_X86_X32_ABI
+		KBUILD_CFLAGS += -DCONFIG_X86_X32_ABI
+	else
+		$(warning CONFIG_X86_X32 enabled but no binutils support)
+	endif
+endif
+export CONFIG_X86_X32_ABI
+
 # Don't unroll struct assignments with kmemcheck enabled
 ifeq ($(CONFIG_KMEMCHECK),y)
 	KBUILD_CFLAGS += $(call cc-option,-fno-builtin-memcpy)

^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [tip:x86/x32] x86/x32: Fix the binutils auto-detect
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (30 preceding siblings ...)
  2012-02-27 22:21 ` [tip:x86/x32] x32: Warn and disable rather than error if binutils too old tip-bot for H. Peter Anvin
@ 2012-02-28  9:49 ` tip-bot for Ingo Molnar
  2012-03-06  0:56 ` [tip:x86/x32] x32: Provide separate is_ia32_task() and is_x32_task () predicates tip-bot for H. Peter Anvin
                   ` (4 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: tip-bot for Ingo Molnar @ 2012-02-28  9:49 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, hpa, hjl.tools, mingo

Commit-ID:  8bd69c2d5f9c0b5237c632d1b21dbfe4fd16ba6b
Gitweb:     http://git.kernel.org/tip/8bd69c2d5f9c0b5237c632d1b21dbfe4fd16ba6b
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 28 Feb 2012 10:35:06 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 28 Feb 2012 10:35:06 +0100

x86/x32: Fix the binutils auto-detect

Fix:

 arch/x86/Makefile:96: *** recipe commences before first target.  Stop.

Cc: H. Peter Anvin <hpa@linux.intel.com>
Cc: H. J. Lu <hjl.tools@gmail.com>
Link: http://lkml.kernel.org/r/1329696488-16970-1-git-send-email-hpa@zytor.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/Makefile |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 31bb1eb..968dbe2 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -88,13 +88,13 @@ ifdef CONFIG_X86_X32
 			$(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" - && \
 			$(OBJCOPY) -O elf32-x86-64 "$$TMP" "$$TMPO" && \
 			$(LD) -m elf32_x86_64 "$$TMPO" -o "$$TMP",y,n)
-	ifeq ($(x32_ld_ok),y)
-		CONFIG_X86_X32_ABI := y
-		KBUILD_AFLAGS += -DCONFIG_X86_X32_ABI
-		KBUILD_CFLAGS += -DCONFIG_X86_X32_ABI
-	else
-		$(warning CONFIG_X86_X32 enabled but no binutils support)
-	endif
+        ifeq ($(x32_ld_ok),y)
+                CONFIG_X86_X32_ABI := y
+                KBUILD_AFLAGS += -DCONFIG_X86_X32_ABI
+                KBUILD_CFLAGS += -DCONFIG_X86_X32_ABI
+        else
+                $(warning CONFIG_X86_X32 enabled but no binutils support)
+        endif
 endif
 export CONFIG_X86_X32_ABI
 

^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [tip:x86/x32] x32: Provide separate is_ia32_task() and is_x32_task () predicates
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (31 preceding siblings ...)
  2012-02-28  9:49 ` [tip:x86/x32] x86/x32: Fix the binutils auto-detect tip-bot for Ingo Molnar
@ 2012-03-06  0:56 ` tip-bot for H. Peter Anvin
  2012-03-06  0:56 ` [tip:x86/x32] x32: Switch to a 64-bit clock_t tip-bot for H. Peter Anvin
                   ` (3 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: tip-bot for H. Peter Anvin @ 2012-03-06  0:56 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, hjl.tools

Commit-ID:  a628b684d27d22631d1819890f13047ae9075241
Gitweb:     http://git.kernel.org/tip/a628b684d27d22631d1819890f13047ae9075241
Author:     H. Peter Anvin <hpa@zytor.com>
AuthorDate: Mon, 5 Mar 2012 13:39:29 -0800
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Mon, 5 Mar 2012 15:35:18 -0800

x32: Provide separate is_ia32_task() and is_x32_task() predicates

The is_compat_task() test is composed of two predicates already, so
make each of them available separately.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: H. J. Lu <hjl.tools@gmail.com>
Link: http://lkml.kernel.org/r/1329696488-16970-1-git-send-email-hpa@zytor.com
---
 arch/x86/include/asm/compat.h |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h
index e7f68b4..355edc0 100644
--- a/arch/x86/include/asm/compat.h
+++ b/arch/x86/include/asm/compat.h
@@ -235,12 +235,17 @@ static inline void __user *arch_compat_alloc_user_space(long len)
 	return (void __user *)round_down(sp - len, 16);
 }
 
-static inline bool is_compat_task(void)
+static inline bool is_ia32_task(void)
 {
 #ifdef CONFIG_IA32_EMULATION
 	if (current_thread_info()->status & TS_COMPAT)
 		return true;
 #endif
+	return false;
+}
+
+static inline bool is_x32_task(void)
+{
 #ifdef CONFIG_X86_X32_ABI
 	if (task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT)
 		return true;
@@ -248,4 +253,9 @@ static inline bool is_compat_task(void)
 	return false;
 }
 
+static inline bool is_compat_task(void)
+{
+	return is_ia32_task() || is_x32_task();
+}
+
 #endif /* _ASM_X86_COMPAT_H */

^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [tip:x86/x32] x32: Switch to a 64-bit clock_t
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (32 preceding siblings ...)
  2012-03-06  0:56 ` [tip:x86/x32] x32: Provide separate is_ia32_task() and is_x32_task () predicates tip-bot for H. Peter Anvin
@ 2012-03-06  0:56 ` tip-bot for H. Peter Anvin
  2012-03-06  0:57 ` [tip:x86/x32] x32: Add ptrace for x32 tip-bot for H.J. Lu
                   ` (2 subsequent siblings)
  36 siblings, 0 replies; 106+ messages in thread
From: tip-bot for H. Peter Anvin @ 2012-03-06  0:56 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, tglx, hjl.tools, gregory.m.lueck

Commit-ID:  e7084fd52ed71249ab2ce7a7d89d601c9d1f904c
Gitweb:     http://git.kernel.org/tip/e7084fd52ed71249ab2ce7a7d89d601c9d1f904c
Author:     H. Peter Anvin <hpa@zytor.com>
AuthorDate: Mon, 5 Mar 2012 13:40:24 -0800
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Mon, 5 Mar 2012 15:35:18 -0800

x32: Switch to a 64-bit clock_t

clock_t is used mainly to give the number of jiffies a certain process
has burned.  It is entirely feasible for a long-running process to
consume more than 2^32 jiffies especially in a multiprocess system.
As such, switch to a 64-bit clock_t for x32, just as we already
switched to a 64-bit time_t.

clock_t is only used in a handful of places, and as such it is really
not a very significant change.  The one that has the biggest impact is
in struct siginfo, but since the *size* of struct siginfo doesn't
change (it is padded to the hilt) it is fairly easy to make this a
localized change.

This also gets rid of sys_x32_times, however since this is a pretty
late change don't compactify the system call numbers; we can reuse
system call slot 521 next time we need an x32 system call.

Reported-by: Gregory M. Lueck <gregory.m.lueck@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: H. J. Lu <hjl.tools@gmail.com>
Link: http://lkml.kernel.org/r/1329696488-16970-1-git-send-email-hpa@zytor.com
---
 arch/x86/ia32/ia32_signal.c      |   10 ++++++++--
 arch/x86/include/asm/ia32.h      |    9 +++++++++
 arch/x86/syscalls/syscall_64.tbl |    4 ++--
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index 25d80f3..bc09ed2 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -37,6 +37,7 @@
 int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
 {
 	int err = 0;
+	bool ia32 = !is_ia32_task();
 
 	if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t)))
 		return -EFAULT;
@@ -66,8 +67,13 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
 			case __SI_FAULT >> 16:
 				break;
 			case __SI_CHLD >> 16:
-				put_user_ex(from->si_utime, &to->si_utime);
-				put_user_ex(from->si_stime, &to->si_stime);
+				if (ia32) {
+					put_user_ex(from->si_utime, &to->si_utime);
+					put_user_ex(from->si_stime, &to->si_stime);
+				} else {
+					put_user_ex(from->si_utime, &to->_sifields._sigchld_x32._utime);
+					put_user_ex(from->si_stime, &to->_sifields._sigchld_x32._stime);
+				}
 				put_user_ex(from->si_status, &to->si_status);
 				/* FALL THROUGH */
 			default:
diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h
index c6435ab..7d0c185 100644
--- a/arch/x86/include/asm/ia32.h
+++ b/arch/x86/include/asm/ia32.h
@@ -125,6 +125,15 @@ typedef struct compat_siginfo {
 			compat_clock_t _stime;
 		} _sigchld;
 
+		/* SIGCHLD (x32 version) */
+		struct {
+			unsigned int _pid;	/* which child */
+			unsigned int _uid;	/* sender's uid */
+			int _status;		/* exit code */
+			s64 _utime;
+			s64 _stime;
+		} _sigchld_x32;
+
 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
 		struct {
 			unsigned int _addr;	/* faulting insn/memory ref. */
diff --git a/arch/x86/syscalls/syscall_64.tbl b/arch/x86/syscalls/syscall_64.tbl
index 4aecc7e..0d778b8 100644
--- a/arch/x86/syscalls/syscall_64.tbl
+++ b/arch/x86/syscalls/syscall_64.tbl
@@ -106,7 +106,7 @@
 97	common	getrlimit		sys_getrlimit
 98	common	getrusage		sys_getrusage
 99	common	sysinfo			sys_sysinfo
-100	64	times			sys_times
+100	common	times			sys_times
 101	common	ptrace			sys_ptrace
 102	common	getuid			sys_getuid
 103	common	syslog			sys_syslog
@@ -331,7 +331,7 @@
 518	x32	sendmsg			compat_sys_sendmsg
 519	x32	recvmsg			compat_sys_recvmsg
 520	x32	execve			stub_x32_execve
-521	x32	times			compat_sys_times
+# 521 available
 522	x32	rt_sigpending		sys32_rt_sigpending
 523	x32	rt_sigtimedwait		compat_sys_rt_sigtimedwait
 524	x32	rt_sigqueueinfo		sys32_rt_sigqueueinfo

^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [tip:x86/x32] x32: Add ptrace for x32
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (33 preceding siblings ...)
  2012-03-06  0:56 ` [tip:x86/x32] x32: Switch to a 64-bit clock_t tip-bot for H. Peter Anvin
@ 2012-03-06  0:57 ` tip-bot for H.J. Lu
  2012-03-14  5:58 ` [tip:x86/x32] x32: Fix stupid ia32/ x32 inversion in the siginfo format tip-bot for H. Peter Anvin
  2012-03-14 21:43 ` [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo tip-bot for H. Peter Anvin
  36 siblings, 0 replies; 106+ messages in thread
From: tip-bot for H.J. Lu @ 2012-03-06  0:57 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, oleg, roland, tglx, hjl.tools

Commit-ID:  55283e2537714f9370c4ab847d170acf223daf90
Gitweb:     http://git.kernel.org/tip/55283e2537714f9370c4ab847d170acf223daf90
Author:     H.J. Lu <hjl.tools@gmail.com>
AuthorDate: Mon, 5 Mar 2012 15:32:11 -0800
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Mon, 5 Mar 2012 15:43:45 -0800

x32: Add ptrace for x32

X32 ptrace is a hybrid of 64bit ptrace and compat ptrace with 32bit
address and longs.  It use 64bit ptrace to access the full 64bit
registers.  PTRACE_PEEKUSR and PTRACE_POKEUSR are only allowed to access
segment and debug registers.  PTRACE_PEEKUSR returns the lower 32bits
and PTRACE_POKEUSR zero-extends 32bit value to 64bit.   It works since
the upper 32bits of segment and debug registers of x32 process are always
zero.  GDB only uses PTRACE_PEEKUSR and PTRACE_POKEUSR to access
segment and debug registers.

[ hpa: changed TIF_X32 test to use !is_ia32_task() instead, and moved
  the system call number to the now-unused 521 slot. ]

Signed-off-by: "H.J. Lu" <hjl.tools@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Roland McGrath <roland@hack.frob.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Link: http://lkml.kernel.org/r/1329696488-16970-1-git-send-email-hpa@zytor.com
---
 arch/x86/kernel/ptrace.c         |   99 ++++++++++++++++++++++++++++++++++++++
 arch/x86/syscalls/syscall_64.tbl |    4 +-
 2 files changed, 101 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 5026738..93e7877a 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1130,6 +1130,100 @@ static int genregs32_set(struct task_struct *target,
 	return ret;
 }
 
+#ifdef CONFIG_X86_X32_ABI
+static long x32_arch_ptrace(struct task_struct *child,
+			    compat_long_t request, compat_ulong_t caddr,
+			    compat_ulong_t cdata)
+{
+	unsigned long addr = caddr;
+	unsigned long data = cdata;
+	void __user *datap = compat_ptr(data);
+	int ret;
+
+	switch (request) {
+	/* Read 32bits at location addr in the USER area.  Only allow
+	   to return the lower 32bits of segment and debug registers.  */
+	case PTRACE_PEEKUSR: {
+		u32 tmp;
+
+		ret = -EIO;
+		if ((addr & (sizeof(data) - 1)) || addr >= sizeof(struct user) ||
+		    addr < offsetof(struct user_regs_struct, cs))
+			break;
+
+		tmp = 0;  /* Default return condition */
+		if (addr < sizeof(struct user_regs_struct))
+			tmp = getreg(child, addr);
+		else if (addr >= offsetof(struct user, u_debugreg[0]) &&
+			 addr <= offsetof(struct user, u_debugreg[7])) {
+			addr -= offsetof(struct user, u_debugreg[0]);
+			tmp = ptrace_get_debugreg(child, addr / sizeof(data));
+		}
+		ret = put_user(tmp, (__u32 __user *)datap);
+		break;
+	}
+
+	/* Write the word at location addr in the USER area.  Only allow
+	   to update segment and debug registers with the upper 32bits
+	   zero-extended. */
+	case PTRACE_POKEUSR:
+		ret = -EIO;
+		if ((addr & (sizeof(data) - 1)) || addr >= sizeof(struct user) ||
+		    addr < offsetof(struct user_regs_struct, cs))
+			break;
+
+		if (addr < sizeof(struct user_regs_struct))
+			ret = putreg(child, addr, data);
+		else if (addr >= offsetof(struct user, u_debugreg[0]) &&
+			 addr <= offsetof(struct user, u_debugreg[7])) {
+			addr -= offsetof(struct user, u_debugreg[0]);
+			ret = ptrace_set_debugreg(child,
+						  addr / sizeof(data), data);
+		}
+		break;
+
+	case PTRACE_GETREGS:	/* Get all gp regs from the child. */
+		return copy_regset_to_user(child,
+					   task_user_regset_view(current),
+					   REGSET_GENERAL,
+					   0, sizeof(struct user_regs_struct),
+					   datap);
+
+	case PTRACE_SETREGS:	/* Set all gp regs in the child. */
+		return copy_regset_from_user(child,
+					     task_user_regset_view(current),
+					     REGSET_GENERAL,
+					     0, sizeof(struct user_regs_struct),
+					     datap);
+
+	case PTRACE_GETFPREGS:	/* Get the child FPU state. */
+		return copy_regset_to_user(child,
+					   task_user_regset_view(current),
+					   REGSET_FP,
+					   0, sizeof(struct user_i387_struct),
+					   datap);
+
+	case PTRACE_SETFPREGS:	/* Set the child FPU state. */
+		return copy_regset_from_user(child,
+					     task_user_regset_view(current),
+					     REGSET_FP,
+					     0, sizeof(struct user_i387_struct),
+					     datap);
+
+		/* normal 64bit interface to access TLS data.
+		   Works just like arch_prctl, except that the arguments
+		   are reversed. */
+	case PTRACE_ARCH_PRCTL:
+		return do_arch_prctl(child, data, addr);
+
+	default:
+		return compat_ptrace_request(child, request, addr, data);
+	}
+
+	return ret;
+}
+#endif
+
 long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
 			compat_ulong_t caddr, compat_ulong_t cdata)
 {
@@ -1139,6 +1233,11 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
 	int ret;
 	__u32 val;
 
+#ifdef CONFIG_X86_X32_ABI
+	if (!is_ia32_task())
+		return x32_arch_ptrace(child, request, caddr, cdata);
+#endif
+
 	switch (request) {
 	case PTRACE_PEEKUSR:
 		ret = getreg32(child, addr, &val);
diff --git a/arch/x86/syscalls/syscall_64.tbl b/arch/x86/syscalls/syscall_64.tbl
index 0d778b8..dd29a9e 100644
--- a/arch/x86/syscalls/syscall_64.tbl
+++ b/arch/x86/syscalls/syscall_64.tbl
@@ -107,7 +107,7 @@
 98	common	getrusage		sys_getrusage
 99	common	sysinfo			sys_sysinfo
 100	common	times			sys_times
-101	common	ptrace			sys_ptrace
+101	64	ptrace			sys_ptrace
 102	common	getuid			sys_getuid
 103	common	syslog			sys_syslog
 104	common	getgid			sys_getgid
@@ -331,7 +331,7 @@
 518	x32	sendmsg			compat_sys_sendmsg
 519	x32	recvmsg			compat_sys_recvmsg
 520	x32	execve			stub_x32_execve
-# 521 available
+521	x32	ptrace			compat_sys_ptrace
 522	x32	rt_sigpending		sys32_rt_sigpending
 523	x32	rt_sigtimedwait		compat_sys_rt_sigtimedwait
 524	x32	rt_sigqueueinfo		sys32_rt_sigqueueinfo

^ permalink raw reply related	[flat|nested] 106+ messages in thread

* Re: [PATCH 02/30] x86-64: Use explicit sizes in sigcontext.h, prepare for x32
  2012-02-24  2:33             ` H. Peter Anvin
@ 2012-03-06  5:25               ` H. Peter Anvin
  0 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-03-06  5:25 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-kernel, linux-arch, mingo, tglx, akpm, hjl.tools

On 02/23/2012 06:33 PM, H. Peter Anvin wrote:
> On 02/22/2012 01:23 PM, Arnd Bergmann wrote:
>>
>> I'd say we should fix at least the ones that are easy to spot because
>> they already use compat_u64 or have an #ifdef CONFIG_X86_64 in compat
>> code. I've looked at everything I could find that fits into that category
>> and found only two locations. My expectation is that all other data
>> structures that would fall into this category are already broken
>> for 32 bit emulation on x86.
>>
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>
> 
> Would you mind sending these as patches to the respective maintainers?
> Since they don't depend on the x32 patchset per se it's probably the
> best way to handle this.
> 
> Feel free to include my Acked-by: H. Peter Anvin <hpa@zytor.com>.
> 

Ping?

	-hpa


^ permalink raw reply	[flat|nested] 106+ messages in thread

* [tip:x86/x32] x32: Fix stupid ia32/ x32 inversion in the siginfo format
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (34 preceding siblings ...)
  2012-03-06  0:57 ` [tip:x86/x32] x32: Add ptrace for x32 tip-bot for H.J. Lu
@ 2012-03-14  5:58 ` tip-bot for H. Peter Anvin
  2012-03-14 21:43 ` [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo tip-bot for H. Peter Anvin
  36 siblings, 0 replies; 106+ messages in thread
From: tip-bot for H. Peter Anvin @ 2012-03-14  5:58 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, tglx, gregory.m.lueck, hjl.tools

Commit-ID:  bb6fa8b275e132b1e9319dbab94211543a0b7bd3
Gitweb:     http://git.kernel.org/tip/bb6fa8b275e132b1e9319dbab94211543a0b7bd3
Author:     H. Peter Anvin <hpa@zytor.com>
AuthorDate: Tue, 13 Mar 2012 22:44:41 -0700
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Tue, 13 Mar 2012 22:44:41 -0700

x32: Fix stupid ia32/x32 inversion in the siginfo format

Fix a stray ! which flipped the sense if we were generating a signal
frame for ia32 vs. x32.

Introduced in:

e7084fd5 x32: Switch to a 64-bit clock_t

Reported-by: H. J. Lu <hjl.tools@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Gregory M. Lueck <gregory.m.lueck@intel.com>
Link: http://lkml.kernel.org/r/1329696488-16970-1-git-send-email-hpa@zytor.com
---
 arch/x86/ia32/ia32_signal.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index bc09ed2..ef026aa 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -37,7 +37,7 @@
 int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
 {
 	int err = 0;
-	bool ia32 = !is_ia32_task();
+	bool ia32 = is_ia32_task();
 
 	if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t)))
 		return -EFAULT;

^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
                   ` (35 preceding siblings ...)
  2012-03-14  5:58 ` [tip:x86/x32] x32: Fix stupid ia32/ x32 inversion in the siginfo format tip-bot for H. Peter Anvin
@ 2012-03-14 21:43 ` tip-bot for H. Peter Anvin
  2012-03-14 23:17   ` H.J. Lu
  2012-04-18 17:38   ` H.J. Lu
  36 siblings, 2 replies; 106+ messages in thread
From: tip-bot for H. Peter Anvin @ 2012-03-14 21:43 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, hjl.tools

Commit-ID:  31796ac4e8f0e88f5c10f1ad6dab8f19bebe44a4
Gitweb:     http://git.kernel.org/tip/31796ac4e8f0e88f5c10f1ad6dab8f19bebe44a4
Author:     H. Peter Anvin <hpa@zytor.com>
AuthorDate: Wed, 14 Mar 2012 14:27:52 -0700
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Wed, 14 Mar 2012 14:27:52 -0700

x32: Fix alignment fail in struct compat_siginfo

Adding struct _sigchld_x32 caused a misalignment cascade in struct
siginfo, because union _sifields is located on an 4-byte boundary
(8-byte misaligned.)

Adding new fields that are 8-byte aligned caused the intermediate
structures to also be aligned to 8 bytes, thereby adding padding in
unexpected places.

Thus, change s64 to compat_s64 here, which makes it "misaligned on
paper".  In reality these fields *are* actually aligned (there are 3
preceeding ints outside the union and 3 inside struct _sigchld_x32),
but because of the intervening union and struct it is not possible for
gcc to avoid padding without breaking the ABI.

Reported-and-tested-by: H. J. Lu <hjl.tools@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Link: http://lkml.kernel.org/r/1329696488-16970-1-git-send-email-hpa@zytor.com
---
 arch/x86/include/asm/ia32.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h
index 7d0c185..ee52760 100644
--- a/arch/x86/include/asm/ia32.h
+++ b/arch/x86/include/asm/ia32.h
@@ -130,8 +130,8 @@ typedef struct compat_siginfo {
 			unsigned int _pid;	/* which child */
 			unsigned int _uid;	/* sender's uid */
 			int _status;		/* exit code */
-			s64 _utime;
-			s64 _stime;
+			compat_s64 _utime;
+			compat_s64 _stime;
 		} _sigchld_x32;
 
 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */

^ permalink raw reply related	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-03-14 21:43 ` [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo tip-bot for H. Peter Anvin
@ 2012-03-14 23:17   ` H.J. Lu
  2012-03-14 23:19     ` H. Peter Anvin
  2012-03-14 23:33     ` Derek Fawcus
  2012-04-18 17:38   ` H.J. Lu
  1 sibling, 2 replies; 106+ messages in thread
From: H.J. Lu @ 2012-03-14 23:17 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, tglx, hjl.tools; +Cc: linux-tip-commits

On Wed, Mar 14, 2012 at 2:43 PM, tip-bot for H. Peter Anvin
<hpa@zytor.com> wrote:
> Commit-ID:  31796ac4e8f0e88f5c10f1ad6dab8f19bebe44a4
> Gitweb:     http://git.kernel.org/tip/31796ac4e8f0e88f5c10f1ad6dab8f19bebe44a4
> Author:     H. Peter Anvin <hpa@zytor.com>
> AuthorDate: Wed, 14 Mar 2012 14:27:52 -0700
> Committer:  H. Peter Anvin <hpa@zytor.com>
> CommitDate: Wed, 14 Mar 2012 14:27:52 -0700
>
> x32: Fix alignment fail in struct compat_siginfo
>
> Adding struct _sigchld_x32 caused a misalignment cascade in struct
> siginfo, because union _sifields is located on an 4-byte boundary
> (8-byte misaligned.)
>
> Adding new fields that are 8-byte aligned caused the intermediate
> structures to also be aligned to 8 bytes, thereby adding padding in
> unexpected places.
>
> Thus, change s64 to compat_s64 here, which makes it "misaligned on
> paper".  In reality these fields *are* actually aligned (there are 3
> preceeding ints outside the union and 3 inside struct _sigchld_x32),
> but because of the intervening union and struct it is not possible for
> gcc to avoid padding without breaking the ABI.
>

Just for the record, although the offsets of _utime and _stime are
multiple of 8 bytes, struct siginfo is only aligned at 4 bytes.  So
the addresses of  _utime and _stime may not be 8byte aligned.
But misaligned int64 load/store are OK for x86-64.

-- 
H.J.

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-03-14 23:17   ` H.J. Lu
@ 2012-03-14 23:19     ` H. Peter Anvin
  2012-03-15  0:33       ` H.J. Lu
  2012-03-14 23:33     ` Derek Fawcus
  1 sibling, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-03-14 23:19 UTC (permalink / raw)
  To: H.J. Lu; +Cc: mingo, linux-kernel, tglx, linux-tip-commits

On 03/14/2012 04:17 PM, H.J. Lu wrote:
> 
> Just for the record, although the offsets of _utime and _stime are
> multiple of 8 bytes, struct siginfo is only aligned at 4 bytes.  So
> the addresses of  _utime and _stime may not be 8byte aligned.
> But misaligned int64 load/store are OK for x86-64.
> 

Yes; the real question I guess is where struct siginfo appears and if it
is misaligned by construction.  It obviously appears in the signal stack
frame but also in a couple of system calls.  It might be possible to put
an __attribute__((aligned(8))) on the whole structure in the x32 case?

	-hpa

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-03-14 23:17   ` H.J. Lu
  2012-03-14 23:19     ` H. Peter Anvin
@ 2012-03-14 23:33     ` Derek Fawcus
  2012-03-14 23:44       ` H. Peter Anvin
  1 sibling, 1 reply; 106+ messages in thread
From: Derek Fawcus @ 2012-03-14 23:33 UTC (permalink / raw)
  To: H.J. Lu; +Cc: mingo, hpa, linux-kernel, tglx, linux-tip-commits

On Wed, Mar 14, 2012 at 04:17:29PM -0700, H.J. Lu wrote:
> Just for the record, although the offsets of _utime and _stime are
> multiple of 8 bytes, struct siginfo is only aligned at 4 bytes.  So
> the addresses of  _utime and _stime may not be 8byte aligned.
> But misaligned int64 load/store are OK for x86-64.

So whereas on i386 and x86_64 we can set eflags.AC (or rflags.AC) to test the
code for aligment safeness,  we'll not be able to do so with x32?

(Simply 'cause this could get false positive on syscalls).

Granted this is not a common use,  but I've done it for checking that code
will easily port to ppc/mips.

.pdf

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-03-14 23:33     ` Derek Fawcus
@ 2012-03-14 23:44       ` H. Peter Anvin
  0 siblings, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-03-14 23:44 UTC (permalink / raw)
  To: H.J. Lu, mingo, linux-kernel, tglx, linux-tip-commits

On 03/14/2012 04:33 PM, Derek Fawcus wrote:
> On Wed, Mar 14, 2012 at 04:17:29PM -0700, H.J. Lu wrote:
>> Just for the record, although the offsets of _utime and _stime are
>> multiple of 8 bytes, struct siginfo is only aligned at 4 bytes.  So
>> the addresses of  _utime and _stime may not be 8byte aligned.
>> But misaligned int64 load/store are OK for x86-64.
> 
> So whereas on i386 and x86_64 we can set eflags.AC (or rflags.AC) to test the
> code for aligment safeness,  we'll not be able to do so with x32?
> 
> (Simply 'cause this could get false positive on syscalls).
> 
> Granted this is not a common use,  but I've done it for checking that code
> will easily port to ppc/mips.
> 

I'm surprised you have been able to do so at all... there is tons of
regular x86 code which is totally broken if AC=1, simply because they
know that if you're on an x86 you can do unaligned references (on MIPS
they would do load right/load left, on ARM use the swizzled data, and so
on.)

But yes, due to the reuse of some of the i386 ABI data structures the
data structures that operate on the kernel ABI will not be AC-safe in
the general case.  Normal user space code will be naturally aligned in
all cases.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-03-14 23:19     ` H. Peter Anvin
@ 2012-03-15  0:33       ` H.J. Lu
  0 siblings, 0 replies; 106+ messages in thread
From: H.J. Lu @ 2012-03-15  0:33 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: mingo, linux-kernel, tglx, linux-tip-commits

On Wed, Mar 14, 2012 at 4:19 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 03/14/2012 04:17 PM, H.J. Lu wrote:
>>
>> Just for the record, although the offsets of _utime and _stime are
>> multiple of 8 bytes, struct siginfo is only aligned at 4 bytes.  So
>> the addresses of  _utime and _stime may not be 8byte aligned.
>> But misaligned int64 load/store are OK for x86-64.
>>
>
> Yes; the real question I guess is where struct siginfo appears and if it
> is misaligned by construction.  It obviously appears in the signal stack
> frame but also in a couple of system calls.  It might be possible to put
> an __attribute__((aligned(8))) on the whole structure in the x32 case?

It is possible to add  __attribute__((aligned(8))) on struct siginfo
in the x32 case.  But it only affects system calls with struct siginfo.
The signal stack frame may still be misaligned.

-- 
H.J.

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-03-14 21:43 ` [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo tip-bot for H. Peter Anvin
  2012-03-14 23:17   ` H.J. Lu
@ 2012-04-18 17:38   ` H.J. Lu
  2012-04-18 17:47     ` H. Peter Anvin
                       ` (3 more replies)
  1 sibling, 4 replies; 106+ messages in thread
From: H.J. Lu @ 2012-04-18 17:38 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, tglx; +Cc: linux-tip-commits

On Wed, Mar 14, 2012 at 2:43 PM, tip-bot for H. Peter Anvin
<hpa@zytor.com> wrote:
> Commit-ID:  31796ac4e8f0e88f5c10f1ad6dab8f19bebe44a4
> Gitweb:     http://git.kernel.org/tip/31796ac4e8f0e88f5c10f1ad6dab8f19bebe44a4
> Author:     H. Peter Anvin <hpa@zytor.com>
> AuthorDate: Wed, 14 Mar 2012 14:27:52 -0700
> Committer:  H. Peter Anvin <hpa@zytor.com>
> CommitDate: Wed, 14 Mar 2012 14:27:52 -0700
>
> x32: Fix alignment fail in struct compat_siginfo
>
> Adding struct _sigchld_x32 caused a misalignment cascade in struct
> siginfo, because union _sifields is located on an 4-byte boundary
> (8-byte misaligned.)
>
> Adding new fields that are 8-byte aligned caused the intermediate
> structures to also be aligned to 8 bytes, thereby adding padding in
> unexpected places.
>
> Thus, change s64 to compat_s64 here, which makes it "misaligned on
> paper".  In reality these fields *are* actually aligned (there are 3
> preceeding ints outside the union and 3 inside struct _sigchld_x32),
> but because of the intervening union and struct it is not possible for
> gcc to avoid padding without breaking the ABI.
>
> Reported-and-tested-by: H. J. Lu <hjl.tools@gmail.com>
> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
> Link: http://lkml.kernel.org/r/1329696488-16970-1-git-send-email-hpa@zytor.com
> ---
>  arch/x86/include/asm/ia32.h |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h
> index 7d0c185..ee52760 100644
> --- a/arch/x86/include/asm/ia32.h
> +++ b/arch/x86/include/asm/ia32.h
> @@ -130,8 +130,8 @@ typedef struct compat_siginfo {
>                        unsigned int _pid;      /* which child */
>                        unsigned int _uid;      /* sender's uid */
>                        int _status;            /* exit code */
> -                       s64 _utime;
> -                       s64 _stime;
> +                       compat_s64 _utime;
> +                       compat_s64 _stime;
>                } _sigchld_x32;
>
>                /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */

It doesn't match struct siginfo in include/asm-generic/siginfo.h for
x32.

-- 
H.J.

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-04-18 17:38   ` H.J. Lu
@ 2012-04-18 17:47     ` H. Peter Anvin
  2012-04-18 18:01       ` H.J. Lu
  2012-04-23 23:49     ` [tip:x86/urgent] asm-generic: Allow overriding clock_t and add attributes to siginfo_t tip-bot for H. Peter Anvin
                       ` (2 subsequent siblings)
  3 siblings, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-04-18 17:47 UTC (permalink / raw)
  To: H.J. Lu; +Cc: mingo, linux-kernel, tglx, linux-tip-commits

On 04/18/2012 10:38 AM, H.J. Lu wrote:
> 
> It doesn't match struct siginfo in include/asm-generic/siginfo.h for
> x32.
> 

What is missing (from either)?

	-hpa


^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-04-18 17:47     ` H. Peter Anvin
@ 2012-04-18 18:01       ` H.J. Lu
  2012-04-18 18:10         ` H. Peter Anvin
  0 siblings, 1 reply; 106+ messages in thread
From: H.J. Lu @ 2012-04-18 18:01 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: mingo, linux-kernel, tglx, linux-tip-commits

On Wed, Apr 18, 2012 at 10:47 AM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 04/18/2012 10:38 AM, H.J. Lu wrote:
>>
>> It doesn't match struct siginfo in include/asm-generic/siginfo.h for
>> x32.
>>
>
> What is missing (from either)?
>

include/asm-generic/siginfo.h has

                /* SIGCHLD */
                struct {
                        __kernel_pid_t _pid;    /* which child */
                        __ARCH_SI_UID_T _uid;   /* sender's uid */
                        int _status;            /* exit code */
                        __kernel_clock_t _utime;
                        __kernel_clock_t _stime;
                } _sigchld;


Although x32 __kernel_clock_t is s64 with 64bit alignment, in
_sigchld, it must be compat_s64 with 32bit alignment.

-- 
H.J.

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-04-18 18:01       ` H.J. Lu
@ 2012-04-18 18:10         ` H. Peter Anvin
  2012-04-18 18:15           ` H.J. Lu
  0 siblings, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-04-18 18:10 UTC (permalink / raw)
  To: H.J. Lu; +Cc: mingo, linux-kernel, tglx, linux-tip-commits

On 04/18/2012 11:01 AM, H.J. Lu wrote:
> On Wed, Apr 18, 2012 at 10:47 AM, H. Peter Anvin <hpa@zytor.com> wrote:
>> On 04/18/2012 10:38 AM, H.J. Lu wrote:
>>>
>>> It doesn't match struct siginfo in include/asm-generic/siginfo.h for
>>> x32.
>>>
>>
>> What is missing (from either)?
>>
> 
> include/asm-generic/siginfo.h has
> 
>                 /* SIGCHLD */
>                 struct {
>                         __kernel_pid_t _pid;    /* which child */
>                         __ARCH_SI_UID_T _uid;   /* sender's uid */
>                         int _status;            /* exit code */
>                         __kernel_clock_t _utime;
>                         __kernel_clock_t _stime;
>                 } _sigchld;
> 
> 
> Although x32 __kernel_clock_t is s64 with 64bit alignment, in
> _sigchld, it must be compat_s64 with 32bit alignment.
> 

What would you suggest?  Change __kernel_clock_t?  It would somewhat
stink to have to muck with things here.

The problem here of course is that this is a phony misalignment...

	-hpa


^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-04-18 18:10         ` H. Peter Anvin
@ 2012-04-18 18:15           ` H.J. Lu
  2012-04-18 18:21             ` H. Peter Anvin
  0 siblings, 1 reply; 106+ messages in thread
From: H.J. Lu @ 2012-04-18 18:15 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: mingo, linux-kernel, tglx, linux-tip-commits

On Wed, Apr 18, 2012 at 11:10 AM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 04/18/2012 11:01 AM, H.J. Lu wrote:
>> On Wed, Apr 18, 2012 at 10:47 AM, H. Peter Anvin <hpa@zytor.com> wrote:
>>> On 04/18/2012 10:38 AM, H.J. Lu wrote:
>>>>
>>>> It doesn't match struct siginfo in include/asm-generic/siginfo.h for
>>>> x32.
>>>>
>>>
>>> What is missing (from either)?
>>>
>>
>> include/asm-generic/siginfo.h has
>>
>>                 /* SIGCHLD */
>>                 struct {
>>                         __kernel_pid_t _pid;    /* which child */
>>                         __ARCH_SI_UID_T _uid;   /* sender's uid */
>>                         int _status;            /* exit code */
>>                         __kernel_clock_t _utime;
>>                         __kernel_clock_t _stime;
>>                 } _sigchld;
>>
>>
>> Although x32 __kernel_clock_t is s64 with 64bit alignment, in
>> _sigchld, it must be compat_s64 with 32bit alignment.
>>
>
> What would you suggest?  Change __kernel_clock_t?  It would somewhat
> stink to have to muck with things here.
>
> The problem here of course is that this is a phony misalignment...
>
>        -hpa
>

In x32 glibc, I have

# if compile for X32
/* si_utime and si_stime must be 4 byte aligned for x32 to match the
   kernel.  We align siginfo_t to 8 bytes so that si_utime and si_stime
   are actually aligned to 8 bytes since their offsets are multiple of
   8 bytes.  */
typedef __clock_t __attribute__ ((__aligned__ (4))) __sigchld_clock_t;
#  define __SI_ALIGNMENT __attribute__ ((__aligned__ (8)))
# else
typedef __clock_t __sigchld_clock_t;
#  define __SI_ALIGNMENT
# endif

typedef struct siginfo
  {
...
	/* SIGCHLD.  */
	struct
	  {
	    __pid_t si_pid;	/* Which child.  */
	    __uid_t si_uid;	/* Real user ID of sending process.  */
	    int si_status;	/* Exit value or signal.  */
	    __sigchld_clock_t si_utime;
	    __sigchld_clock_t si_stime;
	  } _sigchld;
...
  } siginfo_t __SI_ALIGNMENT;


-- 
H.J.

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-04-18 18:15           ` H.J. Lu
@ 2012-04-18 18:21             ` H. Peter Anvin
  2012-04-18 18:33               ` H.J. Lu
  0 siblings, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-04-18 18:21 UTC (permalink / raw)
  To: H.J. Lu; +Cc: mingo, linux-kernel, tglx, linux-tip-commits

On 04/18/2012 11:15 AM, H.J. Lu wrote:
> 
> In x32 glibc, I have
> 
> # if compile for X32
> /* si_utime and si_stime must be 4 byte aligned for x32 to match the
>    kernel.  We align siginfo_t to 8 bytes so that si_utime and si_stime
>    are actually aligned to 8 bytes since their offsets are multiple of
>    8 bytes.  */
> typedef __clock_t __attribute__ ((__aligned__ (4))) __sigchld_clock_t;
> #  define __SI_ALIGNMENT __attribute__ ((__aligned__ (8)))
> # else
> typedef __clock_t __sigchld_clock_t;
> #  define __SI_ALIGNMENT
> # endif
> 
> typedef struct siginfo
>   {
> ...
> 	/* SIGCHLD.  */
> 	struct
> 	  {
> 	    __pid_t si_pid;	/* Which child.  */
> 	    __uid_t si_uid;	/* Real user ID of sending process.  */
> 	    int si_status;	/* Exit value or signal.  */
> 	    __sigchld_clock_t si_utime;
> 	    __sigchld_clock_t si_stime;
> 	  } _sigchld;
> ...
>   } siginfo_t __SI_ALIGNMENT;
> 

So in other words, a separate type just for this.  However, the question
still holds: could we simply change __kernel_clock_t for x32 and be done
with it?  It would affect the alignment of struct tms, I guess; it
wouldn't really affect the kernel directly since the kernel gets a
pointer straight from userspace for times(2), but it would kind of mess
up a userspace which uses __kernel_clock_t directly.

Urk, okay...

	-hpa

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-04-18 18:21             ` H. Peter Anvin
@ 2012-04-18 18:33               ` H.J. Lu
  2012-04-18 19:03                 ` H. Peter Anvin
  2012-04-18 21:24                 ` H. Peter Anvin
  0 siblings, 2 replies; 106+ messages in thread
From: H.J. Lu @ 2012-04-18 18:33 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: mingo, linux-kernel, tglx, linux-tip-commits

On Wed, Apr 18, 2012 at 11:21 AM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 04/18/2012 11:15 AM, H.J. Lu wrote:
>>
>> In x32 glibc, I have
>>
>> # if compile for X32
>> /* si_utime and si_stime must be 4 byte aligned for x32 to match the
>>    kernel.  We align siginfo_t to 8 bytes so that si_utime and si_stime
>>    are actually aligned to 8 bytes since their offsets are multiple of
>>    8 bytes.  */
>> typedef __clock_t __attribute__ ((__aligned__ (4))) __sigchld_clock_t;
>> #  define __SI_ALIGNMENT __attribute__ ((__aligned__ (8)))
>> # else
>> typedef __clock_t __sigchld_clock_t;
>> #  define __SI_ALIGNMENT
>> # endif
>>
>> typedef struct siginfo
>>   {
>> ...
>>       /* SIGCHLD.  */
>>       struct
>>         {
>>           __pid_t si_pid;     /* Which child.  */
>>           __uid_t si_uid;     /* Real user ID of sending process.  */
>>           int si_status;      /* Exit value or signal.  */
>>           __sigchld_clock_t si_utime;
>>           __sigchld_clock_t si_stime;
>>         } _sigchld;
>> ...
>>   } siginfo_t __SI_ALIGNMENT;
>>
>
> So in other words, a separate type just for this.  However, the question

Yes.

> still holds: could we simply change __kernel_clock_t for x32 and be done
> with it?  It would affect the alignment of struct tms, I guess; it
> wouldn't really affect the kernel directly since the kernel gets a
> pointer straight from userspace for times(2), but it would kind of mess
> up a userspace which uses __kernel_clock_t directly.

That is true.

> Urk, okay...
>

This is the best approach I can think of.

-- 
H.J.

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-04-18 18:33               ` H.J. Lu
@ 2012-04-18 19:03                 ` H. Peter Anvin
  2012-04-18 21:24                 ` H. Peter Anvin
  1 sibling, 0 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-04-18 19:03 UTC (permalink / raw)
  To: H.J. Lu; +Cc: mingo, linux-kernel, tglx, linux-tip-commits

Looking at asm/siginfo.h it already has a bunch of __ARCH_SI_*_T macros,
so I guess adding an __ARCH_SI_CLOCK_T would not be out of place.

The whole misaligned union in this structure is a complete facepalm, but
there isn't much we can do about it now.

	-hpa


^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-04-18 18:33               ` H.J. Lu
  2012-04-18 19:03                 ` H. Peter Anvin
@ 2012-04-18 21:24                 ` H. Peter Anvin
  2012-04-18 21:49                   ` H.J. Lu
  2012-04-18 22:55                   ` H.J. Lu
  1 sibling, 2 replies; 106+ messages in thread
From: H. Peter Anvin @ 2012-04-18 21:24 UTC (permalink / raw)
  To: H.J. Lu; +Cc: mingo, linux-kernel, tglx, linux-tip-commits

[-- Attachment #1: Type: text/plain, Size: 320 bytes --]

Something like this works for you?

Note: we should promote __compat_[us]64 to a global type when we do the
cleanup work requested by Linus (change __[us]64 to explicitly aligned
types, with all users that require the old types using __compat_[us]64),
but we need the compiler warning to do that, realistically.

	-hpa


[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 1653 bytes --]

diff --git a/arch/x86/include/asm/siginfo.h b/arch/x86/include/asm/siginfo.h
index fc1aa55..eb91735 100644
--- a/arch/x86/include/asm/siginfo.h
+++ b/arch/x86/include/asm/siginfo.h
@@ -1,8 +1,14 @@
 #ifndef _ASM_X86_SIGINFO_H
 #define _ASM_X86_SIGINFO_H
 
+#include <linux/types.h>
+
 #ifdef __x86_64__
-# define __ARCH_SI_PREAMBLE_SIZE	(4 * sizeof(int))
+# ifdef __ILP32__
+#  define __ARCH_SI_CLOCK_T		__compat_s64  /* x32 */
+# else
+#  define __ARCH_SI_PREAMBLE_SIZE	(4 * sizeof(int))
+# endif
 #endif
 
 #include <asm-generic/siginfo.h>
diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h
index 8e8c23f..89d461b 100644
--- a/arch/x86/include/asm/types.h
+++ b/arch/x86/include/asm/types.h
@@ -3,4 +3,7 @@
 
 #include <asm-generic/types.h>
 
+typedef __u64 __attribute__((aligned(4))) __compat_u64;
+typedef __s64 __attribute__((aligned(4))) __compat_s64;
+
 #endif /* _ASM_X86_TYPES_H */
diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h
index 0dd4e87..4ed2ed0 100644
--- a/include/asm-generic/siginfo.h
+++ b/include/asm-generic/siginfo.h
@@ -35,6 +35,10 @@ typedef union sigval {
 #define __ARCH_SI_BAND_T long
 #endif
 
+#ifndef __ARCH_SI_CLOCK_T
+#define __ARCH_SI_CLOCK_T __kernel_clock_t
+#endif
+
 #ifndef HAVE_ARCH_SIGINFO_T
 
 typedef struct siginfo {
@@ -72,8 +76,8 @@ typedef struct siginfo {
 			__kernel_pid_t _pid;	/* which child */
 			__ARCH_SI_UID_T _uid;	/* sender's uid */
 			int _status;		/* exit code */
-			__kernel_clock_t _utime;
-			__kernel_clock_t _stime;
+			__ARCH_SI_CLOCK_T _utime;
+			__ARCH_SI_CLOCK_T _stime;
 		} _sigchld;
 
 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */

^ permalink raw reply related	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-04-18 21:24                 ` H. Peter Anvin
@ 2012-04-18 21:49                   ` H.J. Lu
  2012-04-18 21:58                     ` H. Peter Anvin
  2012-04-18 22:55                   ` H.J. Lu
  1 sibling, 1 reply; 106+ messages in thread
From: H.J. Lu @ 2012-04-18 21:49 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: mingo, linux-kernel, tglx, linux-tip-commits

On Wed, Apr 18, 2012 at 2:24 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> Something like this works for you?
>
> Note: we should promote __compat_[us]64 to a global type when we do the
> cleanup work requested by Linus (change __[us]64 to explicitly aligned
> types, with all users that require the old types using __compat_[us]64),

It looks good to me.

> but we need the compiler warning to do that, realistically.
>

I think you mentioned to me about this. Have you opened a gcc bug to
request to this feature?

Thanks.

-- 
H.J.

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-04-18 21:49                   ` H.J. Lu
@ 2012-04-18 21:58                     ` H. Peter Anvin
  2012-04-18 22:58                       ` H.J. Lu
  0 siblings, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-04-18 21:58 UTC (permalink / raw)
  To: H.J. Lu; +Cc: mingo, linux-kernel, tglx, linux-tip-commits

On 04/18/2012 02:49 PM, H.J. Lu wrote:
> 
> I think you mentioned to me about this. Have you opened a gcc bug to
> request to this feature?
> 

I have not, I don't think.  I thought you said you would do it, but
maybe I misremember.

	-hpa


-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-04-18 21:24                 ` H. Peter Anvin
  2012-04-18 21:49                   ` H.J. Lu
@ 2012-04-18 22:55                   ` H.J. Lu
  2012-04-18 23:48                     ` H. Peter Anvin
  1 sibling, 1 reply; 106+ messages in thread
From: H.J. Lu @ 2012-04-18 22:55 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: mingo, linux-kernel, tglx, linux-tip-commits

On Wed, Apr 18, 2012 at 2:24 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> Something like this works for you?
>
> Note: we should promote __compat_[us]64 to a global type when we do the
> cleanup work requested by Linus (change __[us]64 to explicitly aligned
> types, with all users that require the old types using __compat_[us]64),
> but we need the compiler warning to do that, realistically.
>

Can we also align struct siginfo to 8byte for x32?

-- 
H.J.

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-04-18 21:58                     ` H. Peter Anvin
@ 2012-04-18 22:58                       ` H.J. Lu
  0 siblings, 0 replies; 106+ messages in thread
From: H.J. Lu @ 2012-04-18 22:58 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: mingo, linux-kernel, tglx, linux-tip-commits

On Wed, Apr 18, 2012 at 2:58 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 04/18/2012 02:49 PM, H.J. Lu wrote:
>>
>> I think you mentioned to me about this. Have you opened a gcc bug to
>> request to this feature?
>>
>
> I have not, I don't think.  I thought you said you would do it, but
> maybe I misremember.
>

I opened:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53037

-- 
H.J.

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-04-18 22:55                   ` H.J. Lu
@ 2012-04-18 23:48                     ` H. Peter Anvin
  2012-04-18 23:54                       ` H.J. Lu
  0 siblings, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-04-18 23:48 UTC (permalink / raw)
  To: H.J. Lu; +Cc: mingo, linux-kernel, tglx, linux-tip-commits

On 04/18/2012 03:55 PM, H.J. Lu wrote:
> On Wed, Apr 18, 2012 at 2:24 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>> Something like this works for you?
>>
>> Note: we should promote __compat_[us]64 to a global type when we do the
>> cleanup work requested by Linus (change __[us]64 to explicitly aligned
>> types, with all users that require the old types using __compat_[us]64),
>> but we need the compiler warning to do that, realistically.
>>
> 
> Can we also align struct siginfo to 8byte for x32?
> 

We could.  If we want to align the substructures then we need some major
surgery to the compat_siginfo handling though.

	-hpa


^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-04-18 23:48                     ` H. Peter Anvin
@ 2012-04-18 23:54                       ` H.J. Lu
  2012-04-19  0:09                         ` H. Peter Anvin
  0 siblings, 1 reply; 106+ messages in thread
From: H.J. Lu @ 2012-04-18 23:54 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: mingo, linux-kernel, tglx, linux-tip-commits

On Wed, Apr 18, 2012 at 4:48 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 04/18/2012 03:55 PM, H.J. Lu wrote:
>> On Wed, Apr 18, 2012 at 2:24 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>>> Something like this works for you?
>>>
>>> Note: we should promote __compat_[us]64 to a global type when we do the
>>> cleanup work requested by Linus (change __[us]64 to explicitly aligned
>>> types, with all users that require the old types using __compat_[us]64),
>>> but we need the compiler warning to do that, realistically.
>>>
>>
>> Can we also align struct siginfo to 8byte for x32?
>>
>
> We could.  If we want to align the substructures then we need some major
> surgery to the compat_siginfo handling though.
>

Since there will be no x32 kernel, align struct siginfo to 8byte for x32
will only be for user space code.  It shouldn't be a problem for kernel.


-- 
H.J.

^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-04-18 23:54                       ` H.J. Lu
@ 2012-04-19  0:09                         ` H. Peter Anvin
  2012-04-19  0:14                           ` H.J. Lu
  0 siblings, 1 reply; 106+ messages in thread
From: H. Peter Anvin @ 2012-04-19  0:09 UTC (permalink / raw)
  To: H.J. Lu; +Cc: mingo, linux-kernel, tglx, linux-tip-commits

On 04/18/2012 04:54 PM, H.J. Lu wrote:
>>
>> We could.  If we want to align the substructures then we need some major
>> surgery to the compat_siginfo handling though.
>>
> 
> Since there will be no x32 kernel, align struct siginfo to 8byte for x32
> will only be for user space code.  It shouldn't be a problem for kernel.
> 

Well, for aligning the whole structure I don't think there is any change
to the kernel at all...

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 106+ messages in thread

* Re: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
  2012-04-19  0:09                         ` H. Peter Anvin
@ 2012-04-19  0:14                           ` H.J. Lu
  0 siblings, 0 replies; 106+ messages in thread
From: H.J. Lu @ 2012-04-19  0:14 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: mingo, linux-kernel, tglx, linux-tip-commits

On Wed, Apr 18, 2012 at 5:09 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 04/18/2012 04:54 PM, H.J. Lu wrote:
>>>
>>> We could.  If we want to align the substructures then we need some major
>>> surgery to the compat_siginfo handling though.
>>>
>>
>> Since there will be no x32 kernel, align struct siginfo to 8byte for x32
>> will only be for user space code.  It shouldn't be a problem for kernel.
>>
>
> Well, for aligning the whole structure I don't think there is any change
> to the kernel at all...
>

That is true.  This is only by user codes to pass 8bye aligned
struct siginfo pointer to kernel.

-- 
H.J.

^ permalink raw reply	[flat|nested] 106+ messages in thread

* [tip:x86/urgent] asm-generic: Allow overriding clock_t and add attributes to siginfo_t
  2012-04-18 17:38   ` H.J. Lu
  2012-04-18 17:47     ` H. Peter Anvin
@ 2012-04-23 23:49     ` tip-bot for H. Peter Anvin
  2012-04-23 23:50     ` [tip:x86/urgent] x32, siginfo: Provide proper overrides for x32 siginfo_t tip-bot for H. Peter Anvin
  2012-04-24  1:19     ` tip-bot for H. Peter Anvin
  3 siblings, 0 replies; 106+ messages in thread
From: tip-bot for H. Peter Anvin @ 2012-04-23 23:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, bruce.j.beare, arnd, tglx, hjl.rools, hpa

Commit-ID:  d643bdca8ab9cd333da1b68267d0e47328e56f56
Gitweb:     http://git.kernel.org/tip/d643bdca8ab9cd333da1b68267d0e47328e56f56
Author:     H. Peter Anvin <hpa@linux.intel.com>
AuthorDate: Mon, 23 Apr 2012 16:29:18 -0700
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Mon, 23 Apr 2012 16:29:18 -0700

asm-generic: Allow overriding clock_t and add attributes to siginfo_t

For the particular issue of x32, which shares code with i386 in the
handling of compat_siginfo_t, the use of a 64-bit clock_t bumps the
sigchld structure out of alignment, which triggers a messy cascade of
padding.

This was already handled on the kernel compat side, but it needs
handling on the user space side, which uses the generic header.  To
make that possible:

1. Allow __kernel_clock_t to be overridden in struct siginfo;
2. Allow there to be attributes added to struct siginfo.

Reported-by: H.J. Lu <hjl.rools@gmail.com>
Cc: Bruce J. Beare <bruce.j.beare@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Link: http://lkml.kernel.org/r/CAMe9rOqF6Kh6-NK7oP0Fpzkd4SBAWU%2BG53hwBbSD4iA2UzyxuA@mail.gmail.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 include/asm-generic/siginfo.h |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h
index 0dd4e87..5e5e386 100644
--- a/include/asm-generic/siginfo.h
+++ b/include/asm-generic/siginfo.h
@@ -35,6 +35,14 @@ typedef union sigval {
 #define __ARCH_SI_BAND_T long
 #endif
 
+#ifndef __ARCH_SI_CLOCK_T
+#define __ARCH_SI_CLOCK_T __kernel_clock_t
+#endif
+
+#ifndef __ARCH_SI_ATTRIBUTES
+#define __ARCH_SI_ATTRIBUTES
+#endif
+
 #ifndef HAVE_ARCH_SIGINFO_T
 
 typedef struct siginfo {
@@ -72,8 +80,8 @@ typedef struct siginfo {
 			__kernel_pid_t _pid;	/* which child */
 			__ARCH_SI_UID_T _uid;	/* sender's uid */
 			int _status;		/* exit code */
-			__kernel_clock_t _utime;
-			__kernel_clock_t _stime;
+			__ARCH_SI_CLOCK_T _utime;
+			__ARCH_SI_CLOCK_T _stime;
 		} _sigchld;
 
 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
@@ -91,7 +99,7 @@ typedef struct siginfo {
 			int _fd;
 		} _sigpoll;
 	} _sifields;
-} siginfo_t;
+} __ARCH_SI_ATTRIBUTES siginfo_t;
 
 #endif
 

^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [tip:x86/urgent] x32, siginfo: Provide proper overrides for x32 siginfo_t
  2012-04-18 17:38   ` H.J. Lu
  2012-04-18 17:47     ` H. Peter Anvin
  2012-04-23 23:49     ` [tip:x86/urgent] asm-generic: Allow overriding clock_t and add attributes to siginfo_t tip-bot for H. Peter Anvin
@ 2012-04-23 23:50     ` tip-bot for H. Peter Anvin
  2012-04-24  1:19     ` tip-bot for H. Peter Anvin
  3 siblings, 0 replies; 106+ messages in thread
From: tip-bot for H. Peter Anvin @ 2012-04-23 23:50 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, bruce.j.beare, arnd, tglx, hjl.rools, hpa

Commit-ID:  045b09a0be388ece1469aa02f17252e57c95093e
Gitweb:     http://git.kernel.org/tip/045b09a0be388ece1469aa02f17252e57c95093e
Author:     H. Peter Anvin <hpa@linux.intel.com>
AuthorDate: Mon, 23 Apr 2012 16:34:12 -0700
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Mon, 23 Apr 2012 16:36:45 -0700

x32, siginfo: Provide proper overrides for x32 siginfo_t

Provide the proper override macros for x32 siginfo_t.  The combination
of a special type here and an overall alignment constraint actually
ends up with all the types being properly aligned, but the hack is
needed to keep the substructures inside siginfo_t from adding padding.

Note: use __attribute__((aligned())) since __aligned() is not exported
to user space.

Reported-by: H.J. Lu <hjl.rools@gmail.com>
Cc: Bruce J. Beare <bruce.j.beare@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Link: http://lkml.kernel.org/r/CAMe9rOqF6Kh6-NK7oP0Fpzkd4SBAWU%2BG53hwBbSD4iA2UzyxuA@mail.gmail.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/include/asm/siginfo.h |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/siginfo.h b/arch/x86/include/asm/siginfo.h
index fc1aa55..073d445 100644
--- a/arch/x86/include/asm/siginfo.h
+++ b/arch/x86/include/asm/siginfo.h
@@ -2,7 +2,13 @@
 #define _ASM_X86_SIGINFO_H
 
 #ifdef __x86_64__
-# define __ARCH_SI_PREAMBLE_SIZE	(4 * sizeof(int))
+# ifdef __ILP32__ /* x32 */
+typedef long long __kernel_si_clock_t __attribute__((aligned(4)));
+#  define __ARCH_SI_CLOCK_T		__kernel_si_clock_t;
+#  define __ARCH_SI_ATTRIBUTES		__attribute__((aligned(8)))
+# else /* x86-64 */
+#  define __ARCH_SI_PREAMBLE_SIZE	(4 * sizeof(int))
+# endif
 #endif
 
 #include <asm-generic/siginfo.h>

^ permalink raw reply related	[flat|nested] 106+ messages in thread

* [tip:x86/urgent] x32, siginfo: Provide proper overrides for x32 siginfo_t
  2012-04-18 17:38   ` H.J. Lu
                       ` (2 preceding siblings ...)
  2012-04-23 23:50     ` [tip:x86/urgent] x32, siginfo: Provide proper overrides for x32 siginfo_t tip-bot for H. Peter Anvin
@ 2012-04-24  1:19     ` tip-bot for H. Peter Anvin
  3 siblings, 0 replies; 106+ messages in thread
From: tip-bot for H. Peter Anvin @ 2012-04-24  1:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, bruce.j.beare, arnd, tglx, hjl.rools, hpa

Commit-ID:  89b8835ec865dddd6673a8dd7003581bf2377176
Gitweb:     http://git.kernel.org/tip/89b8835ec865dddd6673a8dd7003581bf2377176
Author:     H. Peter Anvin <hpa@linux.intel.com>
AuthorDate: Mon, 23 Apr 2012 16:34:12 -0700
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Mon, 23 Apr 2012 18:11:40 -0700

x32, siginfo: Provide proper overrides for x32 siginfo_t

Provide the proper override macros for x32 siginfo_t.  The combination
of a special type here and an overall alignment constraint actually
ends up with all the types being properly aligned, but the hack is
needed to keep the substructures inside siginfo_t from adding padding.

Note: use __attribute__((aligned())) since __aligned() is not exported
to user space.

[ v2: fix stray semicolon ]

Reported-by: H.J. Lu <hjl.rools@gmail.com>
Cc: Bruce J. Beare <bruce.j.beare@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Link: http://lkml.kernel.org/r/CAMe9rOqF6Kh6-NK7oP0Fpzkd4SBAWU%2BG53hwBbSD4iA2UzyxuA@mail.gmail.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/include/asm/siginfo.h |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/siginfo.h b/arch/x86/include/asm/siginfo.h
index fc1aa55..34c47b3 100644
--- a/arch/x86/include/asm/siginfo.h
+++ b/arch/x86/include/asm/siginfo.h
@@ -2,7 +2,13 @@
 #define _ASM_X86_SIGINFO_H
 
 #ifdef __x86_64__
-# define __ARCH_SI_PREAMBLE_SIZE	(4 * sizeof(int))
+# ifdef __ILP32__ /* x32 */
+typedef long long __kernel_si_clock_t __attribute__((aligned(4)));
+#  define __ARCH_SI_CLOCK_T		__kernel_si_clock_t
+#  define __ARCH_SI_ATTRIBUTES		__attribute__((aligned(8)))
+# else /* x86-64 */
+#  define __ARCH_SI_PREAMBLE_SIZE	(4 * sizeof(int))
+# endif
 #endif
 
 #include <asm-generic/siginfo.h>

^ permalink raw reply related	[flat|nested] 106+ messages in thread

end of thread, other threads:[~2012-04-24  1:19 UTC | newest]

Thread overview: 106+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-20  0:07 [PATCH 00/30] RFC: x32 support H. Peter Anvin
2012-02-20  0:07 ` [PATCH 01/30] x86: Factor out TIF_IA32 from 32-bit address space H. Peter Anvin
2012-02-20  0:07 ` [PATCH 02/30] x86-64: Use explicit sizes in sigcontext.h, prepare for x32 H. Peter Anvin
2012-02-20  0:51   ` Linus Torvalds
2012-02-20  0:56     ` H. Peter Anvin
2012-02-22 12:22       ` Arnd Bergmann
2012-02-22 18:14         ` H. Peter Anvin
2012-02-22 21:23           ` Arnd Bergmann
2012-02-22 21:55             ` H. Peter Anvin
2012-02-24  2:33             ` H. Peter Anvin
2012-03-06  5:25               ` H. Peter Anvin
2012-02-20  0:07 ` [PATCH 03/30] sysinfo: Move struct sysinfo to a separate header file H. Peter Anvin
2012-02-20  0:07 ` [PATCH 04/30] posix_types: Introduce __kernel_[u]long_t H. Peter Anvin
2012-02-20  0:07 ` [PATCH 05/30] x32: Create posix_types_x32.h H. Peter Anvin
2012-02-20  0:07 ` [PATCH 06/30] sysinfo: Use explicit types in <linux/sysinfo.h> H. Peter Anvin
2012-02-20 12:12   ` Geert Uytterhoeven
2012-02-20 17:29     ` H. Peter Anvin
2012-02-20 20:01       ` Geert Uytterhoeven
2012-02-20 20:44         ` H. Peter Anvin
2012-02-20  0:07 ` [PATCH 07/30] compat: Introduce COMPAT_USE_64BIT_TIME H. Peter Anvin
2012-02-20  0:07 ` [PATCH 08/30] compat: Use COMPAT_USE_64BIT_TIME in the lp driver H. Peter Anvin
2012-02-20  0:56   ` Linus Torvalds
2012-02-20  0:59     ` H. Peter Anvin
2012-02-20  2:22     ` [PATCH 0/7] COMPAT_USE_64BIT_TIME v2 H. Peter Anvin
2012-02-20  2:22       ` [PATCH 1/7] compat: Introduce COMPAT_USE_64BIT_TIME H. Peter Anvin
2012-02-20  2:22       ` [PATCH 2/7] compat: Add helper functions to read/write struct timeval, timespec H. Peter Anvin
2012-02-20  2:22       ` [PATCH 3/7] compat: Handle COMPAT_USE_64BIT_TIME in the lp driver H. Peter Anvin
2012-02-20  2:22       ` [PATCH 4/7] compat: Use COMPAT_USE_64BIT_TIME in the input subsystem H. Peter Anvin
2012-02-20  2:22       ` [PATCH 5/7] compat: Use COMPAT_USE_64BIT_TIME in the Bluetooth subsystem H. Peter Anvin
2012-02-20  2:22       ` [PATCH 6/7] compat: Use COMPAT_USE_64BIT_TIME in net/compat.c H. Peter Anvin
2012-02-20  2:22       ` [PATCH 7/7] compat: Handle COMPAT_USE_64BIT_TIME in net/socket.c H. Peter Anvin
2012-02-20  2:42       ` [PATCH 0/7] COMPAT_USE_64BIT_TIME v2 H. Peter Anvin
2012-02-20  6:22         ` H. Peter Anvin
2012-02-20  0:07 ` [PATCH 09/30] compat: Use COMPAT_USE_64BIT_TIME in the input subsystem H. Peter Anvin
2012-02-20  0:07 ` [PATCH 10/30] compat: Use COMPAT_USE_64BIT_TIME in the Bluetooth subsystem H. Peter Anvin
2012-02-21 19:05   ` Gustavo Padovan
2012-02-21 19:15     ` H. Peter Anvin
2012-02-22 13:47     ` Jiri Kosina
2012-02-22 14:45       ` Gustavo Padovan
2012-02-20  0:07 ` [PATCH 11/30] aio: Use __kernel_ulong_t to define aio_context_t H. Peter Anvin
2012-02-20  0:07 ` [PATCH 12/30] compat: Create compat_sys_p{read,write}v64 H. Peter Anvin
2012-02-20  0:07 ` [PATCH 13/30] elf: Allow core dump-related fields to be overridden H. Peter Anvin
2012-02-20  0:07 ` [PATCH 14/30] x86-64: Add prototype for old_rsp to a header file H. Peter Anvin
2012-02-20  0:07 ` [PATCH 15/30] x32: Add a thread flag for x32 processes H. Peter Anvin
2012-02-20  0:07 ` [PATCH 16/30] x86-64, ia32: Drop sys32_rt_sigprocmask H. Peter Anvin
2012-02-20  0:07 ` [PATCH 17/30] x32: Add x32 system calls to syscall/syscall_64.tbl H. Peter Anvin
2012-02-20  0:07 ` [PATCH 18/30] x32: Generate <asm/unistd_x32.h> H. Peter Anvin
2012-02-20  0:07 ` [PATCH 19/30] x32: Generate <asm/unistd_64_x32.h> H. Peter Anvin
2012-02-20  0:07 ` [PATCH 20/30] x86: Move some signal-handling definitions to a common header H. Peter Anvin
2012-02-20  0:07 ` [PATCH 21/30] x32: Export setup/restore_sigcontext from signal.c H. Peter Anvin
2012-02-20  0:08 ` [PATCH 22/30] x32: Add struct ucontext_x32 H. Peter Anvin
2012-02-20  0:08 ` [PATCH 23/30] x32: Add rt_sigframe_x32 H. Peter Anvin
2012-02-20  0:08 ` [PATCH 24/30] x32: Handle the x32 system call flag H. Peter Anvin
2012-02-20  0:08 ` [PATCH 25/30] x86: Add #ifdef CONFIG_COMPAT to <asm/sys_ia32.h> H. Peter Anvin
2012-02-20  0:08 ` [PATCH 26/30] x32: Signal-related system calls H. Peter Anvin
2012-02-20  0:08 ` [PATCH 27/30] x32: Handle process creation H. Peter Anvin
2012-02-20  0:08 ` [PATCH 28/30] x32: If configured, add x32 system calls to system call tables H. Peter Anvin
2012-02-20  0:08 ` [PATCH 29/30] x32: Allow x32 to be configured H. Peter Anvin
2012-02-20  0:08 ` [PATCH 30/30] x32: Add x32 VDSO support H. Peter Anvin
2012-02-21  0:12   ` Andy Lutomirski
2012-02-21  3:58     ` H. Peter Anvin
2012-02-21 16:52       ` Andrew Lutomirski
2012-02-21 17:51         ` H. Peter Anvin
2012-02-21 18:54           ` Andrew Lutomirski
2012-02-21 19:03             ` H. Peter Anvin
2012-02-21 19:29               ` Andrew Lutomirski
2012-02-21 19:37                 ` H. Peter Anvin
2012-02-21 19:40                   ` Andrew Lutomirski
2012-02-21 19:49                     ` H. Peter Anvin
2012-02-21 19:51                       ` Andrew Lutomirski
2012-02-21 19:56                         ` H. Peter Anvin
2012-02-23  4:49     ` [tip:x86/x32] x32: Drop non-__vdso weak symbols from the x32 VDSO tip-bot for H. Peter Anvin
2012-02-23 10:55       ` Ingo Molnar
2012-02-23 14:36         ` H. Peter Anvin
2012-02-27 22:21 ` [tip:x86/x32] x32: Warn and disable rather than error if binutils too old tip-bot for H. Peter Anvin
2012-02-28  9:49 ` [tip:x86/x32] x86/x32: Fix the binutils auto-detect tip-bot for Ingo Molnar
2012-03-06  0:56 ` [tip:x86/x32] x32: Provide separate is_ia32_task() and is_x32_task () predicates tip-bot for H. Peter Anvin
2012-03-06  0:56 ` [tip:x86/x32] x32: Switch to a 64-bit clock_t tip-bot for H. Peter Anvin
2012-03-06  0:57 ` [tip:x86/x32] x32: Add ptrace for x32 tip-bot for H.J. Lu
2012-03-14  5:58 ` [tip:x86/x32] x32: Fix stupid ia32/ x32 inversion in the siginfo format tip-bot for H. Peter Anvin
2012-03-14 21:43 ` [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo tip-bot for H. Peter Anvin
2012-03-14 23:17   ` H.J. Lu
2012-03-14 23:19     ` H. Peter Anvin
2012-03-15  0:33       ` H.J. Lu
2012-03-14 23:33     ` Derek Fawcus
2012-03-14 23:44       ` H. Peter Anvin
2012-04-18 17:38   ` H.J. Lu
2012-04-18 17:47     ` H. Peter Anvin
2012-04-18 18:01       ` H.J. Lu
2012-04-18 18:10         ` H. Peter Anvin
2012-04-18 18:15           ` H.J. Lu
2012-04-18 18:21             ` H. Peter Anvin
2012-04-18 18:33               ` H.J. Lu
2012-04-18 19:03                 ` H. Peter Anvin
2012-04-18 21:24                 ` H. Peter Anvin
2012-04-18 21:49                   ` H.J. Lu
2012-04-18 21:58                     ` H. Peter Anvin
2012-04-18 22:58                       ` H.J. Lu
2012-04-18 22:55                   ` H.J. Lu
2012-04-18 23:48                     ` H. Peter Anvin
2012-04-18 23:54                       ` H.J. Lu
2012-04-19  0:09                         ` H. Peter Anvin
2012-04-19  0:14                           ` H.J. Lu
2012-04-23 23:49     ` [tip:x86/urgent] asm-generic: Allow overriding clock_t and add attributes to siginfo_t tip-bot for H. Peter Anvin
2012-04-23 23:50     ` [tip:x86/urgent] x32, siginfo: Provide proper overrides for x32 siginfo_t tip-bot for H. Peter Anvin
2012-04-24  1:19     ` tip-bot for H. Peter Anvin

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).