Commit 3a142ed9 authored by Linus Torvalds's avatar Linus Torvalds

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
parents edea0d03 b1e0318b
...@@ -21,10 +21,12 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len, ...@@ -21,10 +21,12 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
unsigned long fd, off_t pgoff); unsigned long fd, off_t pgoff);
#endif #endif
#ifndef CONFIG_GENERIC_SIGALTSTACK
#ifndef sys_sigaltstack #ifndef sys_sigaltstack
asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *, asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *,
struct pt_regs *); struct pt_regs *);
#endif #endif
#endif
#ifndef sys_rt_sigreturn #ifndef sys_rt_sigreturn
asmlinkage long sys_rt_sigreturn(struct pt_regs *regs); asmlinkage long sys_rt_sigreturn(struct pt_regs *regs);
......
...@@ -36,6 +36,10 @@ __setup("noinitrd", no_initrd); ...@@ -36,6 +36,10 @@ __setup("noinitrd", no_initrd);
static int init_linuxrc(struct subprocess_info *info, struct cred *new) static int init_linuxrc(struct subprocess_info *info, struct cred *new)
{ {
sys_unshare(CLONE_FS | CLONE_FILES); sys_unshare(CLONE_FS | CLONE_FILES);
/* stdin/stdout/stderr for /linuxrc */
sys_open("/dev/console", O_RDWR, 0);
sys_dup(0);
sys_dup(0);
/* move initrd over / and chdir/chroot in initrd root */ /* move initrd over / and chdir/chroot in initrd root */
sys_chdir("/root"); sys_chdir("/root");
sys_mount(".", "/", NULL, MS_MOVE, NULL); sys_mount(".", "/", NULL, MS_MOVE, NULL);
......
...@@ -802,7 +802,7 @@ static int run_init_process(const char *init_filename) ...@@ -802,7 +802,7 @@ static int run_init_process(const char *init_filename)
(const char __user *const __user *)envp_init); (const char __user *const __user *)envp_init);
} }
static void __init kernel_init_freeable(void); static noinline void __init kernel_init_freeable(void);
static int __ref kernel_init(void *unused) static int __ref kernel_init(void *unused)
{ {
...@@ -845,7 +845,7 @@ static int __ref kernel_init(void *unused) ...@@ -845,7 +845,7 @@ static int __ref kernel_init(void *unused)
"See Linux Documentation/init.txt for guidance."); "See Linux Documentation/init.txt for guidance.");
} }
static void __init kernel_init_freeable(void) static noinline void __init kernel_init_freeable(void)
{ {
/* /*
* Wait until kthreadd is all set-up. * Wait until kthreadd is all set-up.
......
...@@ -535,9 +535,11 @@ asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru) ...@@ -535,9 +535,11 @@ asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru)
return 0; return 0;
} }
asmlinkage long COMPAT_SYSCALL_DEFINE4(wait4,
compat_sys_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options, compat_pid_t, pid,
struct compat_rusage __user *ru) compat_uint_t __user *, stat_addr,
int, options,
struct compat_rusage __user *, ru)
{ {
if (!ru) { if (!ru) {
return sys_wait4(pid, stat_addr, options, NULL); 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,9 +566,10 @@ compat_sys_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options,
} }
} }
asmlinkage long compat_sys_waitid(int which, compat_pid_t pid, COMPAT_SYSCALL_DEFINE5(waitid,
struct compat_siginfo __user *uinfo, int options, int, which, compat_pid_t, pid,
struct compat_rusage __user *uru) struct compat_siginfo __user *, uinfo, int, options,
struct compat_rusage __user *, uru)
{ {
siginfo_t info; siginfo_t info;
struct rusage ru; struct rusage ru;
...@@ -584,7 +587,11 @@ asmlinkage long compat_sys_waitid(int which, compat_pid_t pid, ...@@ -584,7 +587,11 @@ asmlinkage long compat_sys_waitid(int which, compat_pid_t pid,
return ret; return ret;
if (uru) { if (uru) {
ret = put_compat_rusage(&ru, uru); /* sys_waitid() overwrites everything in ru */
if (COMPAT_USE_64BIT_TIME)
ret = copy_to_user(uru, &ru, sizeof(ru));
else
ret = put_compat_rusage(&ru, uru);
if (ret) if (ret)
return ret; return ret;
} }
...@@ -994,7 +1001,7 @@ compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese, ...@@ -994,7 +1001,7 @@ compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese,
sigset_from_compat(&s, &s32); sigset_from_compat(&s, &s32);
if (uts) { if (uts) {
if (get_compat_timespec(&t, uts)) if (compat_get_timespec(&t, uts))
return -EFAULT; return -EFAULT;
} }
......
...@@ -1668,8 +1668,10 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, ...@@ -1668,8 +1668,10 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
int, tls_val) int, tls_val)
#endif #endif
{ {
return do_fork(clone_flags, newsp, 0, long ret = do_fork(clone_flags, newsp, 0, parent_tidptr, child_tidptr);
parent_tidptr, child_tidptr); asmlinkage_protect(5, ret, clone_flags, newsp,
parent_tidptr, child_tidptr, tls_val);
return ret;
} }
#endif #endif
......
...@@ -3116,8 +3116,9 @@ int __save_altstack(stack_t __user *uss, unsigned long sp) ...@@ -3116,8 +3116,9 @@ int __save_altstack(stack_t __user *uss, unsigned long sp)
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
#ifdef CONFIG_GENERIC_SIGALTSTACK #ifdef CONFIG_GENERIC_SIGALTSTACK
asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, COMPAT_SYSCALL_DEFINE2(sigaltstack,
compat_stack_t __user *uoss_ptr) const compat_stack_t __user *, uss_ptr,
compat_stack_t __user *, uoss_ptr)
{ {
stack_t uss, uoss; stack_t uss, uoss;
int ret; int ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment