exec.c (a5a64498c194c82ecad3a2d67cff6231cda8d3dd) | exec.c (da9592edebceeba1b9301beafe80ec8b9c2db0ce) |
---|---|
1/* 2 * linux/fs/exec.c 3 * 4 * Copyright (C) 1991, 1992 Linus Torvalds 5 */ 6 7/* 8 * #!-checking implemented by tytso. --- 966 unchanged lines hidden (view full) --- 975 if (retval) 976 goto out; 977 978 bprm->mm = NULL; /* We're using it now */ 979 980 /* This is the point of no return */ 981 current->sas_ss_sp = current->sas_ss_size = 0; 982 | 1/* 2 * linux/fs/exec.c 3 * 4 * Copyright (C) 1991, 1992 Linus Torvalds 5 */ 6 7/* 8 * #!-checking implemented by tytso. --- 966 unchanged lines hidden (view full) --- 975 if (retval) 976 goto out; 977 978 bprm->mm = NULL; /* We're using it now */ 979 980 /* This is the point of no return */ 981 current->sas_ss_sp = current->sas_ss_size = 0; 982 |
983 if (current->euid == current->uid && current->egid == current->gid) | 983 if (current_euid() == current_uid() && current_egid() == current_gid()) |
984 set_dumpable(current->mm, 1); 985 else 986 set_dumpable(current->mm, suid_dumpable); 987 988 name = bprm->filename; 989 990 /* Copies the binary name from after last slash */ 991 for (i=0; (ch = *(name++)) != '\0';) { --- 10 unchanged lines hidden (view full) --- 1002 flush_thread(); 1003 1004 /* Set the new mm task size. We have to do that late because it may 1005 * depend on TIF_32BIT which is only updated in flush_thread() on 1006 * some architectures like powerpc 1007 */ 1008 current->mm->task_size = TASK_SIZE; 1009 | 984 set_dumpable(current->mm, 1); 985 else 986 set_dumpable(current->mm, suid_dumpable); 987 988 name = bprm->filename; 989 990 /* Copies the binary name from after last slash */ 991 for (i=0; (ch = *(name++)) != '\0';) { --- 10 unchanged lines hidden (view full) --- 1002 flush_thread(); 1003 1004 /* Set the new mm task size. We have to do that late because it may 1005 * depend on TIF_32BIT which is only updated in flush_thread() on 1006 * some architectures like powerpc 1007 */ 1008 current->mm->task_size = TASK_SIZE; 1009 |
1010 if (bprm->e_uid != current->euid || bprm->e_gid != current->egid) { | 1010 if (bprm->e_uid != current_euid() || bprm->e_gid != current_egid()) { |
1011 suid_keys(current); 1012 set_dumpable(current->mm, suid_dumpable); 1013 current->pdeath_signal = 0; 1014 } else if (file_permission(bprm->file, MAY_READ) || 1015 (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) { 1016 suid_keys(current); 1017 set_dumpable(current->mm, suid_dumpable); 1018 } --- 23 unchanged lines hidden (view full) --- 1042 int mode; 1043 struct inode * inode = bprm->file->f_path.dentry->d_inode; 1044 int retval; 1045 1046 mode = inode->i_mode; 1047 if (bprm->file->f_op == NULL) 1048 return -EACCES; 1049 | 1011 suid_keys(current); 1012 set_dumpable(current->mm, suid_dumpable); 1013 current->pdeath_signal = 0; 1014 } else if (file_permission(bprm->file, MAY_READ) || 1015 (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) { 1016 suid_keys(current); 1017 set_dumpable(current->mm, suid_dumpable); 1018 } --- 23 unchanged lines hidden (view full) --- 1042 int mode; 1043 struct inode * inode = bprm->file->f_path.dentry->d_inode; 1044 int retval; 1045 1046 mode = inode->i_mode; 1047 if (bprm->file->f_op == NULL) 1048 return -EACCES; 1049 |
1050 bprm->e_uid = current->euid; 1051 bprm->e_gid = current->egid; | 1050 bprm->e_uid = current_euid(); 1051 bprm->e_gid = current_egid(); |
1052 1053 if(!(bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID)) { 1054 /* Set-uid? */ 1055 if (mode & S_ISUID) { 1056 current->personality &= ~PER_CLEAR_ON_SETID; 1057 bprm->e_uid = inode->i_uid; 1058 } 1059 --- 31 unchanged lines hidden (view full) --- 1091 1092 return unsafe; 1093} 1094 1095void compute_creds(struct linux_binprm *bprm) 1096{ 1097 int unsafe; 1098 | 1052 1053 if(!(bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID)) { 1054 /* Set-uid? */ 1055 if (mode & S_ISUID) { 1056 current->personality &= ~PER_CLEAR_ON_SETID; 1057 bprm->e_uid = inode->i_uid; 1058 } 1059 --- 31 unchanged lines hidden (view full) --- 1091 1092 return unsafe; 1093} 1094 1095void compute_creds(struct linux_binprm *bprm) 1096{ 1097 int unsafe; 1098 |
1099 if (bprm->e_uid != current->uid) { | 1099 if (bprm->e_uid != current_uid()) { |
1100 suid_keys(current); 1101 current->pdeath_signal = 0; 1102 } 1103 exec_keys(current); 1104 1105 task_lock(current); 1106 unsafe = unsafe_exec(current); 1107 security_bprm_apply_creds(bprm, unsafe); --- 311 unchanged lines hidden (view full) --- 1419 "%d", task_tgid_vnr(current)); 1420 if (rc > out_end - out_ptr) 1421 goto out; 1422 out_ptr += rc; 1423 break; 1424 /* uid */ 1425 case 'u': 1426 rc = snprintf(out_ptr, out_end - out_ptr, | 1100 suid_keys(current); 1101 current->pdeath_signal = 0; 1102 } 1103 exec_keys(current); 1104 1105 task_lock(current); 1106 unsafe = unsafe_exec(current); 1107 security_bprm_apply_creds(bprm, unsafe); --- 311 unchanged lines hidden (view full) --- 1419 "%d", task_tgid_vnr(current)); 1420 if (rc > out_end - out_ptr) 1421 goto out; 1422 out_ptr += rc; 1423 break; 1424 /* uid */ 1425 case 'u': 1426 rc = snprintf(out_ptr, out_end - out_ptr, |
1427 "%d", current->uid); | 1427 "%d", current_uid()); |
1428 if (rc > out_end - out_ptr) 1429 goto out; 1430 out_ptr += rc; 1431 break; 1432 /* gid */ 1433 case 'g': 1434 rc = snprintf(out_ptr, out_end - out_ptr, | 1428 if (rc > out_end - out_ptr) 1429 goto out; 1430 out_ptr += rc; 1431 break; 1432 /* gid */ 1433 case 'g': 1434 rc = snprintf(out_ptr, out_end - out_ptr, |
1435 "%d", current->gid); | 1435 "%d", current_gid()); |
1436 if (rc > out_end - out_ptr) 1437 goto out; 1438 out_ptr += rc; 1439 break; 1440 /* signal that caused the coredump */ 1441 case 's': 1442 rc = snprintf(out_ptr, out_end - out_ptr, 1443 "%ld", signr); --- 260 unchanged lines hidden (view full) --- 1704{ 1705 struct core_state core_state; 1706 char corename[CORENAME_MAX_SIZE + 1]; 1707 struct mm_struct *mm = current->mm; 1708 struct linux_binfmt * binfmt; 1709 struct inode * inode; 1710 struct file * file; 1711 int retval = 0; | 1436 if (rc > out_end - out_ptr) 1437 goto out; 1438 out_ptr += rc; 1439 break; 1440 /* signal that caused the coredump */ 1441 case 's': 1442 rc = snprintf(out_ptr, out_end - out_ptr, 1443 "%ld", signr); --- 260 unchanged lines hidden (view full) --- 1704{ 1705 struct core_state core_state; 1706 char corename[CORENAME_MAX_SIZE + 1]; 1707 struct mm_struct *mm = current->mm; 1708 struct linux_binfmt * binfmt; 1709 struct inode * inode; 1710 struct file * file; 1711 int retval = 0; |
1712 int fsuid = current->fsuid; | 1712 int fsuid = current_fsuid(); |
1713 int flag = 0; 1714 int ispipe = 0; 1715 unsigned long core_limit = current->signal->rlim[RLIMIT_CORE].rlim_cur; 1716 char **helper_argv = NULL; 1717 int helper_argc = 0; 1718 char *delimit; 1719 1720 audit_core_dumps(signr); --- 89 unchanged lines hidden (view full) --- 1810 /* AK: actually i see no reason to not allow this for named pipes etc., 1811 but keep the previous behaviour for now. */ 1812 if (!ispipe && !S_ISREG(inode->i_mode)) 1813 goto close_fail; 1814 /* 1815 * Dont allow local users get cute and trick others to coredump 1816 * into their pre-created files: 1817 */ | 1713 int flag = 0; 1714 int ispipe = 0; 1715 unsigned long core_limit = current->signal->rlim[RLIMIT_CORE].rlim_cur; 1716 char **helper_argv = NULL; 1717 int helper_argc = 0; 1718 char *delimit; 1719 1720 audit_core_dumps(signr); --- 89 unchanged lines hidden (view full) --- 1810 /* AK: actually i see no reason to not allow this for named pipes etc., 1811 but keep the previous behaviour for now. */ 1812 if (!ispipe && !S_ISREG(inode->i_mode)) 1813 goto close_fail; 1814 /* 1815 * Dont allow local users get cute and trick others to coredump 1816 * into their pre-created files: 1817 */ |
1818 if (inode->i_uid != current->fsuid) | 1818 if (inode->i_uid != current_fsuid()) |
1819 goto close_fail; 1820 if (!file->f_op) 1821 goto close_fail; 1822 if (!file->f_op->write) 1823 goto close_fail; 1824 if (!ispipe && do_truncate(file->f_path.dentry, 0, 0, file) != 0) 1825 goto close_fail; 1826 --- 15 unchanged lines hidden --- | 1819 goto close_fail; 1820 if (!file->f_op) 1821 goto close_fail; 1822 if (!file->f_op->write) 1823 goto close_fail; 1824 if (!ispipe && do_truncate(file->f_path.dentry, 0, 0, file) != 0) 1825 goto close_fail; 1826 --- 15 unchanged lines hidden --- |