diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-01-20 16:58:48 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-01-20 16:58:48 -0500 |
commit | 3a142ed962958d3063f648738a3384ab90017100 (patch) | |
tree | 6e7e98108edf793ba012c4e2efa78deb8a2cc052 | |
parent | edea0d03ee5f0ae0051b6adb6681ebdf976b1ca4 (diff) | |
parent | b1e0318b8cd4bdbb0fbc48967b0350483ad9bd69 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull misc syscall fixes from Al Viro:
- compat syscall fixes (discussed back in December)
- a couple of "make life easier for sigaltstack stuff by reducing
inter-tree dependencies"
- fix up compiler/asmlinkage calling convention disagreement of
sys_clone()
- misc
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal:
sys_clone() needs asmlinkage_protect
make sure that /linuxrc has std{in,out,err}
x32: fix sigtimedwait
x32: fix waitid()
switch compat_sys_wait4() and compat_sys_waitid() to COMPAT_SYSCALL_DEFINE
switch compat_sys_sigaltstack() to COMPAT_SYSCALL_DEFINE
CONFIG_GENERIC_SIGALTSTACK build breakage with asm-generic/syscalls.h
Ensure that kernel_init_freeable() is not inlined into non __init code
-rw-r--r-- | include/asm-generic/syscalls.h | 2 | ||||
-rw-r--r-- | init/do_mounts_initrd.c | 4 | ||||
-rw-r--r-- | init/main.c | 4 | ||||
-rw-r--r-- | kernel/compat.c | 23 | ||||
-rw-r--r-- | kernel/fork.c | 6 | ||||
-rw-r--r-- | kernel/signal.c | 5 |
6 files changed, 30 insertions, 14 deletions
diff --git a/include/asm-generic/syscalls.h b/include/asm-generic/syscalls.h index 58f466ff00d3..1db51b8524e9 100644 --- a/include/asm-generic/syscalls.h +++ b/include/asm-generic/syscalls.h | |||
@@ -21,10 +21,12 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len, | |||
21 | unsigned long fd, off_t pgoff); | 21 | unsigned long fd, off_t pgoff); |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | #ifndef CONFIG_GENERIC_SIGALTSTACK | ||
24 | #ifndef sys_sigaltstack | 25 | #ifndef sys_sigaltstack |
25 | asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *, | 26 | asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *, |
26 | struct pt_regs *); | 27 | struct pt_regs *); |
27 | #endif | 28 | #endif |
29 | #endif | ||
28 | 30 | ||
29 | #ifndef sys_rt_sigreturn | 31 | #ifndef sys_rt_sigreturn |
30 | asmlinkage long sys_rt_sigreturn(struct pt_regs *regs); | 32 | asmlinkage long sys_rt_sigreturn(struct pt_regs *regs); |
diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c index 5e4ded51788e..f9acf71b9810 100644 --- a/init/do_mounts_initrd.c +++ b/init/do_mounts_initrd.c | |||
@@ -36,6 +36,10 @@ __setup("noinitrd", no_initrd); | |||
36 | static int init_linuxrc(struct subprocess_info *info, struct cred *new) | 36 | static int init_linuxrc(struct subprocess_info *info, struct cred *new) |
37 | { | 37 | { |
38 | sys_unshare(CLONE_FS | CLONE_FILES); | 38 | sys_unshare(CLONE_FS | CLONE_FILES); |
39 | /* stdin/stdout/stderr for /linuxrc */ | ||
40 | sys_open("/dev/console", O_RDWR, 0); | ||
41 | sys_dup(0); | ||
42 | sys_dup(0); | ||
39 | /* move initrd over / and chdir/chroot in initrd root */ | 43 | /* move initrd over / and chdir/chroot in initrd root */ |
40 | sys_chdir("/root"); | 44 | sys_chdir("/root"); |
41 | sys_mount(".", "/", NULL, MS_MOVE, NULL); | 45 | sys_mount(".", "/", NULL, MS_MOVE, NULL); |
diff --git a/init/main.c b/init/main.c index 85d69dffe864..92d728a32d51 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -802,7 +802,7 @@ static int run_init_process(const char *init_filename) | |||
802 | (const char __user *const __user *)envp_init); | 802 | (const char __user *const __user *)envp_init); |
803 | } | 803 | } |
804 | 804 | ||
805 | static void __init kernel_init_freeable(void); | 805 | static noinline void __init kernel_init_freeable(void); |
806 | 806 | ||
807 | static int __ref kernel_init(void *unused) | 807 | static int __ref kernel_init(void *unused) |
808 | { | 808 | { |
@@ -845,7 +845,7 @@ static int __ref kernel_init(void *unused) | |||
845 | "See Linux Documentation/init.txt for guidance."); | 845 | "See Linux Documentation/init.txt for guidance."); |
846 | } | 846 | } |
847 | 847 | ||
848 | static void __init kernel_init_freeable(void) | 848 | static noinline void __init kernel_init_freeable(void) |
849 | { | 849 | { |
850 | /* | 850 | /* |
851 | * Wait until kthreadd is all set-up. | 851 | * Wait until kthreadd is all set-up. |
diff --git a/kernel/compat.c b/kernel/compat.c index f6150e92dfc9..36700e9e2be9 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
@@ -535,9 +535,11 @@ asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru) | |||
535 | return 0; | 535 | return 0; |
536 | } | 536 | } |
537 | 537 | ||
538 | asmlinkage long | 538 | COMPAT_SYSCALL_DEFINE4(wait4, |
539 | compat_sys_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options, | 539 | compat_pid_t, pid, |
540 | struct compat_rusage __user *ru) | 540 | compat_uint_t __user *, stat_addr, |
541 | int, options, | ||
542 | struct compat_rusage __user *, ru) | ||
541 | { | 543 | { |
542 | if (!ru) { | 544 | if (!ru) { |
543 | return sys_wait4(pid, stat_addr, options, NULL); | 545 | return sys_wait4(pid, stat_addr, options, NULL); |
@@ -564,9 +566,10 @@ compat_sys_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options, | |||
564 | } | 566 | } |
565 | } | 567 | } |
566 | 568 | ||
567 | asmlinkage long compat_sys_waitid(int which, compat_pid_t pid, | 569 | COMPAT_SYSCALL_DEFINE5(waitid, |
568 | struct compat_siginfo __user *uinfo, int options, | 570 | int, which, compat_pid_t, pid, |
569 | struct compat_rusage __user *uru) | 571 | struct compat_siginfo __user *, uinfo, int, options, |
572 | struct compat_rusage __user *, uru) | ||
570 | { | 573 | { |
571 | siginfo_t info; | 574 | siginfo_t info; |
572 | struct rusage ru; | 575 | struct rusage ru; |
@@ -584,7 +587,11 @@ asmlinkage long compat_sys_waitid(int which, compat_pid_t pid, | |||
584 | return ret; | 587 | return ret; |
585 | 588 | ||
586 | if (uru) { | 589 | if (uru) { |
587 | ret = put_compat_rusage(&ru, uru); | 590 | /* sys_waitid() overwrites everything in ru */ |
591 | if (COMPAT_USE_64BIT_TIME) | ||
592 | ret = copy_to_user(uru, &ru, sizeof(ru)); | ||
593 | else | ||
594 | ret = put_compat_rusage(&ru, uru); | ||
588 | if (ret) | 595 | if (ret) |
589 | return ret; | 596 | return ret; |
590 | } | 597 | } |
@@ -994,7 +1001,7 @@ compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese, | |||
994 | sigset_from_compat(&s, &s32); | 1001 | sigset_from_compat(&s, &s32); |
995 | 1002 | ||
996 | if (uts) { | 1003 | if (uts) { |
997 | if (get_compat_timespec(&t, uts)) | 1004 | if (compat_get_timespec(&t, uts)) |
998 | return -EFAULT; | 1005 | return -EFAULT; |
999 | } | 1006 | } |
1000 | 1007 | ||
diff --git a/kernel/fork.c b/kernel/fork.c index 65ca6d27f24e..c535f33bbb9c 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1668,8 +1668,10 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, | |||
1668 | int, tls_val) | 1668 | int, tls_val) |
1669 | #endif | 1669 | #endif |
1670 | { | 1670 | { |
1671 | return do_fork(clone_flags, newsp, 0, | 1671 | long ret = do_fork(clone_flags, newsp, 0, parent_tidptr, child_tidptr); |
1672 | parent_tidptr, child_tidptr); | 1672 | asmlinkage_protect(5, ret, clone_flags, newsp, |
1673 | parent_tidptr, child_tidptr, tls_val); | ||
1674 | return ret; | ||
1673 | } | 1675 | } |
1674 | #endif | 1676 | #endif |
1675 | 1677 | ||
diff --git a/kernel/signal.c b/kernel/signal.c index 372771e948c2..53cd5c4d1172 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -3116,8 +3116,9 @@ int __save_altstack(stack_t __user *uss, unsigned long sp) | |||
3116 | 3116 | ||
3117 | #ifdef CONFIG_COMPAT | 3117 | #ifdef CONFIG_COMPAT |
3118 | #ifdef CONFIG_GENERIC_SIGALTSTACK | 3118 | #ifdef CONFIG_GENERIC_SIGALTSTACK |
3119 | asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, | 3119 | COMPAT_SYSCALL_DEFINE2(sigaltstack, |
3120 | compat_stack_t __user *uoss_ptr) | 3120 | const compat_stack_t __user *, uss_ptr, |
3121 | compat_stack_t __user *, uoss_ptr) | ||
3121 | { | 3122 | { |
3122 | stack_t uss, uoss; | 3123 | stack_t uss, uoss; |
3123 | int ret; | 3124 | int ret; |