]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/binfmt_elf.c
ntfs: Convert to new freezing mechanism
[karo-tx-linux.git] / fs / binfmt_elf.c
index 16f7354170725e050e69bf971aeb63eb57598c3e..1b52956afe33ab07889c3963ce2c41b32133483b 100644 (file)
@@ -226,10 +226,10 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
        NEW_AUX_ENT(AT_BASE, interp_load_addr);
        NEW_AUX_ENT(AT_FLAGS, 0);
        NEW_AUX_ENT(AT_ENTRY, exec->e_entry);
-       NEW_AUX_ENT(AT_UID, cred->uid);
-       NEW_AUX_ENT(AT_EUID, cred->euid);
-       NEW_AUX_ENT(AT_GID, cred->gid);
-       NEW_AUX_ENT(AT_EGID, cred->egid);
+       NEW_AUX_ENT(AT_UID, from_kuid_munged(cred->user_ns, cred->uid));
+       NEW_AUX_ENT(AT_EUID, from_kuid_munged(cred->user_ns, cred->euid));
+       NEW_AUX_ENT(AT_GID, from_kgid_munged(cred->user_ns, cred->gid));
+       NEW_AUX_ENT(AT_EGID, from_kgid_munged(cred->user_ns, cred->egid));
        NEW_AUX_ENT(AT_SECURE, security_bprm_secureexec(bprm));
        NEW_AUX_ENT(AT_RANDOM, (elf_addr_t)(unsigned long)u_rand_bytes);
        NEW_AUX_ENT(AT_EXECFN, bprm->exec);
@@ -329,7 +329,6 @@ static unsigned long elf_map(struct file *filep, unsigned long addr,
        if (!size)
                return addr;
 
-       down_write(&current->mm->mmap_sem);
        /*
        * total_size is the size of the ELF (interpreter) image.
        * The _first_ mmap needs to know the full size, otherwise
@@ -340,13 +339,12 @@ static unsigned long elf_map(struct file *filep, unsigned long addr,
        */
        if (total_size) {
                total_size = ELF_PAGEALIGN(total_size);
-               map_addr = do_mmap(filep, addr, total_size, prot, type, off);
+               map_addr = vm_mmap(filep, addr, total_size, prot, type, off);
                if (!BAD_ADDR(map_addr))
-                       do_munmap(current->mm, map_addr+size, total_size-size);
+                       vm_munmap(map_addr+size, total_size-size);
        } else
-               map_addr = do_mmap(filep, addr, size, prot, type, off);
+               map_addr = vm_mmap(filep, addr, size, prot, type, off);
 
-       up_write(&current->mm->mmap_sem);
        return(map_addr);
 }
 
@@ -1356,8 +1354,8 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
        psinfo->pr_flag = p->flags;
        rcu_read_lock();
        cred = __task_cred(p);
-       SET_UID(psinfo->pr_uid, cred->uid);
-       SET_GID(psinfo->pr_gid, cred->gid);
+       SET_UID(psinfo->pr_uid, from_kuid_munged(cred->user_ns, cred->uid));
+       SET_GID(psinfo->pr_gid, from_kgid_munged(cred->user_ns, cred->gid));
        rcu_read_unlock();
        strncpy(psinfo->pr_fname, p->comm, sizeof(psinfo->pr_fname));