Commit 524f2677 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: aout32 sparse fixes for compat

	this basically repeats the stuff done to fs/binfmt_aout.c for amd64
and sparc64 aout32.
parent deea6675
...@@ -112,9 +112,9 @@ static int aout32_core_dump(long signr, struct pt_regs *regs, struct file *file) ...@@ -112,9 +112,9 @@ static int aout32_core_dump(long signr, struct pt_regs *regs, struct file *file)
/* make sure we actually have a data and stack area to dump */ /* make sure we actually have a data and stack area to dump */
set_fs(USER_DS); set_fs(USER_DS);
if (verify_area(VERIFY_READ, (void *) START_DATA(dump), dump.u_dsize)) if (verify_area(VERIFY_READ, (void __user *) START_DATA(dump), dump.u_dsize))
dump.u_dsize = 0; dump.u_dsize = 0;
if (verify_area(VERIFY_READ, (void *) START_STACK(dump), dump.u_ssize)) if (verify_area(VERIFY_READ, (void __user *) START_STACK(dump), dump.u_ssize))
dump.u_ssize = 0; dump.u_ssize = 0;
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
...@@ -148,24 +148,25 @@ static int aout32_core_dump(long signr, struct pt_regs *regs, struct file *file) ...@@ -148,24 +148,25 @@ static int aout32_core_dump(long signr, struct pt_regs *regs, struct file *file)
* addresses on the "stack", returning the new stack pointer value. * addresses on the "stack", returning the new stack pointer value.
*/ */
static u32 *create_aout32_tables(char * p, struct linux_binprm * bprm) static u32 __user *create_aout32_tables(char __user *p, struct linux_binprm *bprm)
{ {
u32 *argv, *envp; u32 __user *argv;
u32 *sp; u32 __user *envp;
u32 __user *sp;
int argc = bprm->argc; int argc = bprm->argc;
int envc = bprm->envc; int envc = bprm->envc;
sp = (u32 *) ((-(unsigned long)sizeof(char *)) & (unsigned long) p); sp = (u32 __user *)((-(unsigned long)sizeof(char *))&(unsigned long)p);
/* This imposes the proper stack alignment for a new process. */ /* This imposes the proper stack alignment for a new process. */
sp = (u32 *) (((unsigned long) sp) & ~7); sp = (u32 __user *) (((unsigned long) sp) & ~7);
if ((envc+argc+3)&1) if ((envc+argc+3)&1)
--sp; --sp;
sp -= envc+1; sp -= envc+1;
envp = (u32 *) sp; envp = sp;
sp -= argc+1; sp -= argc+1;
argv = (u32 *) sp; argv = sp;
put_user(argc,--sp); put_user(argc,--sp);
current->mm->arg_start = (unsigned long) p; current->mm->arg_start = (unsigned long) p;
while (argc-->0) { while (argc-->0) {
...@@ -319,7 +320,7 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) ...@@ -319,7 +320,7 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs)
} }
current->mm->start_stack = current->mm->start_stack =
(unsigned long) create_aout32_tables((char *)bprm->p, bprm); (unsigned long) create_aout32_tables((char __user *)bprm->p, bprm);
if (!(orig_thr_flags & _TIF_32BIT)) { if (!(orig_thr_flags & _TIF_32BIT)) {
unsigned long pgd_cache; unsigned long pgd_cache;
......
...@@ -216,18 +216,19 @@ static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file) ...@@ -216,18 +216,19 @@ static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file)
* memory and creates the pointer tables from them, and puts their * memory and creates the pointer tables from them, and puts their
* addresses on the "stack", returning the new stack pointer value. * addresses on the "stack", returning the new stack pointer value.
*/ */
static u32 * create_aout_tables(char * p, struct linux_binprm * bprm) static u32 __user *create_aout_tables(char __user *p, struct linux_binprm *bprm)
{ {
u32 *argv, *envp; u32 __user *argv;
u32 * sp; u32 __user *envp;
u32 __user *sp;
int argc = bprm->argc; int argc = bprm->argc;
int envc = bprm->envc; int envc = bprm->envc;
sp = (u32 *) ((-(unsigned long)sizeof(u32)) & (unsigned long) p); sp = (u32 __user *) ((-(unsigned long)sizeof(u32)) & (unsigned long) p);
sp -= envc+1; sp -= envc+1;
envp = (u32 *) sp; envp = sp;
sp -= argc+1; sp -= argc+1;
argv = (u32 *) sp; argv = sp;
put_user((unsigned long) envp,--sp); put_user((unsigned long) envp,--sp);
put_user((unsigned long) argv,--sp); put_user((unsigned long) argv,--sp);
put_user(argc,--sp); put_user(argc,--sp);
...@@ -403,7 +404,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) ...@@ -403,7 +404,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
} }
current->mm->start_stack = current->mm->start_stack =
(unsigned long) create_aout_tables((char *) bprm->p, bprm); (unsigned long)create_aout_tables((char __user *)bprm->p, bprm);
/* start thread */ /* start thread */
asm volatile("movl %0,%%fs" :: "r" (0)); \ asm volatile("movl %0,%%fs" :: "r" (0)); \
asm volatile("movl %0,%%es; movl %0,%%ds": :"r" (__USER32_DS)); asm volatile("movl %0,%%es; movl %0,%%ds": :"r" (__USER32_DS));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment