aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-12 21:05:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-12 21:05:52 -0400
commit4e21fc138bfd7fe625ff5dc81541399aaf9d429b (patch)
tree43bedf14d2eee7711b8241dcfd6bd7b8737d9bd5
parent8418263e3547ed3816475e4c55a77004f0426ee6 (diff)
parent5522be6a4624a5f505555569e4d9cee946630686 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull third pile of kernel_execve() patches from Al Viro: "The last bits of infrastructure for kernel_thread() et.al., with alpha/arm/x86 use of those. Plus sanitizing the asm glue and do_notify_resume() on alpha, fixing the "disabled irq while running task_work stuff" breakage there. At that point the rest of kernel_thread/kernel_execve/sys_execve work can be done independently for different architectures. The only pending bits that do depend on having all architectures converted are restrictred to fs/* and kernel/* - that'll obviously have to wait for the next cycle. I thought we'd have to wait for all of them done before we start eliminating the longjump-style insanity in kernel_execve(), but it turned out there's a very simple way to do that without flagday-style changes." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: alpha: switch to saner kernel_execve() semantics arm: switch to saner kernel_execve() semantics x86, um: convert to saner kernel_execve() semantics infrastructure for saner ret_from_kernel_thread semantics make sure that kernel_thread() callbacks call do_exit() themselves make sure that we always have a return path from kernel_execve() ppc: eeh_event should just use kthread_run() don't bother with kernel_thread/kernel_execve for launching linuxrc alpha: get rid of switch_stack argument of do_work_pending() alpha: don't bother passing switch_stack separately from regs alpha: take SIGPENDING/NOTIFY_RESUME loop into signal.c alpha: simplify TIF_NEED_RESCHED handling
-rw-r--r--arch/Kconfig3
-rw-r--r--arch/alpha/Kconfig1
-rw-r--r--arch/alpha/include/asm/unistd.h1
-rw-r--r--arch/alpha/kernel/entry.S87
-rw-r--r--arch/alpha/kernel/signal.c48
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/include/asm/unistd.h1
-rw-r--r--arch/arm/kernel/entry-common.S29
-rw-r--r--arch/arm/kernel/process.c5
-rw-r--r--arch/powerpc/platforms/pseries/eeh_event.c5
-rw-r--r--arch/um/include/asm/processor-generic.h2
-rw-r--r--arch/um/include/shared/os.h1
-rw-r--r--arch/um/kernel/exec.c5
-rw-r--r--arch/um/kernel/process.c10
-rw-r--r--arch/um/os-Linux/process.c13
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--arch/x86/include/asm/unistd.h1
-rw-r--r--arch/x86/kernel/entry_32.S31
-rw-r--r--arch/x86/kernel/entry_64.S24
-rw-r--r--arch/x86/um/Kconfig1
-rw-r--r--include/linux/syscalls.h8
-rw-r--r--init/do_mounts_initrd.c41
-rw-r--r--init/main.c33
-rw-r--r--kernel/kmod.c7
-rw-r--r--kernel/kthread.c1
25 files changed, 137 insertions, 223 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index 26a28419cafc..a79a1ad8bb96 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -274,6 +274,9 @@ config ARCH_WANT_OLD_COMPAT_IPC
274config GENERIC_KERNEL_THREAD 274config GENERIC_KERNEL_THREAD
275 bool 275 bool
276 276
277config GENERIC_KERNEL_EXECVE
278 bool
279
277config HAVE_ARCH_SECCOMP_FILTER 280config HAVE_ARCH_SECCOMP_FILTER
278 bool 281 bool
279 help 282 help
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 7da91246e279..7a08cfb80ee8 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -21,6 +21,7 @@ config ALPHA
21 select GENERIC_STRNCPY_FROM_USER 21 select GENERIC_STRNCPY_FROM_USER
22 select GENERIC_STRNLEN_USER 22 select GENERIC_STRNLEN_USER
23 select GENERIC_KERNEL_THREAD 23 select GENERIC_KERNEL_THREAD
24 select GENERIC_KERNEL_EXECVE
24 help 25 help
25 The Alpha is a 64-bit general-purpose processor designed and 26 The Alpha is a 64-bit general-purpose processor designed and
26 marketed by the Digital Equipment Corporation of blessed memory, 27 marketed by the Digital Equipment Corporation of blessed memory,
diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h
index 3cb6c1188984..7826e227e4d0 100644
--- a/arch/alpha/include/asm/unistd.h
+++ b/arch/alpha/include/asm/unistd.h
@@ -482,7 +482,6 @@
482#define __ARCH_WANT_SYS_SIGPENDING 482#define __ARCH_WANT_SYS_SIGPENDING
483#define __ARCH_WANT_SYS_RT_SIGSUSPEND 483#define __ARCH_WANT_SYS_RT_SIGSUSPEND
484#define __ARCH_WANT_SYS_EXECVE 484#define __ARCH_WANT_SYS_EXECVE
485#define __ARCH_WANT_KERNEL_EXECVE
486 485
487/* "Conditional" syscalls. What we want is 486/* "Conditional" syscalls. What we want is
488 487
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
index 2a359c9ee3cd..a7607832dd4f 100644
--- a/arch/alpha/kernel/entry.S
+++ b/arch/alpha/kernel/entry.S
@@ -311,7 +311,7 @@ entSys:
311 311
312 .align 4 312 .align 4
313ret_from_sys_call: 313ret_from_sys_call:
314 cmovne $26, 0, $19 /* $19 = 0 => non-restartable */ 314 cmovne $26, 0, $18 /* $18 = 0 => non-restartable */
315 ldq $0, SP_OFF($sp) 315 ldq $0, SP_OFF($sp)
316 and $0, 8, $0 316 and $0, 8, $0
317 beq $0, ret_to_kernel 317 beq $0, ret_to_kernel
@@ -320,8 +320,8 @@ ret_to_user:
320 sampling and the rti. */ 320 sampling and the rti. */
321 lda $16, 7 321 lda $16, 7
322 call_pal PAL_swpipl 322 call_pal PAL_swpipl
323 ldl $5, TI_FLAGS($8) 323 ldl $17, TI_FLAGS($8)
324 and $5, _TIF_WORK_MASK, $2 324 and $17, _TIF_WORK_MASK, $2
325 bne $2, work_pending 325 bne $2, work_pending
326restore_all: 326restore_all:
327 RESTORE_ALL 327 RESTORE_ALL
@@ -341,10 +341,10 @@ $syscall_error:
341 * frame to indicate that a negative return value wasn't an 341 * frame to indicate that a negative return value wasn't an
342 * error number.. 342 * error number..
343 */ 343 */
344 ldq $19, 0($sp) /* old syscall nr (zero if success) */ 344 ldq $18, 0($sp) /* old syscall nr (zero if success) */
345 beq $19, $ret_success 345 beq $18, $ret_success
346 346
347 ldq $20, 72($sp) /* .. and this a3 */ 347 ldq $19, 72($sp) /* .. and this a3 */
348 subq $31, $0, $0 /* with error in v0 */ 348 subq $31, $0, $0 /* with error in v0 */
349 addq $31, 1, $1 /* set a3 for errno return */ 349 addq $31, 1, $1 /* set a3 for errno return */
350 stq $0, 0($sp) 350 stq $0, 0($sp)
@@ -362,51 +362,35 @@ $ret_success:
362 * Do all cleanup when returning from all interrupts and system calls. 362 * Do all cleanup when returning from all interrupts and system calls.
363 * 363 *
364 * Arguments: 364 * Arguments:
365 * $5: TI_FLAGS.
366 * $8: current. 365 * $8: current.
367 * $19: The old syscall number, or zero if this is not a return 366 * $17: TI_FLAGS.
367 * $18: The old syscall number, or zero if this is not a return
368 * from a syscall that errored and is possibly restartable. 368 * from a syscall that errored and is possibly restartable.
369 * $20: The old a3 value 369 * $19: The old a3 value
370 */ 370 */
371 371
372 .align 4 372 .align 4
373 .ent work_pending 373 .ent work_pending
374work_pending: 374work_pending:
375 and $5, _TIF_NEED_RESCHED, $2 375 and $17, _TIF_NOTIFY_RESUME | _TIF_SIGPENDING, $2
376 beq $2, $work_notifysig 376 bne $2, $work_notifysig
377 377
378$work_resched: 378$work_resched:
379 subq $sp, 16, $sp 379 /*
380 stq $19, 0($sp) /* save syscall nr */ 380 * We can get here only if we returned from syscall without SIGPENDING
381 stq $20, 8($sp) /* and error indication (a3) */ 381 * or got through work_notifysig already. Either case means no syscall
382 * restarts for us, so let $18 and $19 burn.
383 */
382 jsr $26, schedule 384 jsr $26, schedule
383 ldq $19, 0($sp) 385 mov 0, $18
384 ldq $20, 8($sp) 386 br ret_to_user
385 addq $sp, 16, $sp
386 /* Make sure need_resched and sigpending don't change between
387 sampling and the rti. */
388 lda $16, 7
389 call_pal PAL_swpipl
390 ldl $5, TI_FLAGS($8)
391 and $5, _TIF_WORK_MASK, $2
392 beq $2, restore_all
393 and $5, _TIF_NEED_RESCHED, $2
394 bne $2, $work_resched
395 387
396$work_notifysig: 388$work_notifysig:
397 mov $sp, $16 389 mov $sp, $16
398 bsr $1, do_switch_stack 390 bsr $1, do_switch_stack
399 mov $sp, $17 391 jsr $26, do_work_pending
400 mov $5, $18
401 mov $19, $9 /* save old syscall number */
402 mov $20, $10 /* save old a3 */
403 and $5, _TIF_SIGPENDING, $2
404 cmovne $2, 0, $9 /* we don't want double syscall restarts */
405 jsr $26, do_notify_resume
406 mov $9, $19
407 mov $10, $20
408 bsr $1, undo_switch_stack 392 bsr $1, undo_switch_stack
409 br ret_to_user 393 br restore_all
410.end work_pending 394.end work_pending
411