- 20 Feb, 2012 27 commits
-
-
H. Peter Anvin authored
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>
-
H. Peter Anvin authored
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>
-
H. J. Lu authored
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>
-
H. Peter Anvin authored
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>
-
H. Peter Anvin authored
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>
-
H. Peter Anvin authored
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>
-
H. Peter Anvin authored
Generate <asm/unistd_x32.h>; this exports x32 system call numbers to user space. [ v2: Enclose all arguments to syshdr in '' so empty arguments aren't dropped on the floor. ] Signed-off-by:
H. Peter Anvin <hpa@zytor.com>
-
H. Peter Anvin authored
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>
-
H. Peter Anvin authored
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>
-
H. Peter Anvin authored
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>
-
H. J. Lu authored
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>
-
H. J. Lu authored
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>
-
H. J. Lu authored
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>
-
H. Peter Anvin authored
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>
-
H. Peter Anvin authored
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>
-
H. J. Lu authored
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>
-
H. J. Lu authored
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>
-
H. J. Lu authored
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>
-
H. Peter Anvin authored
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>
-
H. Peter Anvin authored
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>
-
H. J. Lu authored
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>
-
H. Peter Anvin authored
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>
-
H. Peter Anvin authored
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>
-
H. Peter Anvin authored
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>
-
H. Peter Anvin authored
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
-
H. Peter Anvin authored
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
-
H. Peter Anvin authored
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
-
- 19 Feb, 2012 3 commits
-
-
David Howells authored
Delete the __FD_*() functions for operating on fd_set structs from linux/time.h as they're no longer used within the kernel with the preceding patch and are not exported to userspace. Whilst linux/time.h *does* export the FD_*() equivalents as wrappers around __FD_*(), userspace provides its own definition of __FD_*(). Note that the definition of FD_ZERO() in linux/time.h may not be used with the fd_sets associated with struct fdtable as the fd_set may have been allocated in a truncated fashion. Signed-off-by:
David Howells <dhowells@redhat.com> Link: http://lkml.kernel.org/r/20120216175006.23314.18984.stgit@warthog.procyon.org.ukSigned-off-by:
H. Peter Anvin <hpa@zytor.com> Cc: Al Viro <viro@zeniv.linux.org.uk>
-
David Howells authored
Replace the fd_sets in struct fdtable with an array of unsigned longs and then use the standard non-atomic bit operations rather than the FD_* macros. This: (1) Removes the abuses of struct fd_set: (a) Since we don't want to allocate a full fd_set the vast majority of the time, we actually, in effect, just allocate a just-big-enough array of unsigned longs and cast it to an fd_set type - so why bother with the fd_set at all? (b) Some places outside of the core fdtable handling code (such as SELinux) want to look inside the array of unsigned longs hidden inside the fd_set struct for more efficient iteration over the entire set. (2) Eliminates the use of FD_*() macros in the kernel completely. (3) Permits the __FD_*() macros to be deleted entirely where not exposed to userspace. Signed-off-by:
David Howells <dhowells@redhat.com> Link: http://lkml.kernel.org/r/20120216174954.23314.48147.stgit@warthog.procyon.org.ukSigned-off-by:
H. Peter Anvin <hpa@zytor.com> Cc: Al Viro <viro@zeniv.linux.org.uk>
-
David Howells authored
Wrap accesses to the fd_sets in struct fdtable (for recording open files and close-on-exec flags) so that we can move away from using fd_sets since we abuse the fd_set structs by not allocating the full-sized structure under normal circumstances and by non-core code looking at the internals of the fd_sets. The first abuse means that use of FD_ZERO() on these fd_sets is not permitted, since that cannot be told about their abnormal lengths. This introduces six wrapper functions for setting, clearing and testing close-on-exec flags and fd-is-open flags: void __set_close_on_exec(int fd, struct fdtable *fdt); void __clear_close_on_exec(int fd, struct fdtable *fdt); bool close_on_exec(int fd, const struct fdtable *fdt); void __set_open_fd(int fd, struct fdtable *fdt); void __clear_open_fd(int fd, struct fdtable *fdt); bool fd_is_open(int fd, const struct fdtable *fdt); Note that I've prepended '__' to the names of the set/clear functions because they require the caller to hold a lock to use them. Note also that I haven't added wrappers for looking behind the scenes at the the array. Possibly that should exist too. Signed-off-by:
David Howells <dhowells@redhat.com> Link: http://lkml.kernel.org/r/20120216174942.23314.1364.stgit@warthog.procyon.org.ukSigned-off-by:
H. Peter Anvin <hpa@zytor.com> Cc: Al Viro <viro@zeniv.linux.org.uk>
-
- 14 Feb, 2012 10 commits
-
-
H. Peter Anvin authored
<asm/posix_types.h> includes a set of macros that operate on file descriptors. Way long ago those were exported to user space, but nowadays they are #ifdef __KERNEL__. However, they are nothing but standard (nonatomic) bit operations, and we already have optimized versions of bit operations in the kernel. We can't include <linux/bitops.h> in <asm/posix_types.h> but we can move the definitions to <linux/time.h> and define them there in terms of standard kernel bitops. [ v2: folds the following fixes in: a) Stray space in __FD_SET(), reported by Andrew Morton b) #include <linux/string.h> needed for memset(), reported by Tony Luck ] Signed-off-by:
H. Peter Anvin <hpa@zytor.com> Link: http://lkml.kernel.org/r/1328677745-20121-22-git-send-email-hpa@zytor.com Cc: Arnd Bergmann <arnd@arndb.de> Cc: Tony Luck <tony.luck@intel.com> Cc: Andrew Morton <akpm@linux-foundation.org>
-
H. Peter Anvin authored
Change the xtensa architecture to use <asm-generic/posix_types.h>. Signed-off-by:
H. Peter Anvin <hpa@zytor.com> Link: http://lkml.kernel.org/r/1328677745-20121-21-git-send-email-hpa@zytor.com Cc: Chris Zankel <chris@zankel.net>
-
H. Peter Anvin authored
Change the x86 architecture to use <asm-generic/posix_types.h>. Signed-off-by:
H. Peter Anvin <hpa@zytor.com> Link: http://lkml.kernel.org/r/1328677745-20121-20-git-send-email-hpa@zytor.com Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de>
-
H. Peter Anvin authored
Change the sparc architecture to use <asm-generic/posix_types.h>. Signed-off-by:
H. Peter Anvin <hpa@zytor.com> Acked-by:
"David S. Miller" <davem@davemloft.net> Link: http://lkml.kernel.org/r/1328677745-20121-19-git-send-email-hpa@zytor.com
-
H. Peter Anvin authored
Remove type overrides in <asm/posix_types.h> for the sh architecture that are no longer necessary. Signed-off-by:
H. Peter Anvin <hpa@zytor.com> Link: http://lkml.kernel.org/r/1328677745-20121-18-git-send-email-hpa@zytor.com Cc: Paul Mundt <lethal@linux-sh.org>
-
H. Peter Anvin authored
Change the s390 architecture to use <asm-generic/posix_types.h>. Signed-off-by:
H. Peter Anvin <hpa@zytor.com> Acked-by:
Martin Schwidefsky <schwidefsky@de.ibm.com> Link: http://lkml.kernel.org/r/1328677745-20121-17-git-send-email-hpa@zytor.com Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: <linux390@de.ibm.com>
-
H. Peter Anvin authored
Change the powerpc architecture to use <asm-generic/posix_types.h>. [ v2: fix the definition for __kernel_ssize_t ] Signed-off-by:
H. Peter Anvin <hpa@zytor.com> Link: http://lkml.kernel.org/r/1328677745-20121-16-git-send-email-hpa@zytor.com Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org>
-
H. Peter Anvin authored
Change the parisc architecture to use <asm-generic/posix_types.h>. Signed-off-by:
H. Peter Anvin <hpa@zytor.com> Link: http://lkml.kernel.org/r/1328677745-20121-15-git-send-email-hpa@zytor.com Cc: Kyle McMartin <kyle@mcmartin.ca> Cc: Helge Deller <deller@gmx.de> Cc: James Bottomley <jejb@parisc-linux.org>
-
H. Peter Anvin authored
Change the mn10300 architecture to use <asm-generic/posix_types.h>. Signed-off-by:
H. Peter Anvin <hpa@zytor.com> Link: http://lkml.kernel.org/r/1328677745-20121-14-git-send-email-hpa@zytor.com Cc: David Howells <dhowells@redhat.com> Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
-
H. Peter Anvin authored
Change the mips architecture to use <asm-generic/posix_types.h>. [ v2: remove redundant definition of __kernel_loff_t ] Signed-off-by:
H. Peter Anvin <hpa@zytor.com> Link: http://lkml.kernel.org/r/1328677745-20121-13-git-send-email-hpa@zytor.com Cc: Ralf Baechle <ralf@linux-mips.org>
-