mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
fork: Pass struct kernel_clone_args into copy_thread
With io_uring we have started supporting tasks that are for most purposes user space tasks that exclusively run code in kernel mode. The kernel task that exec's init and tasks that exec user mode helpers are also user mode tasks that just run kernel code until they call kernel execve. Pass kernel_clone_args into copy_thread so these oddball tasks can be supported more cleanly and easily. v2: Fix spelling of kenrel_clone_args on h8300 Link: https://lkml.kernel.org/r/20220506141512.516114-2-ebiederm@xmission.com Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
@@ -233,10 +233,12 @@ release_thread(struct task_struct *dead_task)
|
||||
/*
|
||||
* Copy architecture-specific thread state
|
||||
*/
|
||||
int copy_thread(unsigned long clone_flags, unsigned long usp,
|
||||
unsigned long kthread_arg, struct task_struct *p,
|
||||
unsigned long tls)
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long kthread_arg = args->stack_size;
|
||||
unsigned long tls = args->tls;
|
||||
extern void ret_from_fork(void);
|
||||
extern void ret_from_kernel_thread(void);
|
||||
|
||||
|
||||
@@ -162,10 +162,12 @@ asmlinkage void ret_from_fork(void);
|
||||
* | user_r25 |
|
||||
* ------------------ <===== END of PAGE
|
||||
*/
|
||||
int copy_thread(unsigned long clone_flags, unsigned long usp,
|
||||
unsigned long kthread_arg, struct task_struct *p,
|
||||
unsigned long tls)
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long kthread_arg = args->stack_size;
|
||||
unsigned long tls = args->tls;
|
||||
struct pt_regs *c_regs; /* child's pt_regs */
|
||||
unsigned long *childksp; /* to unwind out of __switch_to() */
|
||||
struct callee_regs *c_callee; /* child's callee regs */
|
||||
|
||||
@@ -238,9 +238,12 @@ void release_thread(struct task_struct *dead_task)
|
||||
|
||||
asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
|
||||
|
||||
int copy_thread(unsigned long clone_flags, unsigned long stack_start,
|
||||
unsigned long stk_sz, struct task_struct *p, unsigned long tls)
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
unsigned long stack_start = args->stack;
|
||||
unsigned long stk_sz = args->stack_size;
|
||||
unsigned long tls = args->tls;
|
||||
struct thread_info *thread = task_thread_info(p);
|
||||
struct pt_regs *childregs = task_pt_regs(p);
|
||||
|
||||
|
||||
@@ -316,9 +316,12 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
|
||||
|
||||
asmlinkage void ret_from_fork(void) asm("ret_from_fork");
|
||||
|
||||
int copy_thread(unsigned long clone_flags, unsigned long stack_start,
|
||||
unsigned long stk_sz, struct task_struct *p, unsigned long tls)
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
unsigned long stack_start = args->stack;
|
||||
unsigned long stk_sz = args->stack_size;
|
||||
unsigned long tls = args->tls;
|
||||
struct pt_regs *childregs = task_pt_regs(p);
|
||||
|
||||
memset(&p->thread.cpu_context, 0, sizeof(struct cpu_context));
|
||||
|
||||
@@ -30,12 +30,12 @@ asmlinkage void ret_from_kernel_thread(void);
|
||||
*/
|
||||
void flush_thread(void){}
|
||||
|
||||
int copy_thread(unsigned long clone_flags,
|
||||
unsigned long usp,
|
||||
unsigned long kthread_arg,
|
||||
struct task_struct *p,
|
||||
unsigned long tls)
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long kthread_arg = args->stack_size;
|
||||
unsigned long tls = args->tls;
|
||||
struct switch_stack *childstack;
|
||||
struct pt_regs *childregs = task_pt_regs(p);
|
||||
|
||||
|
||||
@@ -105,9 +105,10 @@ void flush_thread(void)
|
||||
{
|
||||
}
|
||||
|
||||
int copy_thread(unsigned long clone_flags, unsigned long usp,
|
||||
unsigned long topstk, struct task_struct *p, unsigned long tls)
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long topstk = args->stack_size;
|
||||
struct pt_regs *childregs;
|
||||
|
||||
childregs = (struct pt_regs *) (THREAD_SIZE + task_stack_page(p)) - 1;
|
||||
|
||||
@@ -50,9 +50,12 @@ void arch_cpu_idle(void)
|
||||
/*
|
||||
* Copy architecture-specific thread state
|
||||
*/
|
||||
int copy_thread(unsigned long clone_flags, unsigned long usp, unsigned long arg,
|
||||
struct task_struct *p, unsigned long tls)
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long arg = args->stack_size;
|
||||
unsigned long tls = args->tls;
|
||||
struct thread_info *ti = task_thread_info(p);
|
||||
struct hexagon_switch_stack *ss;
|
||||
struct pt_regs *childregs;
|
||||
|
||||
@@ -295,9 +295,12 @@ ia64_load_extra (struct task_struct *task)
|
||||
* so there is nothing to worry about.
|
||||
*/
|
||||
int
|
||||
copy_thread(unsigned long clone_flags, unsigned long user_stack_base,
|
||||
unsigned long user_stack_size, struct task_struct *p, unsigned long tls)
|
||||
copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
unsigned long user_stack_base = args->stack;
|
||||
unsigned long user_stack_size = args->stack_size;
|
||||
unsigned long tls = args->tls;
|
||||
extern char ia64_ret_from_clone;
|
||||
struct switch_stack *child_stack, *stack;
|
||||
unsigned long rbs, child_rbs, rbs_size;
|
||||
|
||||
@@ -138,9 +138,12 @@ asmlinkage int m68k_clone3(struct pt_regs *regs)
|
||||
return sys_clone3((struct clone_args __user *)regs->d1, regs->d2);
|
||||
}
|
||||
|
||||
int copy_thread(unsigned long clone_flags, unsigned long usp, unsigned long arg,
|
||||
struct task_struct *p, unsigned long tls)
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long arg = args->stack_size;
|
||||
unsigned long tls = args->tls;
|
||||
struct fork_frame {
|
||||
struct switch_stack sw;
|
||||
struct pt_regs regs;
|
||||
|
||||
@@ -52,9 +52,12 @@ void flush_thread(void)
|
||||
{
|
||||
}
|
||||
|
||||
int copy_thread(unsigned long clone_flags, unsigned long usp, unsigned long arg,
|
||||
struct task_struct *p, unsigned long tls)
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long arg = args->stack_size;
|
||||
unsigned long tls = args->tls;
|
||||
struct pt_regs *childregs = task_pt_regs(p);
|
||||
struct thread_info *ti = task_thread_info(p);
|
||||
|
||||
|
||||
@@ -105,10 +105,12 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
|
||||
/*
|
||||
* Copy architecture-specific thread state
|
||||
*/
|
||||
int copy_thread(unsigned long clone_flags, unsigned long usp,
|
||||
unsigned long kthread_arg, struct task_struct *p,
|
||||
unsigned long tls)
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long kthread_arg = args->stack_size;
|
||||
unsigned long tls = args->tls;
|
||||
struct thread_info *ti = task_thread_info(p);
|
||||
struct pt_regs *childregs, *regs = current_pt_regs();
|
||||
unsigned long childksp;
|
||||
|
||||
@@ -100,9 +100,12 @@ void flush_thread(void)
|
||||
{
|
||||
}
|
||||
|
||||
int copy_thread(unsigned long clone_flags, unsigned long usp, unsigned long arg,
|
||||
struct task_struct *p, unsigned long tls)
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long arg = args->stack_size;
|
||||
unsigned long tls = args->tls;
|
||||
struct pt_regs *childregs = task_pt_regs(p);
|
||||
struct pt_regs *regs;
|
||||
struct switch_stack *stack;
|
||||
|
||||
@@ -152,9 +152,12 @@ extern asmlinkage void ret_from_fork(void);
|
||||
*/
|
||||
|
||||
int
|
||||
copy_thread(unsigned long clone_flags, unsigned long usp, unsigned long arg,
|
||||
struct task_struct *p, unsigned long tls)
|
||||
copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long arg = args->stack_size;
|
||||
unsigned long tls = args->tls;
|
||||
struct pt_regs *userregs;
|
||||
struct pt_regs *kregs;
|
||||
unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE;
|
||||
|
||||
@@ -206,9 +206,12 @@ arch_initcall(parisc_idle_init);
|
||||
* Copy architecture-specific thread state
|
||||
*/
|
||||
int
|
||||
copy_thread(unsigned long clone_flags, unsigned long usp,
|
||||
unsigned long kthread_arg, struct task_struct *p, unsigned long tls)
|
||||
copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long kthread_arg = args->stack_size;
|
||||
unsigned long tls = args->tls;
|
||||
struct pt_regs *cregs = &(p->thread.regs);
|
||||
void *stack = task_stack_page(p);
|
||||
|
||||
|
||||
@@ -1716,10 +1716,12 @@ static void setup_ksp_vsid(struct task_struct *p, unsigned long sp)
|
||||
/*
|
||||
* Copy architecture-specific thread state
|
||||
*/
|
||||
int copy_thread(unsigned long clone_flags, unsigned long usp,
|
||||
unsigned long kthread_arg, struct task_struct *p,
|
||||
unsigned long tls)
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long kthread_arg = args->stack_size;
|
||||
unsigned long tls = args->tls;
|
||||
struct pt_regs *childregs, *kregs;
|
||||
extern void ret_from_fork(void);
|
||||
extern void ret_from_fork_scv(void);
|
||||
|
||||
@@ -120,9 +120,12 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int copy_thread(unsigned long clone_flags, unsigned long usp, unsigned long arg,
|
||||
struct task_struct *p, unsigned long tls)
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long arg = args->stack_size;
|
||||
unsigned long tls = args->tls;
|
||||
struct pt_regs *childregs = task_pt_regs(p);
|
||||
|
||||
/* p->thread holds context to be restored by __switch_to() */
|
||||
|
||||
@@ -94,9 +94,12 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
|
||||
unsigned long arg, struct task_struct *p, unsigned long tls)
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
unsigned long new_stackp = args->stack;
|
||||
unsigned long arg = args->stack_size;
|
||||
unsigned long tls = args->tls;
|
||||
struct fake_frame
|
||||
{
|
||||
struct stack_frame sf;
|
||||
|
||||
@@ -92,9 +92,12 @@ void release_thread(struct task_struct *dead_task)
|
||||
asmlinkage void ret_from_fork(void);
|
||||
asmlinkage void ret_from_kernel_thread(void);
|
||||
|
||||
int copy_thread(unsigned long clone_flags, unsigned long usp, unsigned long arg,
|
||||
struct task_struct *p, unsigned long tls)
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long arg = args->stack_size;
|
||||
unsigned long tls = args->tls;
|
||||
struct thread_info *ti = task_thread_info(p);
|
||||
struct pt_regs *childregs;
|
||||
|
||||
|
||||
@@ -259,9 +259,12 @@ clone_stackframe(struct sparc_stackf __user *dst,
|
||||
extern void ret_from_fork(void);
|
||||
extern void ret_from_kernel_thread(void);
|
||||
|
||||
int copy_thread(unsigned long clone_flags, unsigned long sp, unsigned long arg,
|
||||
struct task_struct *p, unsigned long tls)
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
unsigned long sp = args->stack;
|
||||
unsigned long arg = args->stack_size;
|
||||
unsigned long tls = args->tls;
|
||||
struct thread_info *ti = task_thread_info(p);
|
||||
struct pt_regs *childregs, *regs = current_pt_regs();
|
||||
char *new_stack;
|
||||
|
||||
@@ -564,9 +564,12 @@ barf:
|
||||
* Parent --> %o0 == childs pid, %o1 == 0
|
||||
* Child --> %o0 == parents pid, %o1 == 1
|
||||
*/
|
||||
int copy_thread(unsigned long clone_flags, unsigned long sp, unsigned long arg,
|
||||
struct task_struct *p, unsigned long tls)
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
unsigned long sp = args->stack;
|
||||
unsigned long arg = args->stack_size;
|
||||
unsigned long tls = args->tls;
|
||||
struct thread_info *t = task_thread_info(p);
|
||||
struct pt_regs *regs = current_pt_regs();
|
||||
struct sparc_stackf *parent_sf;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user