Permalink
Browse files

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…

…/git/viro/signal

Pull signal handling cleanups from Al Viro:
 "sigaltstack infrastructure + conversion for x86, alpha and um,
  COMPAT_SYSCALL_DEFINE infrastructure.

  Note that there are several conflicts between "unify
  SS_ONSTACK/SS_DISABLE definitions" and UAPI patches in mainline;
  resolution is trivial - just remove definitions of SS_ONSTACK and
  SS_DISABLED from arch/*/uapi/asm/signal.h; they are all identical and
  include/uapi/linux/signal.h contains the unified variant."

Fixed up conflicts as per Al.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal:
  alpha: switch to generic sigaltstack
  new helpers: __save_altstack/__compat_save_altstack, switch x86 and um to those
  generic compat_sys_sigaltstack()
  introduce generic sys_sigaltstack(), switch x86 and um to it
  new helper: compat_user_stack_pointer()
  new helper: restore_altstack()
  unify SS_ONSTACK/SS_DISABLE definitions
  new helper: current_user_stack_pointer()
  missing user_stack_pointer() instances
  Bury the conditionals from kernel_thread/kernel_execve series
  COMPAT_SYSCALL_DEFINE: infrastructure
  • Loading branch information...
2 parents f59dc2b + 50ececc commit 54d46ea993744c5408e39ce0cb4851e13cbea716 @torvalds committed Dec 21, 2012
Showing with 211 additions and 357 deletions.
  1. +3 −6 arch/Kconfig
  2. +1 −2 arch/alpha/Kconfig
  3. +1 −0 arch/alpha/include/asm/ptrace.h
  4. +0 −1 arch/alpha/include/asm/unistd.h
  5. +0 −6 arch/alpha/include/uapi/asm/signal.h
  6. +1 −9 arch/alpha/kernel/signal.c
  7. +0 −2 arch/arm/Kconfig
  8. +0 −1 arch/arm/include/asm/unistd.h
  9. +0 −7 arch/arm/include/uapi/asm/signal.h
  10. +0 −2 arch/arm64/Kconfig
  11. +3 −2 arch/arm64/include/asm/compat.h
  12. +0 −1 arch/arm64/include/asm/unistd.h
  13. +0 −2 arch/avr32/Kconfig
  14. +1 −0 arch/avr32/include/asm/ptrace.h
  15. +0 −1 arch/avr32/include/asm/unistd.h
  16. +0 −6 arch/avr32/include/uapi/asm/signal.h
  17. +0 −2 arch/blackfin/Kconfig
  18. +1 −0 arch/blackfin/include/asm/ptrace.h
  19. +0 −1 arch/blackfin/include/asm/unistd.h
  20. +0 −2 arch/c6x/Kconfig
  21. +0 −1 arch/c6x/include/uapi/asm/unistd.h
  22. +0 −2 arch/cris/Kconfig
  23. +1 −0 arch/cris/include/asm/ptrace.h
  24. +0 −1 arch/cris/include/asm/unistd.h
  25. +0 −6 arch/cris/include/uapi/asm/signal.h
  26. +0 −2 arch/frv/Kconfig
  27. +0 −1 arch/frv/include/asm/unistd.h
  28. +0 −2 arch/h8300/Kconfig
  29. +1 −0 arch/h8300/include/asm/ptrace.h
  30. +0 −1 arch/h8300/include/asm/unistd.h
  31. +0 −6 arch/h8300/include/uapi/asm/signal.h
  32. +0 −2 arch/hexagon/Kconfig
  33. +0 −1 arch/hexagon/include/uapi/asm/unistd.h
  34. +0 −2 arch/ia64/Kconfig
  35. +5 −0 arch/ia64/include/asm/ptrace.h
  36. +0 −1 arch/ia64/include/asm/unistd.h
  37. +0 −6 arch/ia64/include/uapi/asm/signal.h
  38. +0 −2 arch/m32r/Kconfig
  39. +1 −0 arch/m32r/include/asm/ptrace.h
  40. +0 −1 arch/m32r/include/asm/unistd.h
  41. +0 −6 arch/m32r/include/uapi/asm/signal.h
  42. +0 −2 arch/m68k/Kconfig
  43. +1 −0 arch/m68k/include/asm/ptrace.h
  44. +0 −1 arch/m68k/include/asm/unistd.h
  45. +0 −6 arch/m68k/include/uapi/asm/signal.h
  46. +0 −2 arch/microblaze/Kconfig
  47. +1 −0 arch/microblaze/include/asm/ptrace.h
  48. +0 −1 arch/microblaze/include/asm/unistd.h
  49. +0 −2 arch/mips/Kconfig
  50. +1 −0 arch/mips/include/asm/ptrace.h
  51. +0 −1 arch/mips/include/asm/unistd.h
  52. +0 −6 arch/mips/include/uapi/asm/signal.h
  53. +0 −2 arch/mn10300/Kconfig
  54. +0 −1 arch/mn10300/include/asm/unistd.h
  55. +0 −6 arch/mn10300/include/uapi/asm/signal.h
  56. +0 −2 arch/openrisc/Kconfig
  57. +0 −1 arch/openrisc/include/uapi/asm/unistd.h
  58. +0 −2 arch/parisc/Kconfig
  59. +0 −1 arch/parisc/include/asm/unistd.h
  60. +0 −6 arch/parisc/include/uapi/asm/signal.h
  61. +0 −2 arch/powerpc/Kconfig
  62. +0 −1 arch/powerpc/include/asm/unistd.h
  63. +0 −6 arch/powerpc/include/uapi/asm/signal.h
  64. +0 −2 arch/s390/Kconfig
  65. +3 −0 arch/s390/include/asm/compat.h
  66. +0 −1 arch/s390/include/asm/unistd.h
  67. +0 −6 arch/s390/include/uapi/asm/signal.h
  68. +0 −2 arch/score/Kconfig
  69. +1 −0 arch/score/include/asm/ptrace.h
  70. +0 −1 arch/score/include/uapi/asm/unistd.h
  71. +0 −2 arch/sh/Kconfig
  72. +0 −1 arch/sh/include/asm/unistd.h
  73. +0 −2 arch/sparc/Kconfig
  74. +0 −1 arch/sparc/include/asm/unistd.h
  75. +0 −6 arch/sparc/include/uapi/asm/signal.h
  76. +0 −2 arch/tile/Kconfig
  77. +1 −0 arch/tile/include/asm/ptrace.h
  78. +0 −1 arch/tile/include/asm/unistd.h
  79. +0 −5 arch/um/kernel/signal.c
  80. +0 −2 arch/unicore32/Kconfig
  81. +1 −0 arch/unicore32/include/asm/ptrace.h
  82. +0 −1 arch/unicore32/include/uapi/asm/unistd.h
  83. +1 −2 arch/x86/Kconfig
  84. +2 −53 arch/x86/ia32/ia32_signal.c
  85. +0 −1 arch/x86/ia32/ia32entry.S
  86. +2 −8 arch/x86/include/asm/ia32.h
  87. +7 −0 arch/x86/include/asm/ptrace.h
  88. +0 −2 arch/x86/include/asm/sys_ia32.h
  89. +0 −3 arch/x86/include/asm/syscalls.h
  90. +0 −1 arch/x86/include/asm/unistd.h
  91. +0 −6 arch/x86/include/uapi/asm/signal.h
  92. +0 −1 arch/x86/kernel/entry_32.S
  93. +0 −3 arch/x86/kernel/entry_64.S
  94. +5 −24 arch/x86/kernel/signal.c
  95. +1 −1 arch/x86/syscalls/syscall_32.tbl
  96. +2 −2 arch/x86/syscalls/syscall_64.tbl
  97. +1 −2 arch/x86/um/Kconfig
  98. +1 −0 arch/x86/um/asm/ptrace.h
  99. +2 −7 arch/x86/um/signal.c
  100. +0 −1 arch/x86/um/sys_call_table_32.c
  101. +0 −1 arch/x86/um/sys_call_table_64.c
  102. +0 −2 arch/xtensa/Kconfig
  103. +2 −0 arch/xtensa/include/asm/ptrace.h
  104. +0 −1 arch/xtensa/include/asm/unistd.h
  105. +0 −6 arch/xtensa/include/uapi/asm/signal.h
  106. +0 −21 fs/exec.c
  107. +0 −4 include/linux/binfmts.h
  108. +62 −0 include/linux/compat.h
  109. +4 −0 include/linux/ptrace.h
  110. +0 −2 include/linux/sched.h
  111. +3 −0 include/linux/signal.h
  112. +6 −9 include/linux/syscalls.h
  113. +0 −6 include/uapi/asm-generic/signal.h
  114. +2 −0 include/uapi/linux/signal.h
  115. +3 −1 init/main.c
  116. +0 −2 kernel/fork.c
  117. +3 −3 kernel/kmod.c
  118. +74 −0 kernel/signal.c
View
@@ -291,12 +291,6 @@ config ARCH_WANT_OLD_COMPAT_IPC
select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
bool
-config GENERIC_KERNEL_THREAD
- bool
-
-config GENERIC_KERNEL_EXECVE
- bool
-
config HAVE_ARCH_SECCOMP_FILTER
bool
help
@@ -362,6 +356,9 @@ config MODULES_USE_ELF_REL
Modules only use ELF REL relocations. Modules with ELF RELA
relocations will give an error.
+config GENERIC_SIGALTSTACK
+ bool
+
#
# ABI hall of shame
#
View
@@ -20,10 +20,9 @@ config ALPHA
select GENERIC_CMOS_UPDATE
select GENERIC_STRNCPY_FROM_USER
select GENERIC_STRNLEN_USER
- select GENERIC_KERNEL_THREAD
- select GENERIC_KERNEL_EXECVE
select HAVE_MOD_ARCH_SPECIFIC
select MODULES_USE_ELF_RELA
+ select GENERIC_SIGALTSTACK
help
The Alpha is a 64-bit general-purpose processor designed and
marketed by the Digital Equipment Corporation of blessed memory,
@@ -8,6 +8,7 @@
#define user_mode(regs) (((regs)->ps & 8) != 0)
#define instruction_pointer(regs) ((regs)->pc)
#define profile_pc(regs) instruction_pointer(regs)
+#define current_user_stack_pointer() rdusp()
#define task_pt_regs(task) \
((struct pt_regs *) (task_stack_page(task) + 2*PAGE_SIZE) - 1)
@@ -15,7 +15,6 @@
#define __ARCH_WANT_SYS_OLDUMOUNT
#define __ARCH_WANT_SYS_SIGPENDING
#define __ARCH_WANT_SYS_RT_SIGSUSPEND
-#define __ARCH_WANT_SYS_EXECVE
#define __ARCH_WANT_SYS_FORK
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE
@@ -84,12 +84,6 @@ typedef unsigned long sigset_t;
#define SA_ONESHOT SA_RESETHAND
#define SA_NOMASK SA_NODEFER
-/*
- * sigaltstack controls
- */
-#define SS_ONSTACK 1
-#define SS_DISABLE 2
-
#define MINSIGSTKSZ 4096
#define SIGSTKSZ 16384
View
@@ -122,12 +122,6 @@ SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask)
return sigsuspend(&blocked);
}
-asmlinkage int
-sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
-{
- return do_sigaltstack(uss, uoss, rdusp());
-}
-
/*
* Do a signal return; undo the signal stack.
*/
@@ -418,9 +412,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
err |= __put_user(0, &frame->uc.uc_flags);
err |= __put_user(0, &frame->uc.uc_link);
err |= __put_user(set->sig[0], &frame->uc.uc_osf_sigmask);
- err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
- err |= __put_user(sas_ss_flags(oldsp), &frame->uc.uc_stack.ss_flags);
- err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
+ err |= __save_altstack(&frame->uc.uc_stack, oldsp);
err |= setup_sigcontext(&frame->uc.uc_mcontext, regs,
set->sig[0], oldsp);
err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
View
@@ -12,8 +12,6 @@ config ARM
select GENERIC_CLOCKEVENTS_BROADCAST if SMP
select GENERIC_IRQ_PROBE
select GENERIC_IRQ_SHOW
- select GENERIC_KERNEL_THREAD
- select GENERIC_KERNEL_EXECVE
select GENERIC_PCI_IOMAP
select GENERIC_SMP_IDLE_THREAD
select GENERIC_STRNCPY_FROM_USER
@@ -41,7 +41,6 @@
#define __ARCH_WANT_OLD_READDIR
#define __ARCH_WANT_SYS_SOCKETCALL
#endif
-#define __ARCH_WANT_SYS_EXECVE
#define __ARCH_WANT_SYS_FORK
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE
@@ -87,13 +87,6 @@ typedef unsigned long sigset_t;
#define SA_NOMASK SA_NODEFER
#define SA_ONESHOT SA_RESETHAND
-
-/*
- * sigaltstack controls
- */
-#define SS_ONSTACK 1
-#define SS_DISABLE 2
-
#define MINSIGSTKSZ 2048
#define SIGSTKSZ 8192
View
@@ -8,8 +8,6 @@ config ARM64
select GENERIC_IOMAP
select GENERIC_IRQ_PROBE
select GENERIC_IRQ_SHOW
- select GENERIC_KERNEL_EXECVE
- select GENERIC_KERNEL_THREAD
select GENERIC_SMP_IDLE_THREAD
select GENERIC_TIME_VSYSCALL
select HARDIRQS_SW_RESEND
@@ -209,10 +209,11 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
return (u32)(unsigned long)uptr;
}
+#define compat_user_stack_pointer() (current_pt_regs()->compat_sp)
+
static inline void __user *arch_compat_alloc_user_space(long len)
{
- struct pt_regs *regs = task_pt_regs(current);
- return (void __user *)regs->compat_sp - len;
+ return (void __user *)compat_user_stack_pointer() - len;
}
struct compat_ipc64_perm {
@@ -28,6 +28,5 @@
#define __ARCH_WANT_SYS_FORK
#define __ARCH_WANT_SYS_VFORK
#endif
-#define __ARCH_WANT_SYS_EXECVE
#define __ARCH_WANT_SYS_CLONE
#include <uapi/asm/unistd.h>
View
@@ -17,8 +17,6 @@ config AVR32
select GENERIC_CLOCKEVENTS
select HAVE_MOD_ARCH_SPECIFIC
select MODULES_USE_ELF_RELA
- select GENERIC_KERNEL_THREAD
- select GENERIC_KERNEL_EXECVE
help
AVR32 is a high-performance 32-bit RISC microprocessor core,
designed for cost-sensitive embedded applications, with particular
@@ -21,6 +21,7 @@
#define user_mode(regs) (((regs)->sr & MODE_MASK) == MODE_USER)
#define instruction_pointer(regs) ((regs)->pc)
#define profile_pc(regs) instruction_pointer(regs)
+#define user_stack_pointer(regs) ((regs)->sp)
static __inline__ int valid_user_regs(struct pt_regs *regs)
{
@@ -39,7 +39,6 @@
#define __ARCH_WANT_SYS_GETPGRP
#define __ARCH_WANT_SYS_RT_SIGACTION
#define __ARCH_WANT_SYS_RT_SIGSUSPEND
-#define __ARCH_WANT_SYS_EXECVE
#define __ARCH_WANT_SYS_FORK
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE
@@ -89,12 +89,6 @@ typedef unsigned long sigset_t;
#define SA_NOMASK SA_NODEFER
#define SA_ONESHOT SA_RESETHAND
-/*
- * sigaltstack controls
- */
-#define SS_ONSTACK 1
-#define SS_DISABLE 2
-
#define MINSIGSTKSZ 2048
#define SIGSTKSZ 8192
View
@@ -45,8 +45,6 @@ config BLACKFIN
select ARCH_USES_GETTIMEOFFSET if !GENERIC_CLOCKEVENTS
select HAVE_MOD_ARCH_SPECIFIC
select MODULES_USE_ELF_RELA
- select GENERIC_KERNEL_THREAD
- select GENERIC_KERNEL_EXECVE
config GENERIC_CSUM
def_bool y
@@ -17,6 +17,7 @@
#define arch_has_single_step() (1)
/* common code demands this function */
#define ptrace_disable(child) user_disable_single_step(child)
+#define current_user_stack_pointer() rdusp()
extern int is_user_addr_valid(struct task_struct *child,
unsigned long start, unsigned long len);
@@ -20,7 +20,6 @@
#define __ARCH_WANT_SYS_NICE
#define __ARCH_WANT_SYS_RT_SIGACTION
#define __ARCH_WANT_SYS_RT_SIGSUSPEND
-#define __ARCH_WANT_SYS_EXECVE
#define __ARCH_WANT_SYS_VFORK
/*
View
@@ -17,8 +17,6 @@ config C6X
select OF
select OF_EARLY_FLATTREE
select GENERIC_CLOCKEVENTS
- select GENERIC_KERNEL_THREAD
- select GENERIC_KERNEL_EXECVE
select MODULES_USE_ELF_RELA
config MMU
@@ -14,7 +14,6 @@
* more details.
*/
-#define __ARCH_WANT_SYS_EXECVE
#define __ARCH_WANT_SYS_CLONE
/* Use the standard ABI for syscalls. */
View
@@ -49,8 +49,6 @@ config CRIS
select GENERIC_SMP_IDLE_THREAD if ETRAX_ARCH_V32
select GENERIC_CMOS_UPDATE
select MODULES_USE_ELF_RELA
- select GENERIC_KERNEL_THREAD
- select GENERIC_KERNEL_EXECVE
select CLONE_BACKWARDS2
config HZ
@@ -9,5 +9,6 @@
#define PTRACE_SETREGS 13
#define profile_pc(regs) instruction_pointer(regs)
+#define current_user_stack_pointer() rdusp()
#endif /* _CRIS_PTRACE_H */
@@ -32,7 +32,6 @@
#define __ARCH_WANT_SYS_SIGPROCMASK
#define __ARCH_WANT_SYS_RT_SIGACTION
#define __ARCH_WANT_SYS_RT_SIGSUSPEND
-#define __ARCH_WANT_SYS_EXECVE
#define __ARCH_WANT_SYS_FORK
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE
@@ -83,12 +83,6 @@ typedef unsigned long sigset_t;
#define SA_RESTORER 0x04000000
-/*
- * sigaltstack controls
- */
-#define SS_ONSTACK 1
-#define SS_DISABLE 2
-
#define MINSIGSTKSZ 2048
#define SIGSTKSZ 8192
View
@@ -12,8 +12,6 @@ config FRV
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select GENERIC_CPU_DEVICES
select ARCH_WANT_IPC_PARSE_VERSION
- select GENERIC_KERNEL_THREAD
- select GENERIC_KERNEL_EXECVE
config ZONE_DMA
bool
@@ -29,7 +29,6 @@
#define __ARCH_WANT_SYS_SIGPROCMASK
#define __ARCH_WANT_SYS_RT_SIGACTION
#define __ARCH_WANT_SYS_RT_SIGSUSPEND
-#define __ARCH_WANT_SYS_EXECVE
#define __ARCH_WANT_SYS_FORK
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE
View
@@ -9,8 +9,6 @@ config H8300
select GENERIC_IRQ_SHOW
select GENERIC_CPU_DEVICES
select MODULES_USE_ELF_RELA
- select GENERIC_KERNEL_THREAD
- select GENERIC_KERNEL_EXECVE
config SYMBOL_PREFIX
string
@@ -28,5 +28,6 @@
#define current_pt_regs() ((struct pt_regs *) \
(THREAD_SIZE + (unsigned long)current_thread_info()) - 1)
#define signal_pt_regs() ((struct pt_regs *)current->thread.esp0)
+#define current_user_stack_pointer() rdusp()
#endif /* __ASSEMBLY__ */
#endif /* _H8300_PTRACE_H */
@@ -31,7 +31,6 @@
#define __ARCH_WANT_SYS_SIGPROCMASK
#define __ARCH_WANT_SYS_RT_SIGACTION
#define __ARCH_WANT_SYS_RT_SIGSUSPEND
-#define __ARCH_WANT_SYS_EXECVE
#define __ARCH_WANT_SYS_FORK
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE
@@ -82,12 +82,6 @@ typedef unsigned long sigset_t;
#define SA_RESTORER 0x04000000
-/*
- * sigaltstack controls
- */
-#define SS_ONSTACK 1
-#define SS_DISABLE 2
-
#define MINSIGSTKSZ 2048
#define SIGSTKSZ 8192
View
@@ -31,8 +31,6 @@ config HEXAGON
select GENERIC_CLOCKEVENTS
select GENERIC_CLOCKEVENTS_BROADCAST
select MODULES_USE_ELF_RELA
- select GENERIC_KERNEL_THREAD
- select GENERIC_KERNEL_EXECVE
---help---
Qualcomm Hexagon is a processor architecture designed for high
performance and low power across a wide variety of applications.
@@ -27,7 +27,6 @@
*/
#define sys_mmap2 sys_mmap_pgoff
-#define __ARCH_WANT_SYS_EXECVE
#define __ARCH_WANT_SYS_CLONE
#include <asm-generic/unistd.h>
View
@@ -42,8 +42,6 @@ config IA64
select GENERIC_TIME_VSYSCALL_OLD
select HAVE_MOD_ARCH_SPECIFIC
select MODULES_USE_ELF_RELA
- select GENERIC_KERNEL_THREAD
- select GENERIC_KERNEL_EXECVE
default y
help
The Itanium Processor Family is Intel's 64-bit successor to
@@ -78,6 +78,11 @@ static inline long regs_return_value(struct pt_regs *regs)
unsigned long __ip = instruction_pointer(regs); \
(__ip & ~3UL) + ((__ip & 3UL) << 2); \
})
+/*
+ * Why not default? Because user_stack_pointer() on ia64 gives register
+ * stack backing store instead...
+ */
+#define current_user_stack_pointer() (current_pt_regs()->r12)
/* given a pointer to a task_struct, return the user's pt_regs */
# define task_pt_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1)
@@ -29,7 +29,6 @@
#define __ARCH_WANT_SYS_RT_SIGACTION
#define __ARCH_WANT_SYS_RT_SIGSUSPEND
-#define __ARCH_WANT_SYS_EXECVE
#if !defined(__ASSEMBLY__) && !defined(ASSEMBLER)
@@ -78,12 +78,6 @@
#define SA_RESTORER 0x04000000
-/*
- * sigaltstack controls
- */
-#define SS_ONSTACK 1
-#define SS_DISABLE 2
-
/*
* The minimum stack size needs to be fairly large because we want to
* be sure that an app compiled for today's CPUs will continue to run
View
@@ -15,8 +15,6 @@ config M32R
select GENERIC_ATOMIC64
select ARCH_USES_GETTIMEOFFSET
select MODULES_USE_ELF_RELA
- select GENERIC_KERNEL_THREAD
- select GENERIC_KERNEL_EXECVE
config SBUS
bool
@@ -32,6 +32,7 @@ extern void init_debug_traps(struct task_struct *);
#define instruction_pointer(regs) ((regs)->bpc)
#define profile_pc(regs) instruction_pointer(regs)
+#define user_stack_pointer(regs) ((regs)->spu)
extern void withdraw_debug_trap(struct pt_regs *regs);
Oops, something went wrong.

0 comments on commit 54d46ea

Please sign in to comment.