summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* uprobes/core: Optimize probe hits with the help of a counterSrikar Dronamraju2012-03-314-9/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Maintain a per-mm counter: number of uprobes that are inserted on this process address space. This counter can be used at probe hit time to determine if we need a lookup in the uprobes rbtree. Everytime a probe gets inserted successfully, the probe count is incremented and everytime a probe gets removed, the probe count is decremented. The new uprobe_munmap hook ensures the count is correct on a unmap or remap of a region. We expect that once a uprobe_munmap() is called, the vma goes away. So uprobe_unregister() finding a probe to unregister would either mean unmap event hasnt occurred yet or a mmap event on the same executable file occured after a unmap event. Additionally, uprobe_mmap hook now also gets called: a. on every executable vma that is COWed at fork. b. a vma of interest is newly mapped; breakpoint insertion also happens at the required address. On process creation, make sure the probes count in the child is set correctly. Special cases that are taken care include: a. mremap b. VM_DONTCOPY vmas on fork() c. insertion/removal races in the parent during fork(). Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Jim Keniston <jkenisto@linux.vnet.ibm.com> Cc: Linux-mm <linux-mm@kvack.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Christoph Hellwig <hch@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Arnaldo Carvalho de Melo <acme@infradead.org> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Anton Arapov <anton@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20120330182646.10018.85805.sendpatchset@srdronam.in.ibm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
* uprobes/core: Allocate XOL slots for uprobes useSrikar Dronamraju2012-03-314-0/+253
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Uprobes executes the original instruction at a probed location out of line. For this, we allocate a page (per mm) upon the first uprobe hit, in the process user address space, divide it into slots that are used to store the actual instructions to be singlestepped. These slots are known as xol (execution out of line) slots. Care is taken to ensure that the allocation is in an unmapped area as close to the top of the user address space as possible, with appropriate permission settings to keep selinux like frameworks happy. Upon a uprobe hit, a free slot is acquired, and is released after the singlestep completes. Lots of improvements courtesy suggestions/inputs from Peter and Oleg. [ Folded a fix for build issue on powerpc fixed and reported by Stephen Rothwell. ] Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Jim Keniston <jkenisto@linux.vnet.ibm.com> Cc: Linux-mm <linux-mm@kvack.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Christoph Hellwig <hch@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Arnaldo Carvalho de Melo <acme@infradead.org> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Anton Arapov <anton@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20120330182631.10018.48175.sendpatchset@srdronam.in.ibm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
* uprobes/core: Handle breakpoint and singlestep exceptionsSrikar Dronamraju2012-03-149-15/+664
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Uprobes uses exception notifiers to get to know if a thread hit a breakpoint or a singlestep exception. When a thread hits a uprobe or is singlestepping post a uprobe hit, the uprobe exception notifier sets its TIF_UPROBE bit, which will then be checked on its return to userspace path (do_notify_resume() ->uprobe_notify_resume()), where the consumers handlers are run (in task context) based on the defined filters. Uprobe hits are thread specific and hence we need to maintain information about if a task hit a uprobe, what uprobe was hit, the slot where the original instruction was copied for xol so that it can be singlestepped with appropriate fixups. In some cases, special care is needed for instructions that are executed out of line (xol). These are architecture specific artefacts, such as handling RIP relative instructions on x86_64. Since the instruction at which the uprobe was inserted is executed out of line, architecture specific fixups are added so that the thread continues normal execution in the presence of a uprobe. Postpone the signals until we execute the probed insn. post_xol() path does a recalc_sigpending() before return to user-mode, this ensures the signal can't be lost. Uprobes relies on DIE_DEBUG notification to notify if a singlestep is complete. Adds x86 specific uprobe exception notifiers and appropriate hooks needed to determine a uprobe hit and subsequent post processing. Add requisite x86 fixups for xol for uprobes. Specific cases needing fixups include relative jumps (x86_64), calls, etc. Where possible, we check and skip singlestepping the breakpointed instructions. For now we skip single byte as well as few multibyte nop instructions. However this can be extended to other instructions too. Credits to Oleg Nesterov for suggestions/patches related to signal, breakpoint, singlestep handling code. Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Jim Keniston <jkenisto@linux.vnet.ibm.com> Cc: Linux-mm <linux-mm@kvack.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Christoph Hellwig <hch@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Arnaldo Carvalho de Melo <acme@infradead.org> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20120313180011.29771.89027.sendpatchset@srdronam.in.ibm.com [ Performed various cleanliness edits ] Signed-off-by: Ingo Molnar <mingo@elte.hu>
* Merge branch 'x86/cleanups' into perf/uprobesIngo Molnar2012-03-131077-48662/+9581
|\ | | | | | | | | | | Merge reason: We want to merge a dependent patch. Signed-off-by: Ingo Molnar <mingo@elte.hu>
| * x86: Move is_ia32_task to asm/thread_info.h from asm/compat.hSrikar Dronamraju2012-03-132-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | is_ia32_task() is useful even in !CONFIG_COMPAT cases - utrace will use it for example. Hence move it to a more generic file: asm/thread_info.h Also now is_ia32_task() returns true if CONFIG_X86_32 is defined. Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Acked-by: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Jim Keniston <jkenisto@linux.vnet.ibm.com> Cc: Linux-mm <linux-mm@kvack.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Christoph Hellwig <hch@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Arnaldo Carvalho de Melo <acme@infradead.org> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20120313140303.17134.1401.sendpatchset@srdronam.in.ibm.com [ Performed minor cleanup ] Signed-off-by: Ingo Molnar <mingo@elte.hu>
| * x86: Rename trap_no to trap_nr in thread_structSrikar Dronamraju2012-03-1310-22/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are precedences of trap number being referred to as trap_nr. However thread struct refers trap number as trap_no. Change it to trap_nr. Also use enum instead of left-over literals for trap values. This is pure cleanup, no functional change intended. Suggested-by: Ingo Molnar <mingo@eltu.hu> Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Jim Keniston <jkenisto@linux.vnet.ibm.com> Cc: Linux-mm <linux-mm@kvack.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Christoph Hellwig <hch@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Arnaldo Carvalho de Melo <acme@infradead.org> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20120312092555.5379.942.sendpatchset@srdronam.in.ibm.com [ Fixed the math-emu build ] Signed-off-by: Ingo Molnar <mingo@elte.hu>
| * Merge branch 'x86/x32' into x86/cleanupsIngo Molnar2012-03-1391-2180/+1561
| |\ | | | | | | | | | | | | | | | Merge reason: We are going to merge a dependent patch. Signed-off-by: Ingo Molnar <mingo@elte.hu>
| | * x32: Add ptrace for x32H.J. Lu2012-03-052-2/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * x32: Switch to a 64-bit clock_tH. Peter Anvin2012-03-053-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * x32: Provide separate is_ia32_task() and is_x32_task() predicatesH. Peter Anvin2012-03-051-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * x86, mtrr: Use explicit sizing and padding for the 64-bit ioctlsH. Peter Anvin2012-03-012-14/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specify the data structures for the 64-bit ioctls with explicit sizing and padding so that the x32 kernel will correctly use the 64-bit forms of these ioctls. Note that these ioctls are bogus in both forms on both 32 and 64 bits; even on 64 bits the maximum MTRR size is only 44 bits long. Note that nothing really is supposed to use these ioctls and that the preferred interface is text strings on /proc/mtrr, or better yet, nothing at all (use /sys/bus/pci/devices/*/resource*_wc for write combining; that uses PAT not MTRRs.) Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Cc: H. J. Lu <hjl.tools@gmail.com> Tested-by: Nitin A. Kamble <nitin.a.kamble@intel.com> Link: http://lkml.kernel.org/n/tip-vwvnlu3hjmtkwvij4qxtm90l@git.kernel.org Signed-off-by: H. Peter Anvin <hpa@zytor.com>
| | * x86/x32: Fix the binutils auto-detectIngo Molnar2012-02-281-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * x32: Warn and disable rather than error if binutils too oldH. Peter Anvin2012-02-272-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * Merge branch 'core/types' into x86/x32H. Peter Anvin2012-02-252-3/+2
| | |\
| | | * fs: Remove missed ->fds_bits from cessation use of fd_set structs internallyDavid Howells2012-02-242-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stephen Rothwell reported that the following commit broke the linux-next build: 1fd36adcd98c: Replace the fd_sets in struct fdtable with an array of unsigned longs Fix places where ->fds_bits needed to be removed as the core kernel no longer uses fd_set internally for file descriptor table management. There are two places: (1) drivers/staging/android/binder.c (2) arch/mips/kernel/kspd.c Question: Should sp_cleanup() in the MIPS arch be using find_next_bit() or fls()? Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: David Howells <dhowells@redhat.com> cc: Ralf Bächle <ralf@linux-mips.org> cc: Arve Hjønnevåg <arve@android.com> Link: http://lkml.kernel.org/r/20120224105707.32170.11550.stgit@warthog.procyon.org.uk Signed-off-by: Ingo Molnar <mingo@elte.hu>
| | * | x32: Only clear TIF_X32 flag onceBobby Powers2012-02-251-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commits bb212724 and d1a797f3 both added a call to clear_thread_flag(TIF_X32) under set_personality_64bit() - only one is needed. Signed-off-by: Bobby Powers <bobbypowers@gmail.com> Link: http://lkml.kernel.org/r/1330228774-24223-1-git-send-email-bobbypowers@gmail.com Signed-off-by: H. Peter Anvin <hpa@zytor.com>
| | * | x32: Make sure TS_COMPAT is cleared for x32 tasksBobby Powers2012-02-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a process has a non-x32 ia32 personality and changes to x32, the process would keep its TS_COMPAT flag. x32 uses the presence of the x32 flag on a syscall to determine compat status, so make sure TS_COMPAT is cleared. Signed-off-by: Bobby Powers <bobbypowers@gmail.com> Link: http://lkml.kernel.org/r/1330230338-25077-1-git-send-email-bobbypowers@gmail.com Signed-off-by: H. Peter Anvin <hpa@zytor.com>
| | * | Merge branch 'core/types' into x86/x32H. Peter Anvin2012-02-231-1/+1
| | |\ \ | | | |/
| | | * fs: Fix close_on_exec pointer in alloc_fdtableBobby Powers2012-02-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | alloc_fdtable allocates space for the open_fds and close_on_exec bitfields together, as 2 * nr / BITS_PER_BYTE. close_on_exec needs to point to open_fds + nr / BITS_PER_BYTE, not open_fds + nr / BITS_PER_LONG, as introducted in 1fd36adc: Replace the fd_sets in struct fdtable with an array of unsigned longs. Signed-off-by: Bobby Powers <bobbypowers@gmail.com> Link: http://lkml.kernel.org/r/1329888587-3087-1-git-send-email-bobbypowers@gmail.com Acked-by: David Howells <dhowells@redhat.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
| | * | x32: Drop non-__vdso weak symbols from the x32 VDSOH. Peter Anvin2012-02-221-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | x32: Fix coding style violations in the x32 VDSO codeH. Peter Anvin2012-02-213-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the prototype for x32_setup_additional_pages() to a header file, and adjust the coding style to match standard. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Cc: H. J. Lu <hjl.tools@gmail.com>
| | * | x32: Add x32 VDSO supportH. J. Lu2012-02-206-9/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | x32: Allow x32 to be configuredH. J. Lu2012-02-201-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | x32: If configured, add x32 system calls to system call tablesH. Peter Anvin2012-02-202-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | x32: Handle process creationH. Peter Anvin2012-02-205-14/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | x32: Signal-related system callsH. Peter Anvin2012-02-202-1/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | x86: Add #ifdef CONFIG_COMPAT to <asm/sys_ia32.h>H. Peter Anvin2012-02-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | x32: Handle the x32 system call flagH. Peter Anvin2012-02-204-4/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | x32: Add rt_sigframe_x32H. Peter Anvin2012-02-201-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | x32: Add struct ucontext_x32H. J. Lu2012-02-201-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | x32: Export setup/restore_sigcontext from signal.cH. Peter Anvin2012-02-202-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | x86: Move some signal-handling definitions to a common headerH. Peter Anvin2012-02-204-20/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | x32: Generate <asm/unistd_64_x32.h>H. Peter Anvin2012-02-202-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | x32: Generate <asm/unistd_x32.h>H. Peter Anvin2012-02-203-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | x32: Add x32 system calls to syscall/syscall_64.tblH. Peter Anvin2012-02-206-274/+317
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | x86-64, ia32: Drop sys32_rt_sigprocmaskH. Peter Anvin2012-02-203-43/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | x32: Add a thread flag for x32 processesH. Peter Anvin2012-02-202-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | x86-64: Add prototype for old_rsp to a header fileH. J. Lu2012-02-201-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | elf: Allow core dump-related fields to be overriddenH. J. Lu2012-02-201-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | compat: Create compat_sys_p{read,write}v64H. J. Lu2012-02-201-6/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | aio: Use __kernel_ulong_t to define aio_context_tH. Peter Anvin2012-02-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | compat: Handle COMPAT_USE_64BIT_TIME in net/socket.cH. Peter Anvin2012-02-201-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | compat: Use COMPAT_USE_64BIT_TIME in net/compat.cH. J. Lu2012-02-201-25/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | compat: Use COMPAT_USE_64BIT_TIME in the Bluetooth subsystemH. J. Lu2012-02-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | compat: Use COMPAT_USE_64BIT_TIME in the input subsystemH. J. Lu2012-02-202-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | compat: Handle COMPAT_USE_64BIT_TIME in the lp driverH. Peter Anvin2012-02-201-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | compat: Add helper functions to read/write struct timeval, timespecH. Peter Anvin2012-02-202-8/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | compat: Introduce COMPAT_USE_64BIT_TIMEH. J. Lu2012-02-201-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | sysinfo: Use explicit types in <linux/sysinfo.h>H. Peter Anvin2012-02-201-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | x32: Create posix_types_x32.hH. Peter Anvin2012-02-203-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
OpenPOWER on IntegriCloud