aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 632b02e34ec7..0790a107ff7e 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -941,9 +941,7 @@ void set_task_comm(struct task_struct *tsk, char *buf)
941 941
942int flush_old_exec(struct linux_binprm * bprm) 942int flush_old_exec(struct linux_binprm * bprm)
943{ 943{
944 char * name; 944 int retval;
945 int i, ch, retval;
946 char tcomm[sizeof(current->comm)];
947 945
948 /* 946 /*
949 * Make sure we have a private signal table and that 947 * Make sure we have a private signal table and that
@@ -964,6 +962,25 @@ int flush_old_exec(struct linux_binprm * bprm)
964 962
965 bprm->mm = NULL; /* We're using it now */ 963 bprm->mm = NULL; /* We're using it now */
966 964
965 current->flags &= ~PF_RANDOMIZE;
966 flush_thread();
967 current->personality &= ~bprm->per_clear;
968
969 return 0;
970
971out:
972 return retval;
973}
974EXPORT_SYMBOL(flush_old_exec);
975
976void setup_new_exec(struct linux_binprm * bprm)
977{
978 int i, ch;
979 char * name;
980 char tcomm[sizeof(current->comm)];
981
982 arch_pick_mmap_layout(current->mm);
983
967 /* This is the point of no return */ 984 /* This is the point of no return */
968 current->sas_ss_sp = current->sas_ss_size = 0; 985 current->sas_ss_sp = current->sas_ss_size = 0;
969 986
@@ -985,9 +1002,6 @@ int flush_old_exec(struct linux_binprm * bprm)
985 tcomm[i] = '\0'; 1002 tcomm[i] = '\0';
986 set_task_comm(current, tcomm); 1003 set_task_comm(current, tcomm);
987 1004
988 current->flags &= ~PF_RANDOMIZE;
989 flush_thread();
990
991 /* Set the new mm task size. We have to do that late because it may 1005 /* Set the new mm task size. We have to do that late because it may
992 * depend on TIF_32BIT which is only updated in flush_thread() on 1006 * depend on TIF_32BIT which is only updated in flush_thread() on
993 * some architectures like powerpc 1007 * some architectures like powerpc
@@ -1003,8 +1017,6 @@ int flush_old_exec(struct linux_binprm * bprm)
1003 set_dumpable(current->mm, suid_dumpable); 1017 set_dumpable(current->mm, suid_dumpable);
1004 } 1018 }
1005 1019
1006 current->personality &= ~bprm->per_clear;
1007
1008 /* 1020 /*
1009 * Flush performance counters when crossing a 1021 * Flush performance counters when crossing a
1010 * security domain: 1022 * security domain:
@@ -1019,14 +1031,8 @@ int flush_old_exec(struct linux_binprm * bprm)
1019 1031
1020 flush_signal_handlers(current, 0); 1032 flush_signal_handlers(current, 0);
1021 flush_old_files(current->files); 1033 flush_old_files(current->files);
1022
1023 return 0;
1024
1025out:
1026 return retval;
1027} 1034}
1028 1035EXPORT_SYMBOL(setup_new_exec);
1029EXPORT_SYMBOL(flush_old_exec);
1030 1036
1031/* 1037/*
1032 * Prepare credentials and lock ->cred_guard_mutex. 1038 * Prepare credentials and lock ->cred_guard_mutex.