aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/binfmt_elf_fdpic.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index fdeadab2f18..80c1f952ef7 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -470,6 +470,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
470 char __user *u_platform, *p; 470 char __user *u_platform, *p;
471 long hwcap; 471 long hwcap;
472 int loop; 472 int loop;
473 int nr; /* reset for each csp adjustment */
473 474
474 /* we're going to shovel a whole load of stuff onto the stack */ 475 /* we're going to shovel a whole load of stuff onto the stack */
475#ifdef CONFIG_MMU 476#ifdef CONFIG_MMU
@@ -542,10 +543,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
542 /* force 16 byte _final_ alignment here for generality */ 543 /* force 16 byte _final_ alignment here for generality */
543#define DLINFO_ITEMS 13 544#define DLINFO_ITEMS 13
544 545
545 nitems = 1 + DLINFO_ITEMS + (k_platform ? 1 : 0); 546 nitems = 1 + DLINFO_ITEMS + (k_platform ? 1 : 0) + AT_VECTOR_SIZE_ARCH;
546#ifdef DLINFO_ARCH_ITEMS
547 nitems += DLINFO_ARCH_ITEMS;
548#endif
549 547
550 csp = sp; 548 csp = sp;
551 sp -= nitems * 2 * sizeof(unsigned long); 549 sp -= nitems * 2 * sizeof(unsigned long);
@@ -557,39 +555,46 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
557 sp -= sp & 15UL; 555 sp -= sp & 15UL;
558 556
559 /* put the ELF interpreter info on the stack */ 557 /* put the ELF interpreter info on the stack */
560#define NEW_AUX_ENT(nr, id, val) \ 558#define NEW_AUX_ENT(id, val) \
561 do { \ 559 do { \
562 struct { unsigned long _id, _val; } __user *ent; \ 560 struct { unsigned long _id, _val; } __user *ent; \
563 \ 561 \
564 ent = (void __user *) csp; \ 562 ent = (void __user *) csp; \
565 __put_user((id), &ent[nr]._id); \ 563 __put_user((id), &ent[nr]._id); \
566 __put_user((val), &ent[nr]._val); \ 564 __put_user((val), &ent[nr]._val); \
565 nr++; \
567 } while (0) 566 } while (0)
568 567
568 nr = 0;
569 csp -= 2 * sizeof(unsigned long); 569 csp -= 2 * sizeof(unsigned long);
570 NEW_AUX_ENT(0, AT_NULL, 0); 570 NEW_AUX_ENT(AT_NULL, 0);
571 if (k_platform) { 571 if (k_platform) {
572 nr = 0;
572 csp -= 2 * sizeof(unsigned long); 573 csp -= 2 * sizeof(unsigned long);
573 NEW_AUX_ENT(0, AT_PLATFORM, 574 NEW_AUX_ENT(AT_PLATFORM,
574 (elf_addr_t) (unsigned long) u_platform); 575 (elf_addr_t) (unsigned long) u_platform);
575 } 576 }
576 577
578 nr = 0;
577 csp -= DLINFO_ITEMS * 2 * sizeof(unsigned long); 579 csp -= DLINFO_ITEMS * 2 * sizeof(unsigned long);
578 NEW_AUX_ENT( 0, AT_HWCAP, hwcap); 580 NEW_AUX_ENT(AT_HWCAP, hwcap);
579 NEW_AUX_ENT( 1, AT_PAGESZ, PAGE_SIZE); 581 NEW_AUX_ENT(AT_PAGESZ, PAGE_SIZE);
580 NEW_AUX_ENT( 2, AT_CLKTCK, CLOCKS_PER_SEC); 582 NEW_AUX_ENT(AT_CLKTCK, CLOCKS_PER_SEC);
581 NEW_AUX_ENT( 3, AT_PHDR, exec_params->ph_addr); 583 NEW_AUX_ENT(AT_PHDR, exec_params->ph_addr);
582 NEW_AUX_ENT( 4, AT_PHENT, sizeof(struct elf_phdr)); 584 NEW_AUX_ENT(AT_PHENT, sizeof(struct elf_phdr));
583 NEW_AUX_ENT( 5, AT_PHNUM, exec_params->hdr.e_phnum); 585 NEW_AUX_ENT(AT_PHNUM, exec_params->hdr.e_phnum);
584 NEW_AUX_ENT( 6, AT_BASE, interp_params->elfhdr_addr); 586 NEW_AUX_ENT(AT_BASE, interp_params->elfhdr_addr);
585 NEW_AUX_ENT( 7, AT_FLAGS, 0); 587 NEW_AUX_ENT(AT_FLAGS, 0);
586 NEW_AUX_ENT( 8, AT_ENTRY, exec_params->entry_addr); 588 NEW_AUX_ENT(AT_ENTRY, exec_params->entry_addr);
587 NEW_AUX_ENT( 9, AT_UID, (elf_addr_t) current->uid); 589 NEW_AUX_ENT(AT_UID, (elf_addr_t) current->uid);
588 NEW_AUX_ENT(10, AT_EUID, (elf_addr_t) current->euid); 590 NEW_AUX_ENT(AT_EUID, (elf_addr_t) current->euid);
589 NEW_AUX_ENT(11, AT_GID, (elf_addr_t) current->gid); 591 NEW_AUX_ENT(AT_GID, (elf_addr_t) current->gid);
590 NEW_AUX_ENT(12, AT_EGID, (elf_addr_t) current->egid); 592 NEW_AUX_ENT(AT_EGID, (elf_addr_t) current->egid);
591 593
592#ifdef ARCH_DLINFO 594#ifdef ARCH_DLINFO
595 nr = 0;
596 csp -= AT_VECTOR_SIZE_ARCH * 2 * sizeof(unsigned long);
597
593 /* ARCH_DLINFO must come last so platform specific code can enforce 598 /* ARCH_DLINFO must come last so platform specific code can enforce
594 * special alignment requirements on the AUXV if necessary (eg. PPC). 599 * special alignment requirements on the AUXV if necessary (eg. PPC).
595 */ 600 */