]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/binfmt_elf_fdpic.c
[SCSI] 3w-xxxx: remove unnecessary local_irq_save/restore for scsi sg copy API
[linux-2.6-omap-h63xx.git] / fs / binfmt_elf_fdpic.c
index e4eb472558ca33f5944f3285b79588de239c7d6f..0e8367c546248987418191c6ab7b14c5be61bec9 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/fcntl.h>
 #include <linux/slab.h>
 #include <linux/pagemap.h>
+#include <linux/security.h>
 #include <linux/highmem.h>
 #include <linux/highuid.h>
 #include <linux/personality.h>
@@ -466,7 +467,8 @@ error_kill:
 #endif
 
 /*
- * present useful information to the program
+ * present useful information to the program by shovelling it onto the new
+ * process's stack
  */
 static int create_elf_fdpic_tables(struct linux_binprm *bprm,
                                   struct mm_struct *mm,
@@ -482,9 +484,13 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
        int loop;
        int nr; /* reset for each csp adjustment */
 
-       /* we're going to shovel a whole load of stuff onto the stack */
 #ifdef CONFIG_MMU
-       sp = bprm->p;
+       /* 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 is
+        * to shuffle the initial stack for them, so we give the architecture
+        * an opportunity to do so here.
+        */
+       sp = arch_align_stack(bprm->p);
 #else
        sp = mm->start_stack;
 
@@ -527,20 +533,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
                        return -EFAULT;
        }
 
-#if defined(__i386__) && defined(CONFIG_SMP)
-       /* 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 is
-        * to shuffle the initial stack for them.
-        *
-        * the conditionals here are unneeded, but kept in to make the code
-        * behaviour the same as pre change unless we have hyperthreaded
-        * processors. This keeps Mr Marcelo Person happier but should be
-        * removed for 2.5
-        */
-       if (smp_num_siblings > 1)
-               sp = sp - ((current->pid % 64) << 7);
-#endif
-
        sp &= ~7UL;
 
        /* stack the load map(s) */
@@ -569,11 +561,14 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
        }
 
        /* force 16 byte _final_ alignment here for generality */
-#define DLINFO_ITEMS 13
+#define DLINFO_ITEMS 15
 
        nitems = 1 + DLINFO_ITEMS + (k_platform ? 1 : 0) +
                (k_base_platform ? 1 : 0) + AT_VECTOR_SIZE_ARCH;
 
+       if (bprm->interp_flags & BINPRM_FLAGS_EXECFD)
+               nitems++;
+
        csp = sp;
        sp -= nitems * 2 * sizeof(unsigned long);
        sp -= (bprm->envc + 1) * sizeof(char *);        /* envv[] */
@@ -611,6 +606,12 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
                            (elf_addr_t) (unsigned long) u_base_platform);
        }
 
+       if (bprm->interp_flags & BINPRM_FLAGS_EXECFD) {
+               nr = 0;
+               csp -= 2 * sizeof(unsigned long);
+               NEW_AUX_ENT(AT_EXECFD, bprm->interp_data);
+       }
+
        nr = 0;
        csp -= DLINFO_ITEMS * 2 * sizeof(unsigned long);
        NEW_AUX_ENT(AT_HWCAP,   hwcap);
@@ -626,6 +627,8 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
        NEW_AUX_ENT(AT_EUID,    (elf_addr_t) current->euid);
        NEW_AUX_ENT(AT_GID,     (elf_addr_t) current->gid);
        NEW_AUX_ENT(AT_EGID,    (elf_addr_t) current->egid);
+       NEW_AUX_ENT(AT_SECURE,  security_bprm_secureexec(bprm));
+       NEW_AUX_ENT(AT_EXECFN,  bprm->exec);
 
 #ifdef ARCH_DLINFO
        nr = 0;