Merge tag 'xarray-5.12' of git://git.infradead.org/users/willy/xarray
[linux-2.6-microblaze.git] / fs / binfmt_elf_fdpic.c
index be4062b..3cfd6cd 100644 (file)
@@ -506,6 +506,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
        char __user *u_platform, *u_base_platform, *p;
        int loop;
        int nr; /* reset for each csp adjustment */
+       unsigned long flags = 0;
 
 #ifdef CONFIG_MMU
        /* In some cases (e.g. Hyper-Threading), we want to avoid L1 evictions
@@ -648,7 +649,9 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
        NEW_AUX_ENT(AT_PHENT,   sizeof(struct elf_phdr));
        NEW_AUX_ENT(AT_PHNUM,   exec_params->hdr.e_phnum);
        NEW_AUX_ENT(AT_BASE,    interp_params->elfhdr_addr);
-       NEW_AUX_ENT(AT_FLAGS,   0);
+       if (bprm->interp_flags & BINPRM_FLAGS_PRESERVE_ARGV0)
+               flags |= AT_FLAGS_PRESERVE_ARGV0;
+       NEW_AUX_ENT(AT_FLAGS,   flags);
        NEW_AUX_ENT(AT_ENTRY,   exec_params->entry_addr);
        NEW_AUX_ENT(AT_UID,     (elf_addr_t) from_kuid_munged(cred->user_ns, cred->uid));
        NEW_AUX_ENT(AT_EUID,    (elf_addr_t) from_kuid_munged(cred->user_ns, cred->euid));
@@ -1191,18 +1194,7 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params,
 
 struct elf_prstatus_fdpic
 {
-       struct elf_siginfo pr_info;     /* Info associated with signal */
-       short   pr_cursig;              /* Current signal */
-       unsigned long pr_sigpend;       /* Set of pending signals */
-       unsigned long pr_sighold;       /* Set of held signals */
-       pid_t   pr_pid;
-       pid_t   pr_ppid;
-       pid_t   pr_pgrp;
-       pid_t   pr_sid;
-       struct __kernel_old_timeval pr_utime;   /* User time */
-       struct __kernel_old_timeval pr_stime;   /* System time */
-       struct __kernel_old_timeval pr_cutime;  /* Cumulative user time */
-       struct __kernel_old_timeval pr_cstime;  /* Cumulative system time */
+       struct elf_prstatus_common      common;
        elf_gregset_t pr_reg;   /* GP registers */
        /* When using FDPIC, the loadmap addresses need to be communicated
         * to GDB in order for GDB to do the necessary relocations.  The
@@ -1301,7 +1293,7 @@ static inline void fill_note(struct memelfnote *note, const char *name, int type
  * fill up all the fields in prstatus from the given task struct, except
  * registers which need to be filled up separately.
  */
-static void fill_prstatus(struct elf_prstatus_fdpic *prstatus,
+static void fill_prstatus(struct elf_prstatus_common *prstatus,
                          struct task_struct *p, long signr)
 {
        prstatus->pr_info.si_signo = prstatus->pr_cursig = signr;
@@ -1332,9 +1324,6 @@ static void fill_prstatus(struct elf_prstatus_fdpic *prstatus,
        }
        prstatus->pr_cutime = ns_to_kernel_old_timeval(p->signal->cutime);
        prstatus->pr_cstime = ns_to_kernel_old_timeval(p->signal->cstime);
-
-       prstatus->pr_exec_fdpic_loadmap = p->mm->context.exec_fdpic_loadmap;
-       prstatus->pr_interp_fdpic_loadmap = p->mm->context.interp_fdpic_loadmap;
 }
 
 static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
@@ -1405,7 +1394,9 @@ static struct elf_thread_status *elf_dump_thread_status(long signr, struct task_
        if (!t)
                return t;
 
-       fill_prstatus(&t->prstatus, p, signr);
+       fill_prstatus(&t->prstatus.common, p, signr);
+       t->prstatus.pr_exec_fdpic_loadmap = p->mm->context.exec_fdpic_loadmap;
+       t->prstatus.pr_interp_fdpic_loadmap = p->mm->context.interp_fdpic_loadmap;
        regset_get(p, &view->regsets[0],
                   sizeof(t->prstatus.pr_reg), &t->prstatus.pr_reg);