aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/fs/exec.c b/fs/exec.c
index d993ea1a81ae..11fe93f7363c 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -38,6 +38,7 @@
38#include <linux/binfmts.h> 38#include <linux/binfmts.h>
39#include <linux/swap.h> 39#include <linux/swap.h>
40#include <linux/utsname.h> 40#include <linux/utsname.h>
41#include <linux/pid_namespace.h>
41#include <linux/module.h> 42#include <linux/module.h>
42#include <linux/namei.h> 43#include <linux/namei.h>
43#include <linux/proc_fs.h> 44#include <linux/proc_fs.h>
@@ -404,7 +405,7 @@ int setup_arg_pages(struct linux_binprm *bprm,
404 bprm->loader += stack_base; 405 bprm->loader += stack_base;
405 bprm->exec += stack_base; 406 bprm->exec += stack_base;
406 407
407 mpnt = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); 408 mpnt = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL);
408 if (!mpnt) 409 if (!mpnt)
409 return -ENOMEM; 410 return -ENOMEM;
410 411
@@ -620,8 +621,8 @@ static int de_thread(struct task_struct *tsk)
620 * Reparenting needs write_lock on tasklist_lock, 621 * Reparenting needs write_lock on tasklist_lock,
621 * so it is safe to do it under read_lock. 622 * so it is safe to do it under read_lock.
622 */ 623 */
623 if (unlikely(tsk->group_leader == child_reaper)) 624 if (unlikely(tsk->group_leader == child_reaper(tsk)))
624 child_reaper = tsk; 625 tsk->nsproxy->pid_ns->child_reaper = tsk;
625 626
626 zap_other_threads(tsk); 627 zap_other_threads(tsk);
627 read_unlock(&tasklist_lock); 628 read_unlock(&tasklist_lock);
@@ -782,7 +783,7 @@ static void flush_old_files(struct files_struct * files)
782 j++; 783 j++;
783 i = j * __NFDBITS; 784 i = j * __NFDBITS;
784 fdt = files_fdtable(files); 785 fdt = files_fdtable(files);
785 if (i >= fdt->max_fds || i >= fdt->max_fdset) 786 if (i >= fdt->max_fds)
786 break; 787 break;
787 set = fdt->close_on_exec->fds_bits[j]; 788 set = fdt->close_on_exec->fds_bits[j];
788 if (!set) 789 if (!set)
@@ -912,7 +913,7 @@ EXPORT_SYMBOL(flush_old_exec);
912int prepare_binprm(struct linux_binprm *bprm) 913int prepare_binprm(struct linux_binprm *bprm)
913{ 914{
914 int mode; 915 int mode;
915 struct inode * inode = bprm->file->f_dentry->d_inode; 916 struct inode * inode = bprm->file->f_path.dentry->d_inode;
916 int retval; 917 int retval;
917 918
918 mode = inode->i_mode; 919 mode = inode->i_mode;
@@ -922,7 +923,7 @@ int prepare_binprm(struct linux_binprm *bprm)
922 bprm->e_uid = current->euid; 923 bprm->e_uid = current->euid;
923 bprm->e_gid = current->egid; 924 bprm->e_gid = current->egid;
924 925
925 if(!(bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID)) { 926 if(!(bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID)) {
926 /* Set-uid? */ 927 /* Set-uid? */
927 if (mode & S_ISUID) { 928 if (mode & S_ISUID) {
928 current->personality &= ~PER_CLEAR_ON_SETID; 929 current->personality &= ~PER_CLEAR_ON_SETID;
@@ -1515,13 +1516,14 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
1515 ispipe = 1; 1516 ispipe = 1;
1516 } else 1517 } else
1517 file = filp_open(corename, 1518 file = filp_open(corename,
1518 O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE, 0600); 1519 O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE | flag,
1520 0600);
1519 if (IS_ERR(file)) 1521 if (IS_ERR(file))
1520 goto fail_unlock; 1522 goto fail_unlock;
1521 inode = file->f_dentry->d_inode; 1523 inode = file->f_path.dentry->d_inode;
1522 if (inode->i_nlink > 1) 1524 if (inode->i_nlink > 1)
1523 goto close_fail; /* multiple links - don't dump */ 1525 goto close_fail; /* multiple links - don't dump */
1524 if (!ispipe && d_unhashed(file->f_dentry)) 1526 if (!ispipe && d_unhashed(file->f_path.dentry))
1525 goto close_fail; 1527 goto close_fail;
1526 1528
1527 /* AK: actually i see no reason to not allow this for named pipes etc., 1529 /* AK: actually i see no reason to not allow this for named pipes etc.,
@@ -1532,7 +1534,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
1532 goto close_fail; 1534 goto close_fail;
1533 if (!file->f_op->write) 1535 if (!file->f_op->write)
1534 goto close_fail; 1536 goto close_fail;
1535 if (!ispipe && do_truncate(file->f_dentry, 0, 0, file) != 0) 1537 if (!ispipe && do_truncate(file->f_path.dentry, 0, 0, file) != 0)
1536 goto close_fail; 1538 goto close_fail;
1537 1539
1538 retval = binfmt->core_dump(signr, regs, file); 1540 retval = binfmt->core_dump(signr, regs, file);