Merge 5.4-rc2 into android-mainline
Linux 5.4-rc2 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: Idfe13500feef5c1095d06c419fa121f751daa459
This commit is contained in:
@@ -2532,39 +2532,19 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
|
||||
#ifdef __ARCH_WANT_SYS_CLONE3
|
||||
noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs,
|
||||
struct clone_args __user *uargs,
|
||||
size_t size)
|
||||
size_t usize)
|
||||
{
|
||||
int err;
|
||||
struct clone_args args;
|
||||
|
||||
if (unlikely(size > PAGE_SIZE))
|
||||
if (unlikely(usize > PAGE_SIZE))
|
||||
return -E2BIG;
|
||||
|
||||
if (unlikely(size < sizeof(struct clone_args)))
|
||||
if (unlikely(usize < CLONE_ARGS_SIZE_VER0))
|
||||
return -EINVAL;
|
||||
|
||||
if (unlikely(!access_ok(uargs, size)))
|
||||
return -EFAULT;
|
||||
|
||||
if (size > sizeof(struct clone_args)) {
|
||||
unsigned char __user *addr;
|
||||
unsigned char __user *end;
|
||||
unsigned char val;
|
||||
|
||||
addr = (void __user *)uargs + sizeof(struct clone_args);
|
||||
end = (void __user *)uargs + size;
|
||||
|
||||
for (; addr < end; addr++) {
|
||||
if (get_user(val, addr))
|
||||
return -EFAULT;
|
||||
if (val)
|
||||
return -E2BIG;
|
||||
}
|
||||
|
||||
size = sizeof(struct clone_args);
|
||||
}
|
||||
|
||||
if (copy_from_user(&args, uargs, size))
|
||||
return -EFAULT;
|
||||
err = copy_struct_from_user(&args, sizeof(args), uargs, usize);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/*
|
||||
* Verify that higher 32bits of exit_signal are unset and that
|
||||
@@ -2611,6 +2591,17 @@ static bool clone3_args_valid(const struct kernel_clone_args *kargs)
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* clone3 - create a new process with specific properties
|
||||
* @uargs: argument structure
|
||||
* @size: size of @uargs
|
||||
*
|
||||
* clone3() is the extensible successor to clone()/clone2().
|
||||
* It takes a struct as argument that is versioned by its size.
|
||||
*
|
||||
* Return: On success, a positive PID for the child process.
|
||||
* On error, a negative errno number.
|
||||
*/
|
||||
SYSCALL_DEFINE2(clone3, struct clone_args __user *, uargs, size_t, size)
|
||||
{
|
||||
int err;
|
||||
|
Reference in New Issue
Block a user