aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/binfmt_elf_fdpic.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index a2e48c999c24..eba4e23b9ca0 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -435,9 +435,10 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
435 struct elf_fdpic_params *interp_params) 435 struct elf_fdpic_params *interp_params)
436{ 436{
437 unsigned long sp, csp, nitems; 437 unsigned long sp, csp, nitems;
438 elf_caddr_t *argv, *envp; 438 elf_caddr_t __user *argv, *envp;
439 size_t platform_len = 0, len; 439 size_t platform_len = 0, len;
440 char *k_platform, *u_platform, *p; 440 char *k_platform;
441 char __user *u_platform, *p;
441 long hwcap; 442 long hwcap;
442 int loop; 443 int loop;
443 444
@@ -462,12 +463,11 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
462 if (k_platform) { 463 if (k_platform) {
463 platform_len = strlen(k_platform) + 1; 464 platform_len = strlen(k_platform) + 1;
464 sp -= platform_len; 465 sp -= platform_len;
466 u_platform = (char __user *) sp;
465 if (__copy_to_user(u_platform, k_platform, platform_len) != 0) 467 if (__copy_to_user(u_platform, k_platform, platform_len) != 0)
466 return -EFAULT; 468 return -EFAULT;
467 } 469 }
468 470
469 u_platform = (char *) sp;
470
471#if defined(__i386__) && defined(CONFIG_SMP) 471#if defined(__i386__) && defined(CONFIG_SMP)
472 /* in some cases (e.g. Hyper-Threading), we want to avoid L1 evictions 472 /* in some cases (e.g. Hyper-Threading), we want to avoid L1 evictions
473 * by the processes running on the same package. One thing we can do 473 * 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 sp = (sp - len) & ~7UL; 490 sp = (sp - len) & ~7UL;
491 exec_params->map_addr = sp; 491 exec_params->map_addr = sp;
492 492
493 if (copy_to_user((void *) sp, exec_params->loadmap, len) != 0) 493 if (copy_to_user((void __user *) sp, exec_params->loadmap, len) != 0)
494 return -EFAULT; 494 return -EFAULT;
495 495
496 current->mm->context.exec_fdpic_loadmap = (unsigned long) sp; 496 current->mm->context.exec_fdpic_loadmap = (unsigned long) sp;
@@ -501,7 +501,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
501 sp = (sp - len) & ~7UL; 501 sp = (sp - len) & ~7UL;
502 interp_params->map_addr = sp; 502 interp_params->map_addr = sp;
503 503
504 if (copy_to_user((void *) sp, interp_params->loadmap, len) != 0) 504 if (copy_to_user((void __user *) sp, interp_params->loadmap, len) != 0)
505 return -EFAULT; 505 return -EFAULT;
506 506
507 current->mm->context.interp_fdpic_loadmap = (unsigned long) sp; 507 current->mm->context.interp_fdpic_loadmap = (unsigned long) sp;
@@ -527,7 +527,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
527 /* put the ELF interpreter info on the stack */ 527 /* put the ELF interpreter info on the stack */
528#define NEW_AUX_ENT(nr, id, val) \ 528#define NEW_AUX_ENT(nr, id, val) \
529 do { \ 529 do { \
530 struct { unsigned long _id, _val; } *ent = (void *) csp; \ 530 struct { unsigned long _id, _val; } __user *ent = (void __user *) csp; \
531 __put_user((id), &ent[nr]._id); \ 531 __put_user((id), &ent[nr]._id); \
532 __put_user((val), &ent[nr]._val); \ 532 __put_user((val), &ent[nr]._val); \
533 } while (0) 533 } while (0)
@@ -564,13 +564,13 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
564 564
565 /* allocate room for argv[] and envv[] */ 565 /* allocate room for argv[] and envv[] */
566 csp -= (bprm->envc + 1) * sizeof(elf_caddr_t); 566 csp -= (bprm->envc + 1) * sizeof(elf_caddr_t);
567 envp = (elf_caddr_t *) csp; 567 envp = (elf_caddr_t __user *) csp;
568 csp -= (bprm->argc + 1) * sizeof(elf_caddr_t); 568 csp -= (bprm->argc + 1) * sizeof(elf_caddr_t);
569 argv = (elf_caddr_t *) csp; 569 argv = (elf_caddr_t __user *) csp;
570 570
571 /* stack argc */ 571 /* stack argc */
572 csp -= sizeof(unsigned long); 572 csp -= sizeof(unsigned long);
573 __put_user(bprm->argc, (unsigned long *) csp); 573 __put_user(bprm->argc, (unsigned long __user *) csp);
574 574
575 BUG_ON(csp != sp); 575 BUG_ON(csp != sp);
576 576
@@ -581,7 +581,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
581 current->mm->arg_start = current->mm->start_stack - (MAX_ARG_PAGES * PAGE_SIZE - bprm->p); 581 current->mm->arg_start = current->mm->start_stack - (MAX_ARG_PAGES * PAGE_SIZE - bprm->p);
582#endif 582#endif
583 583
584 p = (char *) current->mm->arg_start; 584 p = (char __user *) current->mm->arg_start;
585 for (loop = bprm->argc; loop > 0; loop--) { 585 for (loop = bprm->argc; loop > 0; loop--) {
586 __put_user((elf_caddr_t) p, argv++); 586 __put_user((elf_caddr_t) p, argv++);
587 len = strnlen_user(p, PAGE_SIZE * MAX_ARG_PAGES); 587 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 /* clear the bit between beginning of mapping and beginning of PT_LOAD */ 1025 /* clear the bit between beginning of mapping and beginning of PT_LOAD */
1026 if (prot & PROT_WRITE && disp > 0) { 1026 if (prot & PROT_WRITE && disp > 0) {
1027 kdebug("clear[%d] ad=%lx sz=%lx", loop, maddr, disp); 1027 kdebug("clear[%d] ad=%lx sz=%lx", loop, maddr, disp);
1028 clear_user((void *) maddr, disp); 1028 clear_user((void __user *) maddr, disp);
1029 maddr += disp; 1029 maddr += disp;
1030 } 1030 }
1031 1031
@@ -1059,7 +1059,7 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params,
1059 if (prot & PROT_WRITE && excess1 > 0) { 1059 if (prot & PROT_WRITE && excess1 > 0) {
1060 kdebug("clear[%d] ad=%lx sz=%lx", 1060 kdebug("clear[%d] ad=%lx sz=%lx",
1061 loop, maddr + phdr->p_filesz, excess1); 1061 loop, maddr + phdr->p_filesz, excess1);
1062 clear_user((void *) maddr + phdr->p_filesz, excess1); 1062 clear_user((void __user *) maddr + phdr->p_filesz, excess1);
1063 } 1063 }
1064 1064
1065#else 1065#else