Permalink
Browse files

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

…/git/viro/signal

Pull big execve/kernel_thread/fork unification series from Al Viro:
 "All architectures are converted to new model.  Quite a bit of that
  stuff is actually shared with architecture trees; in such cases it's
  literally shared branch pulled by both, not a cherry-pick.

  A lot of ugliness and black magic is gone (-3KLoC total in this one):

   - kernel_thread()/kernel_execve()/sys_execve() redesign.

     We don't do syscalls from kernel anymore for either kernel_thread()
     or kernel_execve():

     kernel_thread() is essentially clone(2) with callback run before we
     return to userland, the callbacks either never return or do
     successful do_execve() before returning.

     kernel_execve() is a wrapper for do_execve() - it doesn't need to
     do transition to user mode anymore.

     As a result kernel_thread() and kernel_execve() are
     arch-independent now - they live in kernel/fork.c and fs/exec.c
     resp.  sys_execve() is also in fs/exec.c and it's completely
     architecture-independent.

   - daemonize() is gone, along with its parts in fs/*.c

   - struct pt_regs * is no longer passed to do_fork/copy_process/
     copy_thread/do_execve/search_binary_handler/->load_binary/do_coredump.

   - sys_fork()/sys_vfork()/sys_clone() unified; some architectures
     still need wrappers (ones with callee-saved registers not saved in
     pt_regs on syscall entry), but the main part of those suckers is in
     kernel/fork.c now."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: (113 commits)
  do_coredump(): get rid of pt_regs argument
  print_fatal_signal(): get rid of pt_regs argument
  ptrace_signal(): get rid of unused arguments
  get rid of ptrace_signal_deliver() arguments
  new helper: signal_pt_regs()
  unify default ptrace_signal_deliver
  flagday: kill pt_regs argument of do_fork()
  death to idle_regs()
  don't pass regs to copy_process()
  flagday: don't pass regs to copy_thread()
  bfin: switch to generic vfork, get rid of pointless wrappers
  xtensa: switch to generic clone()
  openrisc: switch to use of generic fork and clone
  unicore32: switch to generic clone(2)
  score: switch to generic fork/vfork/clone
  c6x: sanitize copy_thread(), get rid of clone(2) wrapper, switch to generic clone()
  take sys_fork/sys_vfork/sys_clone prototypes to linux/syscalls.h
  mn10300: switch to generic fork/vfork/clone
  h8300: switch to generic fork/vfork/clone
  tile: switch to generic clone()
  ...

Conflicts:
	arch/microblaze/include/asm/Kbuild
  • Loading branch information...
2 parents cf4af01 + 541880d commit 9977d9b379cb77e0f67bd6f4563618106e58e11d @torvalds committed Dec 12, 2012
Showing with 1,375 additions and 4,221 deletions.
  1. +14 −0 arch/Kconfig
  2. +1 −0 arch/alpha/include/asm/ptrace.h
  3. +0 −3 arch/alpha/include/asm/signal.h
  4. +3 −0 arch/alpha/include/asm/unistd.h
  5. +2 −2 arch/alpha/kernel/binfmt_loader.c
  6. +12 −39 arch/alpha/kernel/entry.S
  7. +14 −48 arch/alpha/kernel/process.c
  8. +8 −8 arch/alpha/kernel/signal.c
  9. +3 −3 arch/alpha/kernel/systbls.S
  10. +1 −0 arch/arm/Kconfig
  11. +0 −1 arch/arm/include/asm/signal.h
  12. +3 −0 arch/arm/include/asm/unistd.h
  13. +3 −3 arch/arm/kernel/calls.S
  14. +0 −16 arch/arm/kernel/entry-common.S
  15. +6 −5 arch/arm/kernel/process.c
  16. +0 −31 arch/arm/kernel/sys_arm.c
  17. +1 −0 arch/arm64/Kconfig
  18. +0 −6 arch/arm64/include/asm/syscalls.h
  19. +3 −0 arch/arm64/include/asm/unistd.h
  20. +2 −2 arch/arm64/include/asm/unistd32.h
  21. +4 −5 arch/arm64/kernel/process.c
  22. +0 −11 arch/arm64/kernel/sys.c
  23. +0 −11 arch/arm64/kernel/sys_compat.c
  24. +2 −0 arch/avr32/Kconfig
  25. +0 −3 arch/avr32/include/asm/processor.h
  26. +0 −2 arch/avr32/include/asm/signal.h
  27. +4 −0 arch/avr32/include/asm/unistd.h
  28. +1 −1 arch/avr32/kernel/Makefile
  29. +8 −6 arch/avr32/kernel/entry-avr32b.S
  30. +20 −95 arch/avr32/kernel/process.c
  31. +0 −24 arch/avr32/kernel/sys_avr32.c
  32. +0 −24 arch/avr32/kernel/syscall-stubs.S
  33. +4 −4 arch/avr32/kernel/syscall_table.S
  34. +2 −0 arch/blackfin/Kconfig
  35. +0 −2 arch/blackfin/include/asm/processor.h
  36. +2 −0 arch/blackfin/include/asm/unistd.h
  37. +8 −47 arch/blackfin/kernel/entry.S
  38. +21 −77 arch/blackfin/kernel/process.c
  39. +2 −2 arch/blackfin/kernel/signal.c
  40. +1 −56 arch/blackfin/mach-common/entry.S
  41. +1 −0 arch/c6x/Kconfig
  42. +0 −4 arch/c6x/include/asm/syscalls.h
  43. +1 −1 arch/c6x/include/uapi/asm/unistd.h
  44. +1 −23 arch/c6x/kernel/entry.S
  45. +5 −20 arch/c6x/kernel/process.c
  46. +3 −0 arch/cris/Kconfig
  47. +9 −8 arch/cris/arch-v10/kernel/entry.S
  48. +19 −102 arch/cris/arch-v10/kernel/process.c
  49. +13 −9 arch/cris/arch-v32/kernel/entry.S
  50. +19 −99 arch/cris/arch-v32/kernel/process.c
  51. +0 −2 arch/cris/include/asm/processor.h
  52. +0 −6 arch/cris/include/asm/signal.h
  53. +4 −0 arch/cris/include/asm/unistd.h
  54. +0 −1 arch/cris/kernel/crisksyms.c
  55. +3 −0 arch/frv/include/asm/unistd.h
  56. +5 −40 arch/frv/kernel/process.c
  57. +2 −0 arch/h8300/Kconfig
  58. +0 −2 arch/h8300/include/asm/processor.h
  59. +3 −0 arch/h8300/include/asm/ptrace.h
  60. +0 −2 arch/h8300/include/asm/signal.h
  61. +4 −0 arch/h8300/include/asm/unistd.h
  62. +9 −0 arch/h8300/kernel/entry.S
  63. +0 −1 arch/h8300/kernel/h8300_ksyms.c
  64. +11 −89 arch/h8300/kernel/process.c
  65. +0 −26 arch/h8300/kernel/sys_h8300.c
  66. +0 −9 arch/h8300/kernel/syscalls.S
  67. +2 −0 arch/hexagon/Kconfig
  68. +0 −1 arch/hexagon/include/asm/processor.h
  69. +0 −8 arch/hexagon/include/asm/syscall.h
  70. +4 −0 arch/hexagon/include/uapi/asm/ptrace.h
  71. +2 −0 arch/hexagon/include/uapi/asm/unistd.h
  72. +1 −2 arch/hexagon/kernel/Makefile
  73. +31 −69 arch/hexagon/kernel/process.c
  74. +2 −2 arch/hexagon/kernel/signal.c
  75. +0 −89 arch/hexagon/kernel/syscall.c
  76. +4 −0 arch/hexagon/kernel/vm_entry.S
  77. +2 −0 arch/ia64/Kconfig
  78. +0 −16 arch/ia64/include/asm/processor.h
  79. +0 −2 arch/ia64/include/asm/signal.h
  80. +1 −0 arch/ia64/include/asm/unistd.h
  81. +29 −24 arch/ia64/kernel/entry.S
  82. +0 −13 arch/ia64/kernel/head.S
  83. +60 −101 arch/ia64/kernel/process.c
  84. +0 −5 arch/ia64/kernel/smpboot.c
  85. +2 −0 arch/m32r/Kconfig
  86. +0 −5 arch/m32r/include/asm/processor.h
  87. +2 −0 arch/m32r/include/asm/ptrace.h
  88. +0 −4 arch/m32r/include/asm/signal.h
  89. +4 −0 arch/m32r/include/asm/unistd.h
  90. +9 −0 arch/m32r/kernel/entry.S
  91. +0 −1 arch/m32r/kernel/m32r_ksyms.c
  92. +17 −109 arch/m32r/kernel/process.c
  93. +0 −21 arch/m32r/kernel/sys_m32r.c
  94. +1 −0 arch/m68k/Kconfig
  95. +3 −5 arch/m68k/include/asm/signal.h
  96. +2 −1 arch/m68k/include/asm/unistd.h
  97. +9 −21 arch/m68k/kernel/entry.S
  98. +32 −55 arch/m68k/kernel/process.c
  99. +2 −1 arch/m68k/kernel/signal.c
  100. +3 −3 arch/m68k/kernel/syscalltable.S
  101. +3 −0 arch/microblaze/Kconfig
  102. +1 −0 arch/microblaze/include/asm/Kbuild
  103. +1 −7 arch/microblaze/include/asm/processor.h
  104. +0 −16 arch/microblaze/include/asm/syscalls.h
  105. +6 −0 arch/microblaze/include/asm/unistd.h
  106. +8 −12 arch/microblaze/kernel/entry-nommu.S
  107. +9 −48 arch/microblaze/kernel/entry.S
  108. +23 −52 arch/microblaze/kernel/process.c
  109. +0 −53 arch/microblaze/kernel/sys_microblaze.c
  110. +1 −5 arch/microblaze/kernel/syscall_table.S
  111. +2 −0 arch/mips/Kconfig
  112. +0 −2 arch/mips/include/asm/processor.h
  113. +6 −0 arch/mips/include/asm/ptrace.h
  114. +0 −2 arch/mips/include/asm/signal.h
  115. +1 −0 arch/mips/include/asm/unistd.h
  116. +6 −0 arch/mips/kernel/entry.S
  117. +1 −22 arch/mips/kernel/linux32.c
  118. +0 −2 arch/mips/kernel/mips_ksyms.c
  119. +23 −41 arch/mips/kernel/process.c
  120. +1 −1 arch/mips/kernel/scall64-n32.S
  121. +1 −1 arch/mips/kernel/scall64-o32.S
  122. +2 −55 arch/mips/kernel/syscall.c
  123. +1 −0 arch/mn10300/Kconfig
  124. +0 −4 arch/mn10300/include/asm/signal.h
  125. +3 −1 arch/mn10300/include/asm/unistd.h
  126. +1 −6 arch/mn10300/kernel/entry.S
  127. +5 −28 arch/mn10300/kernel/process.c
  128. +2 −0 arch/openrisc/Kconfig
  129. +0 −2 arch/openrisc/include/asm/processor.h
  130. +7 −0 arch/openrisc/include/asm/syscalls.h
  131. +4 −0 arch/openrisc/include/uapi/asm/unistd.h
  132. +1 −1 arch/openrisc/kernel/Makefile
  133. +23 −32 arch/openrisc/kernel/entry.S
  134. +57 −107 arch/openrisc/kernel/process.c
  135. +0 −57 arch/openrisc/kernel/sys_or32.c
  136. +3 −0 arch/parisc/Kconfig
  137. +0 −1 arch/parisc/include/asm/processor.h
  138. +0 −2 arch/parisc/include/asm/signal.h
  139. +4 −0 arch/parisc/include/asm/unistd.h
  140. +21 −220 arch/parisc/kernel/entry.S
  141. +23 −119 arch/parisc/kernel/process.c
  142. +0 −22 arch/parisc/kernel/sys_parisc32.c
  143. +1 −1 arch/parisc/kernel/syscall_table.S
  144. +2 −0 arch/powerpc/Kconfig
  145. +0 −2 arch/powerpc/include/asm/signal.h
  146. +0 −9 arch/powerpc/include/asm/syscalls.h
  147. +3 −1 arch/powerpc/include/asm/unistd.h
  148. +0 −5 arch/powerpc/kernel/entry_32.S
  149. +1 −7 arch/powerpc/kernel/entry_64.S
  150. +9 −55 arch/powerpc/kernel/process.c
  151. +2 −0 arch/s390/Kconfig
  152. +0 −2 arch/s390/include/asm/signal.h
  153. +3 −1 arch/s390/include/asm/unistd.h
  154. +5 −27 arch/s390/kernel/entry.S
  155. +0 −4 arch/s390/kernel/entry.h
  156. +5 −21 arch/s390/kernel/entry64.S
  157. +10 −43 arch/s390/kernel/process.c
  158. +3 −0 arch/score/Kconfig
  159. +0 −1 arch/score/include/asm/processor.h
  160. +0 −2 arch/score/include/asm/syscalls.h
  161. +4 −0 arch/score/include/asm/unistd.h
  162. +7 −23 arch/score/kernel/entry.S
  163. +15 −42 arch/score/kernel/process.c
  164. +0 −89 arch/score/kernel/sys_score.c
  165. +2 −0 arch/sh/Kconfig
  166. +0 −5 arch/sh/include/asm/processor_32.h
  167. +0 −5 arch/sh/include/asm/processor_64.h
  168. +0 −14 arch/sh/include/asm/syscalls_32.h
  169. +0 −17 arch/sh/include/asm/syscalls_64.h
  170. +4 −0 arch/sh/include/asm/unistd.h
  171. +2 −1 arch/sh/kernel/Makefile
  172. +19 −0 arch/sh/kernel/cpu/sh5/entry.S
  173. +13 −0 arch/sh/kernel/entry-common.S
  174. +20 −114 arch/sh/kernel/process_32.c
  175. +19 −108 arch/sh/kernel/process_64.c
  176. +0 −24 arch/sh/kernel/sys_sh32.c
  177. +0 −50 arch/sh/kernel/sys_sh64.c
  178. +2 −0 arch/sparc/Kconfig
  179. +0 −1 arch/sparc/include/asm/processor_32.h
  180. +9 −2 arch/sparc/include/asm/processor_64.h
  181. +7 −3 arch/sparc/include/asm/ptrace.h
  182. +0 −2 arch/sparc/include/asm/signal.h
  183. +1 −1 arch/sparc/include/asm/switch_to_64.h
  184. +0 −2 arch/sparc/include/asm/syscalls.h
  185. +12 −13 arch/sparc/include/asm/thread_info_64.h
  186. +2 −2 arch/sparc/include/asm/uaccess_64.h
  187. +1 −0 arch/sparc/include/asm/unistd.h
  188. +22 −29 arch/sparc/kernel/entry.S
  189. +6 −2 arch/sparc/kernel/etrap_64.S
  190. +47 −111 arch/sparc/kernel/process_32.c
  191. +32 −116 arch/sparc/kernel/process_64.c
  192. +0 −36 arch/sparc/kernel/sys_sparc32.c
  193. +0 −24 arch/sparc/kernel/sys_sparc_32.c
  194. +0 −22 arch/sparc/kernel/sys_sparc_64.c
  195. +15 −15 arch/sparc/kernel/syscalls.S
  196. +1 −1 arch/sparc/kernel/systbls_64.S
  197. +2 −2 arch/sparc/kernel/traps_64.c
  198. +1 −1 arch/sparc/mm/init_64.c
  199. +2 −0 arch/tile/Kconfig
  200. +3 −12 arch/tile/include/asm/compat.h
  201. +1 −0 arch/tile/include/asm/elf.h
  202. +4 −2 arch/tile/include/asm/processor.h
  203. +4 −1 arch/tile/include/asm/switch_to.h
  204. +7 −6 arch/tile/include/asm/syscalls.h
  205. +2 −0 arch/tile/include/asm/unistd.h
  206. +1 −3 arch/tile/kernel/compat.c
  207. +5 −5 arch/tile/kernel/compat_signal.c
  208. +0 −11 arch/tile/kernel/entry.S
  209. +16 −13 arch/tile/kernel/intvec_32.S
  210. +16 −14 arch/tile/kernel/intvec_64.S
  211. +45 −126 arch/tile/kernel/process.c
  212. +5 −4 arch/tile/kernel/signal.c
  213. +2 −6 arch/tile/kernel/sys.c
  214. +3 −2 arch/tile/mm/fault.c
  215. +2 −3 arch/um/kernel/process.c
  216. +0 −23 arch/um/kernel/syscall.c
  217. +1 −0 arch/unicore32/include/uapi/asm/unistd.h
  218. +0 −6 arch/unicore32/kernel/entry.S
  219. +6 −5 arch/unicore32/kernel/process.c
  220. +0 −14 arch/unicore32/kernel/sys.c
  221. +1 −0 arch/x86/Kconfig
  222. +3 −2 arch/x86/ia32/ia32_aout.c
  223. +6 −1 arch/x86/ia32/ia32entry.S
  224. +0 −11 arch/x86/ia32/sys_ia32.c
  225. +0 −2 arch/x86/include/asm/processor.h
  226. +0 −2 arch/x86/include/asm/signal.h
  227. +0 −2 arch/x86/include/asm/sys_ia32.h
  228. +0 −9 arch/x86/include/asm/syscalls.h
  229. +3 −0 arch/x86/include/asm/unistd.h
  230. +0 −9 arch/x86/kernel/cpu/common.c
  231. +0 −18 arch/x86/kernel/entry_32.S
  232. +19 −3 arch/x86/kernel/entry_64.S
  233. +0 −30 arch/x86/kernel/process.c
  234. +6 −6 arch/x86/kernel/process_32.c
  235. +5 −5 arch/x86/kernel/process_64.c
  236. +3 −3 arch/x86/syscalls/syscall_32.tbl
  237. +1 −0 arch/x86/um/Kconfig
  238. +0 −2 arch/x86/um/shared/sysdep/syscalls.h
  239. +0 −3 arch/x86/um/sys_call_table_32.c
  240. +0 −15 arch/x86/um/syscalls_32.c
  241. +1 −0 arch/xtensa/Kconfig
  242. +0 −1 arch/xtensa/include/asm/signal.h
  243. +0 −2 arch/xtensa/include/asm/syscall.h
  244. +1 −0 arch/xtensa/include/asm/unistd.h
  245. +1 −1 arch/xtensa/include/uapi/asm/unistd.h
  246. +1 −11 arch/xtensa/kernel/process.c
  247. +1 −3 drivers/staging/gdm72xx/gdm_usb.c
  248. +3 −2 fs/binfmt_aout.c
  249. +3 −2 fs/binfmt_elf.c
  250. +3 −3 fs/binfmt_elf_fdpic.c
  251. +2 −2 fs/binfmt_em86.c
  252. +3 −2 fs/binfmt_flat.c
  253. +2 −2 fs/binfmt_misc.c
  254. +2 −2 fs/binfmt_script.c
  255. +3 −2 fs/binfmt_som.c
  256. +2 −2 fs/coredump.c
  257. +15 −22 fs/exec.c
  258. +0 −6 fs/file.c
  259. +0 −24 fs/fs_struct.c
  260. +0 −2 include/asm-generic/signal.h
  261. +0 −20 include/asm-generic/syscalls.h
  262. +2 −2 include/linux/binfmts.h
  263. +0 −4 include/linux/compat.h
  264. +2 −2 include/linux/coredump.h
  265. +0 −1 include/linux/fdtable.h
  266. +0 −1 include/linux/fs_struct.h
  267. +13 −0 include/linux/ptrace.h
  268. +3 −4 include/linux/sched.h
  269. +14 −2 include/linux/syscalls.h
  270. +21 −81 kernel/auditsc.c
  271. +0 −92 kernel/exit.c
  272. +48 −16 kernel/fork.c
  273. +7 −8 kernel/signal.c
View
@@ -342,4 +342,18 @@ config MODULES_USE_ELF_REL
Modules only use ELF REL relocations. Modules with ELF RELA
relocations will give an error.
+#
+# ABI hall of shame
+#
+config CLONE_BACKWARDS
+ bool
+ help
+ Architecture has tls passed as the 4th argument of clone(2),
+ not the 5th one.
+
+config CLONE_BACKWARDS2
+ bool
+ help
+ Architecture has the first two arguments of clone(2) swapped.
+
source "kernel/gcov/Kconfig"
@@ -78,6 +78,7 @@ struct switch_stack {
#define current_pt_regs() \
((struct pt_regs *) ((char *)current_thread_info() + 2*PAGE_SIZE) - 1)
+#define signal_pt_regs current_pt_regs
#define force_successful_syscall_return() (current_pt_regs()->r0 = 0)
@@ -164,9 +164,6 @@ struct sigstack {
#ifdef __KERNEL__
#include <asm/sigcontext.h>
-
-#define ptrace_signal_deliver(regs, cookie) do { } while (0)
-
#endif
#endif
@@ -482,6 +482,9 @@
#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
/* "Conditional" syscalls. What we want is
@@ -5,7 +5,7 @@
#include <linux/binfmts.h>
#include <linux/a.out.h>
-static int load_binary(struct linux_binprm *bprm, struct pt_regs *regs)
+static int load_binary(struct linux_binprm *bprm)
{
struct exec *eh = (struct exec *)bprm->buf;
unsigned long loader;
@@ -37,7 +37,7 @@ static int load_binary(struct linux_binprm *bprm, struct pt_regs *regs)
retval = prepare_binprm(bprm);
if (retval < 0)
return retval;
- return search_binary_handler(bprm,regs);
+ return search_binary_handler(bprm);
}
static struct linux_binfmt loader_format = {
View
@@ -612,47 +612,24 @@ ret_from_kernel_thread:
* Special system calls. Most of these are special in that they either
* have to play switch_stack games or in some way use the pt_regs struct.
*/
- .align 4
- .globl sys_fork
- .ent sys_fork
-sys_fork:
- .prologue 0
- mov $sp, $21
- bsr $1, do_switch_stack
- bis $31, SIGCHLD, $16
- mov $31, $17
- mov $31, $18
- mov $31, $19
- mov $31, $20
- jsr $26, alpha_clone
- bsr $1, undo_switch_stack
- ret
-.end sys_fork
+.macro fork_like name
.align 4
- .globl sys_clone
- .ent sys_clone
-sys_clone:
+ .globl alpha_\name
+ .ent alpha_\name
+alpha_\name:
.prologue 0
- mov $sp, $21
bsr $1, do_switch_stack
- /* $16, $17, $18, $19, $20 come from the user. */
- jsr $26, alpha_clone
- bsr $1, undo_switch_stack
+ jsr $26, sys_\name
+ ldq $26, 56($sp)
+ lda $sp, SWITCH_STACK_SIZE($sp)
ret
-.end sys_clone
+.end alpha_\name
+.endm
- .align 4
- .globl sys_vfork
- .ent sys_vfork
-sys_vfork:
- .prologue 0
- mov $sp, $16
- bsr $1, do_switch_stack
- jsr $26, alpha_vfork
- bsr $1, undo_switch_stack
- ret
-.end sys_vfork
+fork_like fork
+fork_like vfork
+fork_like clone
.align 4
.globl sys_sigreturn
@@ -661,8 +638,6 @@ sys_sigreturn:
.prologue 0
lda $9, ret_from_straced
cmpult $26, $9, $9
- mov $sp, $17
- lda $18, -SWITCH_STACK_SIZE($sp)
lda $sp, -SWITCH_STACK_SIZE($sp)
jsr $26, do_sigreturn
bne $9, 1f
@@ -678,8 +653,6 @@ sys_rt_sigreturn:
.prologue 0
lda $9, ret_from_straced
cmpult $26, $9, $9
- mov $sp, $17
- lda $18, -SWITCH_STACK_SIZE($sp)
lda $sp, -SWITCH_STACK_SIZE($sp)
jsr $26, do_rt_sigreturn
bne $9, 1f
@@ -235,51 +235,28 @@ release_thread(struct task_struct *dead_task)
}
/*
- * "alpha_clone()".. By the time we get here, the
- * non-volatile registers have also been saved on the
- * stack. We do some ugly pointer stuff here.. (see
- * also copy_thread)
- *
- * Notice that "fork()" is implemented in terms of clone,
- * with parameters (SIGCHLD, 0).
- */
-int
-alpha_clone(unsigned long clone_flags, unsigned long usp,
- int __user *parent_tid, int __user *child_tid,
- unsigned long tls_value, struct pt_regs *regs)
-{
- if (!usp)
- usp = rdusp();
-
- return do_fork(clone_flags, usp, regs, 0, parent_tid, child_tid);
-}
-
-int
-alpha_vfork(struct pt_regs *regs)
-{
- return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(),
- regs, 0, NULL, NULL);
-}
-
-/*
* Copy an alpha thread..
*/
int
copy_thread(unsigned long clone_flags, unsigned long usp,
unsigned long arg,
- struct task_struct * p, struct pt_regs * regs)
+ struct task_struct *p)
{
extern void ret_from_fork(void);
extern void ret_from_kernel_thread(void);
struct thread_info *childti = task_thread_info(p);
struct pt_regs *childregs = task_pt_regs(p);
+ struct pt_regs *regs = current_pt_regs();
struct switch_stack *childstack, *stack;
unsigned long settls;
childstack = ((struct switch_stack *) childregs) - 1;
- if (unlikely(!regs)) {
+ childti->pcb.ksp = (unsigned long) childstack;
+ childti->pcb.flags = 1; /* set FEN, clear everything else */
+
+ if (unlikely(p->flags & PF_KTHREAD)) {
/* kernel thread */
memset(childstack, 0,
sizeof(struct switch_stack) + sizeof(struct pt_regs));
@@ -288,35 +265,24 @@ copy_thread(unsigned long clone_flags, unsigned long usp,
childstack->r10 = arg;
childregs->hae = alpha_mv.hae_cache,
childti->pcb.usp = 0;
- childti->pcb.ksp = (unsigned long) childstack;
- childti->pcb.flags = 1; /* set FEN, clear everything else */
return 0;
}
+ /* Note: if CLONE_SETTLS is not set, then we must inherit the
+ value from the parent, which will have been set by the block
+ copy in dup_task_struct. This is non-intuitive, but is
+ required for proper operation in the case of a threaded
+ application calling fork. */
+ if (clone_flags & CLONE_SETTLS)
+ childti->pcb.unique = regs->r20;
+ childti->pcb.usp = usp ?: rdusp();
*childregs = *regs;
- settls = regs->r20;
childregs->r0 = 0;
childregs->r19 = 0;
childregs->r20 = 1; /* OSF/1 has some strange fork() semantics. */
regs->r20 = 0;
stack = ((struct switch_stack *) regs) - 1;
*childstack = *stack;
childstack->r26 = (unsigned long) ret_from_fork;
- childti->pcb.usp = usp;
- childti->pcb.ksp = (unsigned long) childstack;
- childti->pcb.flags = 1; /* set FEN, clear everything else */
-
- /* Set a new TLS for the child thread? Peek back into the
- syscall arguments that we saved on syscall entry. Oops,
- except we'd have clobbered it with the parent/child set
- of r20. Read the saved copy. */
- /* Note: if CLONE_SETTLS is not set, then we must inherit the
- value from the parent, which will have been set by the block
- copy in dup_task_struct. This is non-intuitive, but is
- required for proper operation in the case of a threaded
- application calling fork. */
- if (clone_flags & CLONE_SETTLS)
- childti->pcb.unique = settls;
-
return 0;
}
View
@@ -160,10 +160,10 @@ extern char compile_time_assert
#define INSN_CALLSYS 0x00000083
static long
-restore_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
- struct switch_stack *sw)
+restore_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs)
{
unsigned long usp;
+ struct switch_stack *sw = (struct switch_stack *)regs - 1;
long i, err = __get_user(regs->pc, &sc->sc_pc);
current_thread_info()->restart_block.fn = do_no_restart_syscall;
@@ -215,9 +215,9 @@ restore_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
registers and transfer control from userland. */
asmlinkage void
-do_sigreturn(struct sigcontext __user *sc, struct pt_regs *regs,
- struct switch_stack *sw)
+do_sigreturn(struct sigcontext __user *sc)
{
+ struct pt_regs *regs = current_pt_regs();
sigset_t set;
/* Verify that it's a good sigcontext before using it */
@@ -228,7 +228,7 @@ do_sigreturn(struct sigcontext __user *sc, struct pt_regs *regs,
set_current_blocked(&set);
- if (restore_sigcontext(sc, regs, sw))
+ if (restore_sigcontext(sc, regs))
goto give_sigsegv;
/* Send SIGTRAP if we're single-stepping: */
@@ -249,9 +249,9 @@ do_sigreturn(struct sigcontext __user *sc, struct pt_regs *regs,
}
asmlinkage void
-do_rt_sigreturn(struct rt_sigframe __user *frame, struct pt_regs *regs,
- struct switch_stack *sw)
+do_rt_sigreturn(struct rt_sigframe __user *frame)
{
+ struct pt_regs *regs = current_pt_regs();
sigset_t set;
/* Verify that it's a good ucontext_t before using it */
@@ -262,7 +262,7 @@ do_rt_sigreturn(struct rt_sigframe __user *frame, struct pt_regs *regs,
set_current_blocked(&set);
- if (restore_sigcontext(&frame->uc.uc_mcontext, regs, sw))
+ if (restore_sigcontext(&frame->uc.uc_mcontext, regs))
goto give_sigsegv;
/* Send SIGTRAP if we're single-stepping: */
@@ -12,7 +12,7 @@
sys_call_table:
.quad alpha_ni_syscall /* 0 */
.quad sys_exit
- .quad sys_fork
+ .quad alpha_fork
.quad sys_read
.quad sys_write
.quad alpha_ni_syscall /* 5 */
@@ -76,7 +76,7 @@ sys_call_table:
.quad sys_getpgrp
.quad sys_getpagesize
.quad alpha_ni_syscall /* 65 */
- .quad sys_vfork
+ .quad alpha_vfork
.quad sys_newstat
.quad sys_newlstat
.quad alpha_ni_syscall
@@ -330,7 +330,7 @@ sys_call_table:
.quad sys_ni_syscall /* 309: old get_kernel_syms */
.quad sys_syslog /* 310 */
.quad sys_reboot
- .quad sys_clone
+ .quad alpha_clone
.quad sys_uselib
.quad sys_mlock
.quad sys_munlock /* 315 */
View
@@ -57,6 +57,7 @@ config ARM
select SYS_SUPPORTS_APM_EMULATION
select HAVE_MOD_ARCH_SPECIFIC if ARM_UNWIND
select MODULES_USE_ELF_REL
+ select CLONE_BACKWARDS
help
The ARM series is a line of low-power-consumption RISC chip designs
licensed by ARM Ltd and targeted at embedded applications and
@@ -35,5 +35,4 @@ struct k_sigaction {
};
#include <asm/sigcontext.h>
-#define ptrace_signal_deliver(regs, cookie) do { } while (0)
#endif
@@ -42,6 +42,9 @@
#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
/*
* "Conditional" syscalls
View
@@ -11,7 +11,7 @@
*/
/* 0 */ CALL(sys_restart_syscall)
CALL(sys_exit)
- CALL(sys_fork_wrapper)
+ CALL(sys_fork)
CALL(sys_read)
CALL(sys_write)
/* 5 */ CALL(sys_open)
@@ -129,7 +129,7 @@
CALL(OBSOLETE(ABI(sys_ipc, sys_oabi_ipc)))
CALL(sys_fsync)
CALL(sys_sigreturn_wrapper)
-/* 120 */ CALL(sys_clone_wrapper)
+/* 120 */ CALL(sys_clone)
CALL(sys_setdomainname)
CALL(sys_newuname)
CALL(sys_ni_syscall) /* modify_ldt */
@@ -199,7 +199,7 @@
CALL(sys_sendfile)
CALL(sys_ni_syscall) /* getpmsg */
CALL(sys_ni_syscall) /* putpmsg */
-/* 190 */ CALL(sys_vfork_wrapper)
+/* 190 */ CALL(sys_vfork)
CALL(sys_getrlimit)
CALL(sys_mmap2)
CALL(ABI(sys_truncate64, sys_oabi_truncate64))
Oops, something went wrong.

0 comments on commit 9977d9b

Please sign in to comment.