]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'signal/for-next'
authorStephen Rothwell <sfr@canb.auug.org.au>
Tue, 9 Oct 2012 03:01:39 +0000 (14:01 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 9 Oct 2012 03:01:39 +0000 (14:01 +1100)
Conflicts:
arch/alpha/Kconfig
arch/arm/Kconfig
arch/arm/include/asm/thread_info.h
arch/avr32/include/asm/Kbuild
arch/c6x/Kconfig
arch/cris/include/asm/Kbuild
arch/frv/include/asm/Kbuild
arch/h8300/include/asm/Kbuild
arch/ia64/include/asm/Kbuild
arch/m32r/include/asm/Kbuild
arch/m68k/Kconfig
arch/microblaze/include/asm/Kbuild
arch/mn10300/Kconfig
arch/mn10300/include/asm/Kbuild
arch/powerpc/Kconfig
arch/s390/Kconfig
arch/um/kernel/exec.c
arch/x86/Kconfig
arch/x86/kernel/process_32.c
arch/x86/kernel/signal.c
arch/xtensa/include/asm/Kbuild
fs/exec.c

76 files changed:
1  2 
arch/Kconfig
arch/alpha/Kconfig
arch/alpha/include/asm/Kbuild
arch/alpha/kernel/process.c
arch/arm/Kconfig
arch/arm/include/asm/ptrace.h
arch/arm/include/asm/thread_info.h
arch/arm/include/asm/unistd.h
arch/arm/kernel/calls.S
arch/arm/kernel/entry-common.S
arch/arm/kernel/process.c
arch/avr32/include/asm/Kbuild
arch/c6x/Kconfig
arch/c6x/include/asm/Kbuild
arch/c6x/include/asm/unistd.h
arch/cris/include/asm/Kbuild
arch/frv/include/asm/Kbuild
arch/frv/kernel/process.c
arch/h8300/include/asm/Kbuild
arch/ia64/include/asm/Kbuild
arch/ia64/kernel/signal.c
arch/m32r/include/asm/Kbuild
arch/m68k/Kconfig
arch/m68k/include/asm/Kbuild
arch/m68k/kernel/process.c
arch/microblaze/include/asm/Kbuild
arch/microblaze/kernel/signal.c
arch/mn10300/Kconfig
arch/mn10300/include/asm/Kbuild
arch/mn10300/kernel/process.c
arch/parisc/include/asm/Kbuild
arch/powerpc/Kconfig
arch/powerpc/include/asm/processor.h
arch/powerpc/include/asm/thread_info.h
arch/powerpc/include/asm/unistd.h
arch/powerpc/kernel/entry_32.S
arch/powerpc/kernel/entry_64.S
arch/powerpc/kernel/ppc_ksyms.c
arch/powerpc/kernel/process.c
arch/powerpc/kernel/sys_ppc32.c
arch/s390/Kconfig
arch/s390/include/asm/processor.h
arch/s390/include/asm/unistd.h
arch/s390/kernel/compat_linux.c
arch/s390/kernel/compat_linux.h
arch/s390/kernel/compat_wrapper.S
arch/s390/kernel/entry64.S
arch/s390/kernel/process.c
arch/sparc/include/asm/Kbuild
arch/tile/include/asm/Kbuild
arch/tile/kernel/compat_signal.c
arch/unicore32/include/asm/Kbuild
arch/x86/Kconfig
arch/x86/ia32/ia32entry.S
arch/x86/ia32/sys_ia32.c
arch/x86/include/asm/processor.h
arch/x86/include/asm/sys_ia32.h
arch/x86/include/asm/thread_info.h
arch/x86/kernel/Makefile
arch/x86/kernel/entry_32.S
arch/x86/kernel/entry_64.S
arch/x86/kernel/process.c
arch/x86/kernel/process_32.c
arch/x86/kernel/process_64.c
arch/x86/kernel/signal.c
arch/x86/um/Kconfig
arch/xtensa/include/asm/Kbuild
fs/binfmt_elf.c
fs/binfmt_elf_fdpic.c
fs/exec.c
include/linux/binfmts.h
include/linux/compat.h
include/linux/ptrace.h
include/linux/sched.h
kernel/fork.c
kernel/sched/core.c

diff --cc arch/Kconfig
Simple merge
index 7e3710c0cce5a4c2ef51b8a889a061979a0b9b24,7da91246e2793c6d8ecf5556ca65530c6c7275c0..6ac8f6e512f6f6a49949bd0378a6d848b8da8ecc
@@@ -20,8 -20,7 +20,9 @@@ config ALPH
        select GENERIC_CMOS_UPDATE
        select GENERIC_STRNCPY_FROM_USER
        select GENERIC_STRNLEN_USER
 +      select HAVE_MOD_ARCH_SPECIFIC
 +      select MODULES_USE_ELF_RELA
+       select GENERIC_KERNEL_THREAD
        help
          The Alpha is a 64-bit general-purpose processor designed and
          marketed by the Digital Equipment Corporation of blessed memory,
Simple merge
Simple merge
index 6434a3ca79e5e3d8c6b9c39cd6470a2ff61bae89,a949eec2286190c8739e60017165f2e50381b917..e85f2b635bc37d7f15523bca0c661d131dd690ac
@@@ -50,8 -49,7 +50,9 @@@ config AR
        select GENERIC_STRNCPY_FROM_USER
        select GENERIC_STRNLEN_USER
        select DCACHE_WORD_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && !CPU_BIG_ENDIAN
 +      select HAVE_MOD_ARCH_SPECIFIC if ARM_UNWIND
 +      select MODULES_USE_ELF_REL
+       select GENERIC_KERNEL_THREAD
        help
          The ARM series is a line of low-power-consumption RISC chip designs
          licensed by ARM Ltd and targeted at embedded applications and
Simple merge
index f71cdab18b87589beb5d4df33bcae80483e71536,b2d6b412172d1990cedd5d873a4fdae07bbade67..8477b4c1d39fb3fe43c21691d1ad46846a947e89
@@@ -150,8 -148,6 +150,7 @@@ extern int vfp_restore_user_hwstate(str
  #define TIF_NOTIFY_RESUME     2       /* callback before returning to user */
  #define TIF_SYSCALL_TRACE     8
  #define TIF_SYSCALL_AUDIT     9
- #define TIF_POLLING_NRFLAG    16
 +#define TIF_SYSCALL_TRACEPOINT        10
  #define TIF_USING_IWMMXT      17
  #define TIF_MEMDIE            18      /* is terminating due to OOM killer */
  #define TIF_RESTORE_SIGMASK   20
  #define _TIF_NOTIFY_RESUME    (1 << TIF_NOTIFY_RESUME)
  #define _TIF_SYSCALL_TRACE    (1 << TIF_SYSCALL_TRACE)
  #define _TIF_SYSCALL_AUDIT    (1 << TIF_SYSCALL_AUDIT)
- #define _TIF_POLLING_NRFLAG   (1 << TIF_POLLING_NRFLAG)
 +#define _TIF_SYSCALL_TRACEPOINT       (1 << TIF_SYSCALL_TRACEPOINT)
  #define _TIF_USING_IWMMXT     (1 << TIF_USING_IWMMXT)
  #define _TIF_SECCOMP          (1 << TIF_SECCOMP)
  
Simple merge
Simple merge
Simple merge
Simple merge
index e3ba7bca06fae732929e28a4b00be0374883de17,aa47fff70760b4fd0e4a2cf21521483fb4a00a13..be0433ee5a8ec79c86a1d049cca58a6890df3230
@@@ -1,5 -1,4 +1,6 @@@
  include include/asm-generic/Kbuild.asm
  
 +generic-y     += clkdev.h
+ generic-y     += exec.h
 +
  header-y      += cachectl.h
index f6a3648f5ec3c7030a8c4294be4e3bee54a25b6c,45268b50c0c88907e09a738a3d60f55c4ac2afe5..20ef56e467b364d930ed42749f22ebb97eeaba2f
@@@ -17,7 -17,7 +17,8 @@@ config C6
        select OF
        select OF_EARLY_FLATTREE
        select GENERIC_CLOCKEVENTS
 +      select MODULES_USE_ELF_RELA
+       select GENERIC_KERNEL_THREAD
  
  config MMU
        def_bool n
Simple merge
index ed2259043eec278b5a792b0660a326e66e292142,3c131d5888c11253cabb21cce01edbc2df28e25c..4ff747d12dad317e408c86bf8df6285bb31d980b
   *   NON INFRINGEMENT.        See the GNU General Public License for
   *   more details.
   */
 -#if !defined(_ASM_C6X_UNISTD_H) || defined(__SYSCALL)
 -#define _ASM_C6X_UNISTD_H
  
+ #define __ARCH_WANT_KERNEL_EXECVE
+ #define __ARCH_WANT_SYS_EXECVE
  /* Use the standard ABI for syscalls. */
  #include <asm-generic/unistd.h>
  
index 6900bbf903c55f5f8fa9f0d616c1b7f411a535c8,b68ad4bfa088cffd5293fc4c3cfad53e6b060c45..a0f88f2b242579876aa9f9fea8b29b4d73c9a96c
@@@ -8,5 -8,4 +8,6 @@@ header-y += etraxgpio.
  header-y += rs485.h
  header-y += sync_serial.h
  
 +generic-y += module.h
 +generic-y += clkdev.h
+ generic-y += exec.h
index 13cd044aabdfe43ece5b8345f291e1291e86c6e7,32c16468cf5e74e677edd6e014b9bd1f40b29ce8..557eba73997c53a88aff4307be096f1b15ef997b
@@@ -2,4 -2,4 +2,6 @@@ include include/asm-generic/Kbuild.as
  
  header-y += registers.h
  header-y += termios.h
++
 +generic-y += clkdev.h
+ generic-y += exec.h
Simple merge
index 98477e928788c8622e1286302810beda2724f7c9,3a2af1a2974fc49e21586455c608d3b192f613f4..1e8326951f4b30bc2d8b46a4983ef2468188f4b0
@@@ -1,4 -1,2 +1,5 @@@
  include include/asm-generic/Kbuild.asm
 +
 +generic-y     += module.h
 +generic-y     += clkdev.h
+ generic-y += exec.h
index d756d59034b8e8d2a7c8853ce41834eb2342fdfd,98efd48d7da4dfbeefa23a55022d893165d483c2..72a50b2b4857ea8ad2aee6d31746946fcaaacd07
@@@ -1,1 -1,16 +1,2 @@@
 -include include/asm-generic/Kbuild.asm
 -
 -header-y += break.h
 -header-y += cmpxchg.h
 -header-y += fpu.h
 -header-y += gcc_intrin.h
 -header-y += ia64regs.h
 -header-y += intel_intrin.h
 -header-y += intrinsics.h
 -header-y += perfmon.h
 -header-y += perfmon_default_smpl.h
 -header-y += ptrace_offsets.h
 -header-y += rse.h
 -header-y += ucontext.h
 -header-y += ustack.h
 +generic-y += clkdev.h
+ generic-y += exec.h
Simple merge
index 98477e928788c8622e1286302810beda2724f7c9,708340339b057e16c4accba616fd5d37ffa53838..1e8326951f4b30bc2d8b46a4983ef2468188f4b0
@@@ -1,4 -1,3 +1,5 @@@
  include include/asm-generic/Kbuild.asm
  
 +generic-y     += module.h
 +generic-y     += clkdev.h
+ generic-y += exec.h
index 0df07cee3faf5e1c0585f879a8e61e8d69a1d81b,ccda007ba40fae0e0d0fb7e8b18febabb368cc27..b4126a7dfddcd9c44da41b1c48e136cf26917066
@@@ -13,9 -13,7 +13,10 @@@ config M68
        select FPU if MMU
        select ARCH_WANT_IPC_PARSE_VERSION
        select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE
 +      select HAVE_MOD_ARCH_SPECIFIC
 +      select MODULES_USE_ELF_REL
 +      select MODULES_USE_ELF_RELA
+       select GENERIC_KERNEL_THREAD
  
  config RWSEM_GENERIC_SPINLOCK
        bool
Simple merge
Simple merge
index 48510f6cec8f23f924c9bdc1781540282bcb0a7b,5a0e72bf998d90516f3acbd5a3275093b4dd0dd7..8653072d7e9f061479c5b11c5de056337cfdac7a
@@@ -1,4 -1,4 +1,5 @@@
  include include/asm-generic/Kbuild.asm
  
  header-y  += elf.h
 +generic-y += clkdev.h
+ generic-y += exec.h
Simple merge
index aa03f2e13385fe5083a50b17ae6f8c02e3ccb269,ddbdc33471a830b152ec1f5cb3dcf9912d805fda..549b9e50182eb26ab8d10a9eae0e9f38e63e852f
@@@ -8,7 -8,7 +8,8 @@@ config MN1030
        select HAVE_ARCH_KGDB
        select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER
        select GENERIC_CLOCKEVENTS
 +      select MODULES_USE_ELF_RELA
+       select GENERIC_KERNEL_THREAD
  
  config AM33_2
        def_bool n
index 0d20f5526dd8e99b7ba770d677bc17480f4bdb40,708340339b057e16c4accba616fd5d37ffa53838..fccd81eddff1f6de89b07cc13c362809364c9507
@@@ -1,3 -1,3 +1,4 @@@
  include include/asm-generic/Kbuild.asm
  
 +generic-y += clkdev.h
+ generic-y += exec.h
Simple merge
index 0587f62e5b76027291cea9dd62954d230cc38c06,818d6516567864cb0a4f52361ee863774e01dece..458371a1565aa2fdcbaa75e27ab398d8741019a9
@@@ -1,5 -1,5 +1,6 @@@
  include include/asm-generic/Kbuild.asm
  
  header-y += pdc.h
 +generic-y += clkdev.h
  generic-y += word-at-a-time.h
+ generic-y += exec.h
index 8d8a7c6a7066c7a160e5f172617063c687afe050,6e5a0979c085b9947e395a8a06dd7d3cae15d554..088fc76ce9f014c82ab7af20a518b771f57d61e6
@@@ -139,8 -139,7 +139,9 @@@ config PP
        select GENERIC_CLOCKEVENTS
        select GENERIC_STRNCPY_FROM_USER
        select GENERIC_STRNLEN_USER
 +      select HAVE_MOD_ARCH_SPECIFIC
 +      select MODULES_USE_ELF_RELA
+       select GENERIC_KERNEL_THREAD
  
  config EARLY_PRINTK
        bool
Simple merge
index c683fa350add7f5f34547ff88f58233f1724c338,26a6825909b6de44ded64ddb78b4c4e96b0c75c0..2533752af30f75dc63e333e48e7939e40ee85cb0
  #define __ARCH_WANT_COMPAT_SYS_TIME
  #define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
  #define __ARCH_WANT_SYS_NEWFSTATAT
 +#define __ARCH_WANT_COMPAT_SYS_SENDFILE
  #endif
+ #define __ARCH_WANT_SYS_EXECVE
+ #define __ARCH_WANT_KERNEL_EXECVE
  
  /*
   * "Conditional" syscalls
Simple merge
Simple merge
Simple merge
Simple merge
index abd1112da54f40b1b24a08a6a0732373ad95ef0e,a1ae73a0f352857407b38811e62161217cd14e70..9c2ed90ece8f4cdb93b75456f70376b944d52703
@@@ -143,41 -143,50 +143,19 @@@ long compat_sys_ipc(u32 call, u32 first
   * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
   * and the register representation of a signed int (msr in 64-bit mode) is performed.
   */
 -asmlinkage long compat_sys_sendfile(u32 out_fd, u32 in_fd, compat_off_t __user * offset, u32 count)
 +asmlinkage long compat_sys_sendfile_wrapper(u32 out_fd, u32 in_fd,
 +                                          compat_off_t __user *offset, u32 count)
  {
 -      mm_segment_t old_fs = get_fs();
 -      int ret;
 -      off_t of;
 -      off_t __user *up;
 -
 -      if (offset && get_user(of, offset))
 -              return -EFAULT;
 -
 -      /* The __user pointer cast is valid because of the set_fs() */          
 -      set_fs(KERNEL_DS);
 -      up = offset ? (off_t __user *) &of : NULL;
 -      ret = sys_sendfile((int)out_fd, (int)in_fd, up, count);
 -      set_fs(old_fs);
 -      
 -      if (offset && put_user(of, offset))
 -              return -EFAULT;
 -              
 -      return ret;
 +      return compat_sys_sendfile((int)out_fd, (int)in_fd, offset, count);
  }
  
 -asmlinkage int compat_sys_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, s32 count)
 +asmlinkage long compat_sys_sendfile64_wrapper(u32 out_fd, u32 in_fd,
 +                                            compat_loff_t __user *offset, u32 count)
  {
 -      mm_segment_t old_fs = get_fs();
 -      int ret;
 -      loff_t lof;
 -      loff_t __user *up;
 -      
 -      if (offset && get_user(lof, offset))
 -              return -EFAULT;
 -              
 -      /* The __user pointer cast is valid because of the set_fs() */          
 -      set_fs(KERNEL_DS);
 -      up = offset ? (loff_t __user *) &lof : NULL;
 -      ret = sys_sendfile64(out_fd, in_fd, up, count);
 -      set_fs(old_fs);
 -      
 -      if (offset && put_user(lof, offset))
 -              return -EFAULT;
 -              
 -      return ret;
 +      return sys_sendfile((int)out_fd, (int)in_fd,
 +                          (off_t __user *)offset, count);
  }
  
- long compat_sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
-                 unsigned long a3, unsigned long a4, unsigned long a5,
-                 struct pt_regs *regs)
- {
-       int error;
-       char * filename;
-       
-       filename = getname((char __user *) a0);
-       error = PTR_ERR(filename);
-       if (IS_ERR(filename))
-               goto out;
-       flush_fp_to_thread(current);
-       flush_altivec_to_thread(current);
-       error = compat_do_execve(filename, compat_ptr(a1), compat_ptr(a2), regs);
-       putname(filename);
- out:
-       return error;
- }
  /* Note: it is necessary to treat option as an unsigned int, 
   * with the corresponding cast to a signed int to insure that the 
   * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
index de7ce84eae560b455cae1ce1764bdff1db838b2c,57442393bac72783270ccce346f3972b1aa8bea5..35eaaaa62d3f62320f893cba8340cbb57f01a330
@@@ -132,8 -125,7 +132,9 @@@ config S39
        select GENERIC_CLOCKEVENTS
        select KTIME_SCALAR if 32BIT
        select HAVE_ARCH_SECCOMP_FILTER
 +      select HAVE_MOD_ARCH_SPECIFIC
 +      select MODULES_USE_ELF_RELA
+       select GENERIC_KERNEL_THREAD
  
  config SCHED_OMIT_FRAME_POINTER
        def_bool y
index 56831dfa9198c6e2192605fd5ee9d68c538d8b17,da6f5baeee5c20925d82a648690fa12c14ea8044..94e749c90230d9f824949429d505625f90f7b4e7
@@@ -142,15 -133,8 +145,14 @@@ struct task_struct
  struct mm_struct;
  struct seq_file;
  
 +#ifdef CONFIG_64BIT
 +extern void show_cacheinfo(struct seq_file *m);
 +#else
 +static inline void show_cacheinfo(struct seq_file *m) { }
 +#endif
 +
  /* Free all resources held by a thread. */
  extern void release_thread(struct task_struct *);
- extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
  
  /*
   * Return saved PC of a blocked thread.
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 5024be27df444b3dedc669f823734404fcb0fe4c,bab088de45697b4772d26e76638554b5f688420a..cd31ad457a9bdb7890a0ff7eae840a63f5f0f48f
@@@ -169,15 -146,25 +149,30 @@@ int copy_thread(unsigned long clone_fla
        /* fake return stack for resume(), don't go back to schedule */
        frame->sf.gprs[9] = (unsigned long) frame;
  
-       /* Save access registers to new thread structure. */
-       save_access_regs(&p->thread.acrs[0]);
+       /* Store access registers to kernel stack of new process. */
+       if (unlikely(!regs)) {
+               /* kernel thread */
+               memset(&frame->childregs, 0, sizeof(struct pt_regs));
+               frame->childregs.psw.mask = psw_kernel_bits | PSW_MASK_DAT |
+                               PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK;
+               frame->childregs.psw.addr = PSW_ADDR_AMODE |
+                               (unsigned long) kernel_thread_starter;
+               frame->childregs.gprs[9] = new_stackp; /* function */
+               frame->childregs.gprs[10] = arg;
+               frame->childregs.gprs[11] = (unsigned long) do_exit;
+               frame->childregs.orig_gpr2 = -1;
+               return 0;
+       }
+       frame->childregs = *regs;
+       frame->childregs.gprs[2] = 0;   /* child returns 0 on fork. */
+       frame->childregs.gprs[15] = new_stackp;
  
 +      /* Don't copy runtime instrumentation info */
 +      p->thread.ri_cb = NULL;
 +      p->thread.ri_signum = 0;
 +      frame->childregs.psw.mask &= ~PSW_MASK_RI;
 +
  #ifndef CONFIG_64BIT
        /*
         * save fprs to current->thread.fp_regs to merge them with
index 100aa10fd78f22c0cee787290a40eb19e1269ff3,cf1e85782703600bef492ba2f23cf6bb988e4ec7..164e6f24671cda02c57542ab4f732b5417337053
@@@ -17,8 -17,8 +17,9 @@@ header-y += uctx.
  header-y += utrap.h
  header-y += watchdog.h
  
 +generic-y += clkdev.h
  generic-y += div64.h
+ generic-y += exec.h
  generic-y += local64.h
  generic-y += irq_regs.h
  generic-y += local.h
Simple merge
Simple merge
Simple merge
index 3ba3813932ba125ff8e793feff41428fbb92f088,d93eb9d1bb974bab77fb37045bf2a11f199303c0..8fc92d61a78677d1c55241721bf1706e845076b6
@@@ -102,14 -97,10 +102,15 @@@ config X8
        select KTIME_SCALAR if X86_32
        select GENERIC_STRNCPY_FROM_USER
        select GENERIC_STRNLEN_USER
 +      select MODULES_USE_ELF_REL if X86_32
 +      select MODULES_USE_ELF_RELA if X86_64
 +      select HAVE_RCU_USER_QS if X86_64
 +      select HAVE_IRQ_TIME_ACCOUNTING
+       select GENERIC_KERNEL_THREAD
  
  config INSTRUCTION_DECODER
 -      def_bool (KPROBES || PERF_EVENTS || UPROBES)
 +      def_bool y
 +      depends on KPROBES || PERF_EVENTS || UPROBES
  
  config OUTPUT_FORMAT
        string
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index b9ff83c7135bad337d4e5d7e7554be6e833204a0,25e7e9390d26349208eabac5f19e36725682aa67..44e0bff38e724de5b9e02e5bd9581133999ad40e
@@@ -190,6 -207,16 +207,12 @@@ start_thread(struct pt_regs *regs, unsi
        regs->cs                = __USER_CS;
        regs->ip                = new_ip;
        regs->sp                = new_sp;
 -      /*
 -       * Free the old FP and other extended state
 -       */
 -      free_thread_xstate(current);
+       regs->flags             = X86_EFLAGS_IF;
+       /*
+        * force it to the iret return path by making it look as if there was
+        * some work pending.
+        */
+       set_thread_flag(TIF_NOTIFY_RESUME);
  }
  EXPORT_SYMBOL_GPL(start_thread);
  
Simple merge
index b33144c8b3098a10d956882f31e6ca1933770ce7,c648fc5298729b76e1ab677df263d7d3a1f3551e..29ad351804e9324d3aaf59c07c86d274958516b3
@@@ -839,12 -800,6 +839,8 @@@ do_notify_resume(struct pt_regs *regs, 
        }
        if (thread_info_flags & _TIF_USER_RETURN_NOTIFY)
                fire_user_return_notifiers();
- #ifdef CONFIG_X86_32
-       clear_thread_flag(TIF_IRET);
- #endif /* CONFIG_X86_32 */
 +
 +      rcu_user_enter();
  }
  
  void signal_fault(struct pt_regs *regs, void __user *frame, char *where)
Simple merge
index 0d20f5526dd8e99b7ba770d677bc17480f4bdb40,708340339b057e16c4accba616fd5d37ffa53838..fccd81eddff1f6de89b07cc13c362809364c9507
@@@ -1,3 -1,3 +1,4 @@@
  include include/asm-generic/Kbuild.asm
  
 +generic-y += clkdev.h
+ generic-y += exec.h
diff --cc fs/binfmt_elf.c
index 28a64e76952788146d24b4fe0e0069918c0b9584,2ab91905b2e2ca848c1ebc02caa313b5602065cf..5ce922db010d59ff420fb2e51512379a29d625a7
  #include <asm/uaccess.h>
  #include <asm/param.h>
  #include <asm/page.h>
- #include <asm/exec.h>
  
 +#ifndef user_long_t
 +#define user_long_t long
 +#endif
 +#ifndef user_siginfo_t
 +#define user_siginfo_t siginfo_t
 +#endif
 +
  static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs);
  static int load_elf_library(struct file *);
  static unsigned long elf_map(struct file *, unsigned long, struct elf_phdr *,
Simple merge
diff --cc fs/exec.c
index 19f4fb80cd17bf0a8e889e39608a866f5591e829,50a1270da95b4b08f91ddfa58d27ea4e13051cca..3edb36e708ec799c97408d79fc26073a7c9561f8
+++ b/fs/exec.c
@@@ -1658,3 -2031,342 +1657,55 @@@ int get_dumpable(struct mm_struct *mm
  {
        return __get_dumpable(mm->flags);
  }
 -static void wait_for_dump_helpers(struct file *file)
 -{
 -      struct pipe_inode_info *pipe;
 -
 -      pipe = file->f_path.dentry->d_inode->i_pipe;
 -
 -      pipe_lock(pipe);
 -      pipe->readers++;
 -      pipe->writers--;
 -
 -      while ((pipe->readers > 1) && (!signal_pending(current))) {
 -              wake_up_interruptible_sync(&pipe->wait);
 -              kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
 -              pipe_wait(pipe);
 -      }
 -
 -      pipe->readers--;
 -      pipe->writers++;
 -      pipe_unlock(pipe);
 -
 -}
 -
 -
 -/*
 - * umh_pipe_setup
 - * helper function to customize the process used
 - * to collect the core in userspace.  Specifically
 - * it sets up a pipe and installs it as fd 0 (stdin)
 - * for the process.  Returns 0 on success, or
 - * PTR_ERR on failure.
 - * Note that it also sets the core limit to 1.  This
 - * is a special value that we use to trap recursive
 - * core dumps
 - */
 -static int umh_pipe_setup(struct subprocess_info *info, struct cred *new)
 -{
 -      struct file *files[2];
 -      struct fdtable *fdt;
 -      struct coredump_params *cp = (struct coredump_params *)info->data;
 -      struct files_struct *cf = current->files;
 -      int err = create_pipe_files(files, 0);
 -      if (err)
 -              return err;
 -
 -      cp->file = files[1];
 -
 -      sys_close(0);
 -      fd_install(0, files[0]);
 -      spin_lock(&cf->file_lock);
 -      fdt = files_fdtable(cf);
 -      __set_open_fd(0, fdt);
 -      __clear_close_on_exec(0, fdt);
 -      spin_unlock(&cf->file_lock);
 -
 -      /* and disallow core files too */
 -      current->signal->rlim[RLIMIT_CORE] = (struct rlimit){1, 1};
 -
 -      return 0;
 -}
 -
 -void do_coredump(long signr, int exit_code, struct pt_regs *regs)
 -{
 -      struct core_state core_state;
 -      struct core_name cn;
 -      struct mm_struct *mm = current->mm;
 -      struct linux_binfmt * binfmt;
 -      const struct cred *old_cred;
 -      struct cred *cred;
 -      int retval = 0;
 -      int flag = 0;
 -      int ispipe;
 -      bool need_nonrelative = false;
 -      static atomic_t core_dump_count = ATOMIC_INIT(0);
 -      struct coredump_params cprm = {
 -              .signr = signr,
 -              .regs = regs,
 -              .limit = rlimit(RLIMIT_CORE),
 -              /*
 -               * We must use the same mm->flags while dumping core to avoid
 -               * inconsistency of bit flags, since this flag is not protected
 -               * by any locks.
 -               */
 -              .mm_flags = mm->flags,
 -      };
 -
 -      audit_core_dumps(signr);
 -
 -      binfmt = mm->binfmt;
 -      if (!binfmt || !binfmt->core_dump)
 -              goto fail;
 -      if (!__get_dumpable(cprm.mm_flags))
 -              goto fail;
 -
 -      cred = prepare_creds();
 -      if (!cred)
 -              goto fail;
 -      /*
 -       * We cannot trust fsuid as being the "true" uid of the process
 -       * nor do we know its entire history. We only know it was tainted
 -       * so we dump it as root in mode 2, and only into a controlled
 -       * environment (pipe handler or fully qualified path).
 -       */
 -      if (__get_dumpable(cprm.mm_flags) == SUID_DUMPABLE_SAFE) {
 -              /* Setuid core dump mode */
 -              flag = O_EXCL;          /* Stop rewrite attacks */
 -              cred->fsuid = GLOBAL_ROOT_UID;  /* Dump root private */
 -              need_nonrelative = true;
 -      }
 -
 -      retval = coredump_wait(exit_code, &core_state);
 -      if (retval < 0)
 -              goto fail_creds;
 -
 -      old_cred = override_creds(cred);
 -
 -      /*
 -       * Clear any false indication of pending signals that might
 -       * be seen by the filesystem code called to write the core file.
 -       */
 -      clear_thread_flag(TIF_SIGPENDING);
 -
 -      ispipe = format_corename(&cn, signr);
 -
 -      if (ispipe) {
 -              int dump_count;
 -              char **helper_argv;
 -
 -              if (ispipe < 0) {
 -                      printk(KERN_WARNING "format_corename failed\n");
 -                      printk(KERN_WARNING "Aborting core\n");
 -                      goto fail_corename;
 -              }
 -
 -              if (cprm.limit == 1) {
 -                      /* See umh_pipe_setup() which sets RLIMIT_CORE = 1.
 -                       *
 -                       * Normally core limits are irrelevant to pipes, since
 -                       * we're not writing to the file system, but we use
 -                       * cprm.limit of 1 here as a speacial value, this is a
 -                       * consistent way to catch recursive crashes.
 -                       * We can still crash if the core_pattern binary sets
 -                       * RLIM_CORE = !1, but it runs as root, and can do
 -                       * lots of stupid things.
 -                       *
 -                       * Note that we use task_tgid_vnr here to grab the pid
 -                       * of the process group leader.  That way we get the
 -                       * right pid if a thread in a multi-threaded
 -                       * core_pattern process dies.
 -                       */
 -                      printk(KERN_WARNING
 -                              "Process %d(%s) has RLIMIT_CORE set to 1\n",
 -                              task_tgid_vnr(current), current->comm);
 -                      printk(KERN_WARNING "Aborting core\n");
 -                      goto fail_unlock;
 -              }
 -              cprm.limit = RLIM_INFINITY;
 -
 -              dump_count = atomic_inc_return(&core_dump_count);
 -              if (core_pipe_limit && (core_pipe_limit < dump_count)) {
 -                      printk(KERN_WARNING "Pid %d(%s) over core_pipe_limit\n",
 -                             task_tgid_vnr(current), current->comm);
 -                      printk(KERN_WARNING "Skipping core dump\n");
 -                      goto fail_dropcount;
 -              }
 -
 -              helper_argv = argv_split(GFP_KERNEL, cn.corename+1, NULL);
 -              if (!helper_argv) {
 -                      printk(KERN_WARNING "%s failed to allocate memory\n",
 -                             __func__);
 -                      goto fail_dropcount;
 -              }
 -
 -              retval = call_usermodehelper_fns(helper_argv[0], helper_argv,
 -                                      NULL, UMH_WAIT_EXEC, umh_pipe_setup,
 -                                      NULL, &cprm);
 -              argv_free(helper_argv);
 -              if (retval) {
 -                      printk(KERN_INFO "Core dump to %s pipe failed\n",
 -                             cn.corename);
 -                      goto close_fail;
 -              }
 -      } else {
 -              struct inode *inode;
 -
 -              if (cprm.limit < binfmt->min_coredump)
 -                      goto fail_unlock;
 -
 -              if (need_nonrelative && cn.corename[0] != '/') {
 -                      printk(KERN_WARNING "Pid %d(%s) can only dump core "\
 -                              "to fully qualified path!\n",
 -                              task_tgid_vnr(current), current->comm);
 -                      printk(KERN_WARNING "Skipping core dump\n");
 -                      goto fail_unlock;
 -              }
 -
 -              cprm.file = filp_open(cn.corename,
 -                               O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE | flag,
 -                               0600);
 -              if (IS_ERR(cprm.file))
 -                      goto fail_unlock;
 -
 -              inode = cprm.file->f_path.dentry->d_inode;
 -              if (inode->i_nlink > 1)
 -                      goto close_fail;
 -              if (d_unhashed(cprm.file->f_path.dentry))
 -                      goto close_fail;
 -              /*
 -               * AK: actually i see no reason to not allow this for named
 -               * pipes etc, but keep the previous behaviour for now.
 -               */
 -              if (!S_ISREG(inode->i_mode))
 -                      goto close_fail;
 -              /*
 -               * Dont allow local users get cute and trick others to coredump
 -               * into their pre-created files.
 -               */
 -              if (!uid_eq(inode->i_uid, current_fsuid()))
 -                      goto close_fail;
 -              if (!cprm.file->f_op || !cprm.file->f_op->write)
 -                      goto close_fail;
 -              if (do_truncate(cprm.file->f_path.dentry, 0, 0, cprm.file))
 -                      goto close_fail;
 -      }
 -
 -      retval = binfmt->core_dump(&cprm);
 -      if (retval)
 -              current->signal->group_exit_code |= 0x80;
 -
 -      if (ispipe && core_pipe_limit)
 -              wait_for_dump_helpers(cprm.file);
 -close_fail:
 -      if (cprm.file)
 -              filp_close(cprm.file, NULL);
 -fail_dropcount:
 -      if (ispipe)
 -              atomic_dec(&core_dump_count);
 -fail_unlock:
 -      kfree(cn.corename);
 -fail_corename:
 -      coredump_finish(mm);
 -      revert_creds(old_cred);
 -fail_creds:
 -      put_cred(cred);
 -fail:
 -      return;
 -}
 -
 -/*
 - * Core dumping helper functions.  These are the only things you should
 - * do on a core-file: use only these functions to write out all the
 - * necessary info.
 - */
 -int dump_write(struct file *file, const void *addr, int nr)
 -{
 -      return access_ok(VERIFY_READ, addr, nr) && file->f_op->write(file, addr, nr, &file->f_pos) == nr;
 -}
 -EXPORT_SYMBOL(dump_write);
 -
 -int dump_seek(struct file *file, loff_t off)
 -{
 -      int ret = 1;
 -
 -      if (file->f_op->llseek && file->f_op->llseek != no_llseek) {
 -              if (file->f_op->llseek(file, off, SEEK_CUR) < 0)
 -                      return 0;
 -      } else {
 -              char *buf = (char *)get_zeroed_page(GFP_KERNEL);
 -
 -              if (!buf)
 -                      return 0;
 -              while (off > 0) {
 -                      unsigned long n = off;
 -
 -                      if (n > PAGE_SIZE)
 -                              n = PAGE_SIZE;
 -                      if (!dump_write(file, buf, n)) {
 -                              ret = 0;
 -                              break;
 -                      }
 -                      off -= n;
 -              }
 -              free_page((unsigned long)buf);
 -      }
 -      return ret;
 -}
 -EXPORT_SYMBOL(dump_seek);
 -
+ #ifdef __ARCH_WANT_SYS_EXECVE
+ SYSCALL_DEFINE3(execve,
+               const char __user *, filename,
+               const char __user *const __user *, argv,
+               const char __user *const __user *, envp)
+ {
+       const char *path = getname(filename);
+       int error = PTR_ERR(path);
+       if (!IS_ERR(path)) {
+               error = do_execve(path, argv, envp, current_pt_regs());
+               putname(path);
+       }
+       return error;
+ }
+ #ifdef CONFIG_COMPAT
+ asmlinkage long compat_sys_execve(const char __user * filename,
+       const compat_uptr_t __user * argv,
+       const compat_uptr_t __user * envp)
+ {
+       const char *path = getname(filename);
+       int error = PTR_ERR(path);
+       if (!IS_ERR(path)) {
+               error = compat_do_execve(path, argv, envp, current_pt_regs());
+               putname(path);
+       }
+       return error;
+ }
+ #endif
+ #endif
+ #ifdef __ARCH_WANT_KERNEL_EXECVE
+ int kernel_execve(const char *filename,
+                 const char *const argv[],
+                 const char *const envp[])
+ {
+       struct pt_regs *p = current_pt_regs();
+       int ret;
+       ret = do_execve(filename,
+                       (const char __user *const __user *)argv,
+                       (const char __user *const __user *)envp, p);
+       if (ret < 0)
+               return ret;
+       /*
+        * We were successful.  We won't be returning to our caller, but
+        * instead to user space by manipulating the kernel stack.
+        */
+       ret_from_kernel_execve(p);
+ }
+ #endif
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc kernel/fork.c
Simple merge
Simple merge