binfmt_elf: don't bother with __{put,copy_to}_user()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
7e71609f64
commit
646e84deb4
@ -202,7 +202,7 @@ create_elf_tables(struct linux_binprm *bprm, const struct elfhdr *exec,
|
|||||||
size_t len = strlen(k_platform) + 1;
|
size_t len = strlen(k_platform) + 1;
|
||||||
|
|
||||||
u_platform = (elf_addr_t __user *)STACK_ALLOC(p, len);
|
u_platform = (elf_addr_t __user *)STACK_ALLOC(p, len);
|
||||||
if (__copy_to_user(u_platform, k_platform, len))
|
if (copy_to_user(u_platform, k_platform, len))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ create_elf_tables(struct linux_binprm *bprm, const struct elfhdr *exec,
|
|||||||
size_t len = strlen(k_base_platform) + 1;
|
size_t len = strlen(k_base_platform) + 1;
|
||||||
|
|
||||||
u_base_platform = (elf_addr_t __user *)STACK_ALLOC(p, len);
|
u_base_platform = (elf_addr_t __user *)STACK_ALLOC(p, len);
|
||||||
if (__copy_to_user(u_base_platform, k_base_platform, len))
|
if (copy_to_user(u_base_platform, k_base_platform, len))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ create_elf_tables(struct linux_binprm *bprm, const struct elfhdr *exec,
|
|||||||
get_random_bytes(k_rand_bytes, sizeof(k_rand_bytes));
|
get_random_bytes(k_rand_bytes, sizeof(k_rand_bytes));
|
||||||
u_rand_bytes = (elf_addr_t __user *)
|
u_rand_bytes = (elf_addr_t __user *)
|
||||||
STACK_ALLOC(p, sizeof(k_rand_bytes));
|
STACK_ALLOC(p, sizeof(k_rand_bytes));
|
||||||
if (__copy_to_user(u_rand_bytes, k_rand_bytes, sizeof(k_rand_bytes)))
|
if (copy_to_user(u_rand_bytes, k_rand_bytes, sizeof(k_rand_bytes)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
/* Create the ELF interpreter info */
|
/* Create the ELF interpreter info */
|
||||||
@ -308,21 +308,21 @@ create_elf_tables(struct linux_binprm *bprm, const struct elfhdr *exec,
|
|||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
/* Now, let's put argc (and argv, envp if appropriate) on the stack */
|
/* Now, let's put argc (and argv, envp if appropriate) on the stack */
|
||||||
if (__put_user(argc, sp++))
|
if (put_user(argc, sp++))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
/* Populate list of argv pointers back to argv strings. */
|
/* Populate list of argv pointers back to argv strings. */
|
||||||
p = mm->arg_end = mm->arg_start;
|
p = mm->arg_end = mm->arg_start;
|
||||||
while (argc-- > 0) {
|
while (argc-- > 0) {
|
||||||
size_t len;
|
size_t len;
|
||||||
if (__put_user((elf_addr_t)p, sp++))
|
if (put_user((elf_addr_t)p, sp++))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
len = strnlen_user((void __user *)p, MAX_ARG_STRLEN);
|
len = strnlen_user((void __user *)p, MAX_ARG_STRLEN);
|
||||||
if (!len || len > MAX_ARG_STRLEN)
|
if (!len || len > MAX_ARG_STRLEN)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
p += len;
|
p += len;
|
||||||
}
|
}
|
||||||
if (__put_user(0, sp++))
|
if (put_user(0, sp++))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
mm->arg_end = p;
|
mm->arg_end = p;
|
||||||
|
|
||||||
@ -330,14 +330,14 @@ create_elf_tables(struct linux_binprm *bprm, const struct elfhdr *exec,
|
|||||||
mm->env_end = mm->env_start = p;
|
mm->env_end = mm->env_start = p;
|
||||||
while (envc-- > 0) {
|
while (envc-- > 0) {
|
||||||
size_t len;
|
size_t len;
|
||||||
if (__put_user((elf_addr_t)p, sp++))
|
if (put_user((elf_addr_t)p, sp++))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
len = strnlen_user((void __user *)p, MAX_ARG_STRLEN);
|
len = strnlen_user((void __user *)p, MAX_ARG_STRLEN);
|
||||||
if (!len || len > MAX_ARG_STRLEN)
|
if (!len || len > MAX_ARG_STRLEN)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
p += len;
|
p += len;
|
||||||
}
|
}
|
||||||
if (__put_user(0, sp++))
|
if (put_user(0, sp++))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
mm->env_end = p;
|
mm->env_end = p;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user