Merge branch 'work.set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux-2.6-microblaze.git] / fs / binfmt_elf_fdpic.c
index ffca4bb..e70c039 100644 (file)
@@ -15,6 +15,9 @@
 #include <linux/fs.h>
 #include <linux/stat.h>
 #include <linux/sched.h>
+#include <linux/sched/coredump.h>
+#include <linux/sched/task_stack.h>
+#include <linux/sched/cputime.h>
 #include <linux/mm.h>
 #include <linux/mman.h>
 #include <linux/errno.h>
@@ -142,6 +145,7 @@ static int elf_fdpic_fetch_phdrs(struct elf_fdpic_params *params,
        struct elf32_phdr *phdr;
        unsigned long size;
        int retval, loop;
+       loff_t pos = params->hdr.e_phoff;
 
        if (params->hdr.e_phentsize != sizeof(struct elf_phdr))
                return -ENOMEM;
@@ -153,8 +157,7 @@ static int elf_fdpic_fetch_phdrs(struct elf_fdpic_params *params,
        if (!params->phdrs)
                return -ENOMEM;
 
-       retval = kernel_read(file, params->hdr.e_phoff,
-                            (char *) params->phdrs, size);
+       retval = kernel_read(file, params->phdrs, size, &pos);
        if (unlikely(retval != size))
                return retval < 0 ? retval : -ENOEXEC;
 
@@ -196,6 +199,7 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm)
        char *interpreter_name = NULL;
        int executable_stack;
        int retval, i;
+       loff_t pos;
 
        kdebug("____ LOAD %d ____", current->pid);
 
@@ -243,10 +247,9 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm)
                        if (!interpreter_name)
                                goto error;
 
-                       retval = kernel_read(bprm->file,
-                                            phdr->p_offset,
-                                            interpreter_name,
-                                            phdr->p_filesz);
+                       pos = phdr->p_offset;
+                       retval = kernel_read(bprm->file, interpreter_name,
+                                            phdr->p_filesz, &pos);
                        if (unlikely(retval != phdr->p_filesz)) {
                                if (retval >= 0)
                                        retval = -ENOEXEC;
@@ -274,8 +277,9 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm)
                         */
                        would_dump(bprm, interpreter);
 
-                       retval = kernel_read(interpreter, 0, bprm->buf,
-                                            BINPRM_BUF_SIZE);
+                       pos = 0;
+                       retval = kernel_read(interpreter, bprm->buf,
+                                       BINPRM_BUF_SIZE, &pos);
                        if (unlikely(retval != BINPRM_BUF_SIZE)) {
                                if (retval >= 0)
                                        retval = -ENOEXEC;
@@ -647,7 +651,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
        NEW_AUX_ENT(AT_EUID,    (elf_addr_t) from_kuid_munged(cred->user_ns, cred->euid));
        NEW_AUX_ENT(AT_GID,     (elf_addr_t) from_kgid_munged(cred->user_ns, cred->gid));
        NEW_AUX_ENT(AT_EGID,    (elf_addr_t) from_kgid_munged(cred->user_ns, cred->egid));
-       NEW_AUX_ENT(AT_SECURE,  security_bprm_secureexec(bprm));
+       NEW_AUX_ENT(AT_SECURE,  bprm->secureexec);
        NEW_AUX_ENT(AT_EXECFN,  bprm->exec);
 
 #ifdef ARCH_DLINFO