diff --git a/[refs] b/[refs] index 812caa599144..fa3f40208750 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a4d94ff8aa864c05b33c2de1f8c5d0176d7a4b63 +refs/heads/master: 2aa3a7f8660355c3dddead17e224545c1a3d5a5f diff --git a/trunk/arch/Kconfig b/trunk/arch/Kconfig index 72f2fa189cc5..d397e11d167d 100644 --- a/trunk/arch/Kconfig +++ b/trunk/arch/Kconfig @@ -258,6 +258,9 @@ config ARCH_WANT_OLD_COMPAT_IPC select ARCH_WANT_COMPAT_IPC_PARSE_VERSION bool +config GENERIC_KERNEL_THREAD + bool + config HAVE_ARCH_SECCOMP_FILTER bool help diff --git a/trunk/include/linux/sched.h b/trunk/include/linux/sched.h index 23bddac4bad8..34da9340c6a4 100644 --- a/trunk/include/linux/sched.h +++ b/trunk/include/linux/sched.h @@ -2325,6 +2325,9 @@ extern int do_execve(const char *, const char __user * const __user *, struct pt_regs *); extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *); struct task_struct *fork_idle(int); +#ifdef CONFIG_GENERIC_KERNEL_THREAD +extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); +#endif extern void set_task_comm(struct task_struct *tsk, char *from); extern char *get_task_comm(char *to, struct task_struct *tsk); diff --git a/trunk/kernel/fork.c b/trunk/kernel/fork.c index 2c8857e12855..a42c62a8eb24 100644 --- a/trunk/kernel/fork.c +++ b/trunk/kernel/fork.c @@ -1609,7 +1609,7 @@ long do_fork(unsigned long clone_flags, * requested, no event is reported; otherwise, report if the event * for the type of forking is enabled. */ - if (likely(user_mode(regs)) && !(clone_flags & CLONE_UNTRACED)) { + if (!(clone_flags & CLONE_UNTRACED) && likely(user_mode(regs))) { if (clone_flags & CLONE_VFORK) trace = PTRACE_EVENT_VFORK; else if ((clone_flags & CSIGNAL) != SIGCHLD) @@ -1659,6 +1659,17 @@ long do_fork(unsigned long clone_flags, return nr; } +#ifdef CONFIG_GENERIC_KERNEL_THREAD +/* + * Create a kernel thread. + */ +pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) +{ + return do_fork(flags|CLONE_VM|CLONE_UNTRACED, (unsigned long)fn, NULL, + (unsigned long)arg, NULL, NULL); +} +#endif + #ifndef ARCH_MIN_MMSTRUCT_ALIGN #define ARCH_MIN_MMSTRUCT_ALIGN 0 #endif