X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fexec.c;h=284207a1f1c7d8021d591bbbc0391b60a0b88335;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=d84bd1610a26c2fdbb73cc7befd26edd7653dcda;hpb=db216c3d5e4c040e557a50f8f5d35d5c415e8c1c;p=linux-2.6.git diff --git a/fs/exec.c b/fs/exec.c index d84bd1610..284207a1f 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -46,9 +46,9 @@ #include #include #include +#include #include -#include #include #ifdef CONFIG_KMOD @@ -433,6 +433,7 @@ int setup_arg_pages(struct linux_binprm *bprm, int executable_stack) mpnt->vm_flags = VM_STACK_FLAGS & ~VM_EXEC; else mpnt->vm_flags = VM_STACK_FLAGS; + mpnt->vm_flags |= mm->def_flags; mpnt->vm_page_prot = protection_map[mpnt->vm_flags & 0x7]; insert_vm_struct(mm, mpnt); // mm->total_vm = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT; @@ -843,7 +844,8 @@ int flush_old_exec(struct linux_binprm * bprm) flush_thread(); if (bprm->e_uid != current->euid || bprm->e_gid != current->egid || - permission(bprm->file->f_dentry->d_inode,MAY_READ, NULL)) + permission(bprm->file->f_dentry->d_inode,MAY_READ, NULL) || + (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) current->mm->dumpable = 0; /* An exec changes our domain. We are no longer part of the thread @@ -890,8 +892,10 @@ int prepare_binprm(struct linux_binprm *bprm) if(!(bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID)) { /* Set-uid? */ - if (mode & S_ISUID) + if (mode & S_ISUID) { + current->personality &= ~PER_CLEAR_ON_SETID; bprm->e_uid = inode->i_uid; + } /* Set-gid? */ /* @@ -899,8 +903,10 @@ int prepare_binprm(struct linux_binprm *bprm) * is a candidate for mandatory locking, not a setgid * executable. */ - if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) + if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) { + current->personality &= ~PER_CLEAR_ON_SETID; bprm->e_gid = inode->i_gid; + } } /* fill in binprm security blob */ @@ -1092,6 +1098,8 @@ int do_execve(char * filename, bprm.file = file; bprm.filename = filename; bprm.interp = filename; + bprm.interp_flags = 0; + bprm.interp_data = 0; bprm.sh_bang = 0; bprm.loader = 0; bprm.exec = 0;