Commit 530018bf authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

[PATCH] frv: binfmt_elf_fdpic __user annotations

Add __user annotations to binfmt_elf_fdpic.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7ab76d72
...@@ -435,9 +435,10 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm, ...@@ -435,9 +435,10 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
struct elf_fdpic_params *interp_params) struct elf_fdpic_params *interp_params)
{ {
unsigned long sp, csp, nitems; unsigned long sp, csp, nitems;
elf_caddr_t *argv, *envp; elf_caddr_t __user *argv, *envp;
size_t platform_len = 0, len; size_t platform_len = 0, len;
char *k_platform, *u_platform, *p; char *k_platform;
char __user *u_platform, *p;
long hwcap; long hwcap;
int loop; int loop;
...@@ -462,12 +463,11 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm, ...@@ -462,12 +463,11 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
if (k_platform) { if (k_platform) {
platform_len = strlen(k_platform) + 1; platform_len = strlen(k_platform) + 1;
sp -= platform_len; sp -= platform_len;
u_platform = (char __user *) sp;
if (__copy_to_user(u_platform, k_platform, platform_len) != 0) if (__copy_to_user(u_platform, k_platform, platform_len) != 0)
return -EFAULT; return -EFAULT;
} }
u_platform = (char *) sp;
#if defined(__i386__) && defined(CONFIG_SMP) #if defined(__i386__) && defined(CONFIG_SMP)
/* in some cases (e.g. Hyper-Threading), we want to avoid L1 evictions /* in some cases (e.g. Hyper-Threading), we want to avoid L1 evictions
* by the processes running on the same package. One thing we can do * by the processes running on the same package. One thing we can do
...@@ -490,7 +490,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm, ...@@ -490,7 +490,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
sp = (sp - len) & ~7UL; sp = (sp - len) & ~7UL;
exec_params->map_addr = sp; exec_params->map_addr = sp;
if (copy_to_user((void *) sp, exec_params->loadmap, len) != 0) if (copy_to_user((void __user *) sp, exec_params->loadmap, len) != 0)
return -EFAULT; return -EFAULT;
current->mm->context.exec_fdpic_loadmap = (unsigned long) sp; current->mm->context.exec_fdpic_loadmap = (unsigned long) sp;
...@@ -501,7 +501,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm, ...@@ -501,7 +501,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
sp = (sp - len) & ~7UL; sp = (sp - len) & ~7UL;
interp_params->map_addr = sp; interp_params->map_addr = sp;
if (copy_to_user((void *) sp, interp_params->loadmap, len) != 0) if (copy_to_user((void __user *) sp, interp_params->loadmap, len) != 0)
return -EFAULT; return -EFAULT;
current->mm->context.interp_fdpic_loadmap = (unsigned long) sp; current->mm->context.interp_fdpic_loadmap = (unsigned long) sp;
...@@ -527,7 +527,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm, ...@@ -527,7 +527,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
/* put the ELF interpreter info on the stack */ /* put the ELF interpreter info on the stack */
#define NEW_AUX_ENT(nr, id, val) \ #define NEW_AUX_ENT(nr, id, val) \
do { \ do { \
struct { unsigned long _id, _val; } *ent = (void *) csp; \ struct { unsigned long _id, _val; } __user *ent = (void __user *) csp; \
__put_user((id), &ent[nr]._id); \ __put_user((id), &ent[nr]._id); \
__put_user((val), &ent[nr]._val); \ __put_user((val), &ent[nr]._val); \
} while (0) } while (0)
...@@ -564,13 +564,13 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm, ...@@ -564,13 +564,13 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
/* allocate room for argv[] and envv[] */ /* allocate room for argv[] and envv[] */
csp -= (bprm->envc + 1) * sizeof(elf_caddr_t); csp -= (bprm->envc + 1) * sizeof(elf_caddr_t);
envp = (elf_caddr_t *) csp; envp = (elf_caddr_t __user *) csp;
csp -= (bprm->argc + 1) * sizeof(elf_caddr_t); csp -= (bprm->argc + 1) * sizeof(elf_caddr_t);
argv = (elf_caddr_t *) csp; argv = (elf_caddr_t __user *) csp;
/* stack argc */ /* stack argc */
csp -= sizeof(unsigned long); csp -= sizeof(unsigned long);
__put_user(bprm->argc, (unsigned long *) csp); __put_user(bprm->argc, (unsigned long __user *) csp);
BUG_ON(csp != sp); BUG_ON(csp != sp);
...@@ -581,7 +581,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm, ...@@ -581,7 +581,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
current->mm->arg_start = current->mm->start_stack - (MAX_ARG_PAGES * PAGE_SIZE - bprm->p); current->mm->arg_start = current->mm->start_stack - (MAX_ARG_PAGES * PAGE_SIZE - bprm->p);
#endif #endif
p = (char *) current->mm->arg_start; p = (char __user *) current->mm->arg_start;
for (loop = bprm->argc; loop > 0; loop--) { for (loop = bprm->argc; loop > 0; loop--) {
__put_user((elf_caddr_t) p, argv++); __put_user((elf_caddr_t) p, argv++);
len = strnlen_user(p, PAGE_SIZE * MAX_ARG_PAGES); len = strnlen_user(p, PAGE_SIZE * MAX_ARG_PAGES);
...@@ -1025,7 +1025,7 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params, ...@@ -1025,7 +1025,7 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params,
/* clear the bit between beginning of mapping and beginning of PT_LOAD */ /* clear the bit between beginning of mapping and beginning of PT_LOAD */
if (prot & PROT_WRITE && disp > 0) { if (prot & PROT_WRITE && disp > 0) {
kdebug("clear[%d] ad=%lx sz=%lx", loop, maddr, disp); kdebug("clear[%d] ad=%lx sz=%lx", loop, maddr, disp);
clear_user((void *) maddr, disp); clear_user((void __user *) maddr, disp);
maddr += disp; maddr += disp;
} }
...@@ -1059,7 +1059,7 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params, ...@@ -1059,7 +1059,7 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params,
if (prot & PROT_WRITE && excess1 > 0) { if (prot & PROT_WRITE && excess1 > 0) {
kdebug("clear[%d] ad=%lx sz=%lx", kdebug("clear[%d] ad=%lx sz=%lx",
loop, maddr + phdr->p_filesz, excess1); loop, maddr + phdr->p_filesz, excess1);
clear_user((void *) maddr + phdr->p_filesz, excess1); clear_user((void __user *) maddr + phdr->p_filesz, excess1);
} }
#else #else
......
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