Merge git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-sched
[sfrench/cifs-2.6.git] / kernel / fork.c
index da3a155bba0ddc5c50a8082833a90be6fe60e8ce..7c5c5888e00a99d8b33bf59c4fe5056ebc905f81 100644 (file)
@@ -49,6 +49,7 @@
 #include <linux/delayacct.h>
 #include <linux/taskstats_kern.h>
 #include <linux/random.h>
+#include <linux/tty.h>
 
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
@@ -897,6 +898,8 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts
        }
        acct_init_pacct(&sig->pacct);
 
+       tty_audit_fork(sig);
+
        return 0;
 }
 
@@ -999,7 +1002,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
        if (atomic_read(&p->user->processes) >=
                        p->signal->rlim[RLIMIT_NPROC].rlim_cur) {
                if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) &&
-                               p->user != &root_user)
+                   p->user != current->nsproxy->user_ns->root_user)
                        goto bad_fork_free;
        }
 
@@ -1059,6 +1062,8 @@ static struct task_struct *copy_process(unsigned long clone_flags,
 
        p->lock_depth = -1;             /* -1 = no lock */
        do_posix_clock_monotonic_gettime(&p->start_time);
+       p->real_start_time = p->start_time;
+       monotonic_to_bootbased(&p->real_start_time);
        p->security = NULL;
        p->io_context = NULL;
        p->io_wait = NULL;
@@ -1601,7 +1606,7 @@ asmlinkage long sys_unshare(unsigned long unshare_flags)
        err = -EINVAL;
        if (unshare_flags & ~(CLONE_THREAD|CLONE_FS|CLONE_NEWNS|CLONE_SIGHAND|
                                CLONE_VM|CLONE_FILES|CLONE_SYSVSEM|
-                               CLONE_NEWUTS|CLONE_NEWIPC))
+                               CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWUSER))
                goto bad_unshare_out;
 
        if ((err = unshare_thread(unshare_flags)))