aboutsummaryrefslogtreecommitdiff
path: root/fs/exec.c
diff options
context:
space:
mode:
authorAli Al-Asadi <alasadi56@gmail.com>2017-09-16 18:03:39 +0200
committerAli Al-Asadi <alasadi56@gmail.com>2017-09-16 18:03:57 +0200
commit6d7a43ef2973fd127bf910a521d4808661fe7174 (patch)
tree0d60991bc8253ef8f3cd8dd7db7f3f6b6607a39c /fs/exec.c
parent3d01b8790e7e69fb347bacdaafb85f7f1896067b (diff)
parent870ce5261ecd42ac7035ad5e345e14ce0c7837fe (diff)
msm8960: get all the needed changes for kernelo8.0
Merge branch 'lineage-15.0' of https://github.com/tathanhlam66/android_kernel_htc_msm8960 into o8.0 Change-Id: Ib0698d0a99afbfe73e1bfccddcfb29df5d085045
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/fs/exec.c b/fs/exec.c
index e0d3f3e9406..bfc868d392c 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1251,7 +1251,7 @@ EXPORT_SYMBOL(install_exec_creds);
/*
* determine how safe it is to execute the proposed program
* - the caller must hold ->cred_guard_mutex to protect against
- * PTRACE_ATTACH
+ * PTRACE_ATTACH or seccomp thread-sync
*/
static int check_unsafe_exec(struct linux_binprm *bprm)
{
@@ -1270,7 +1270,7 @@ static int check_unsafe_exec(struct linux_binprm *bprm)
* This isn't strictly necessary, but it makes it harder for LSMs to
* mess up.
*/
- if (current->no_new_privs)
+ if (task_no_new_privs(current))
bprm->unsafe |= LSM_UNSAFE_NO_NEW_PRIVS;
n_fs = 1;
@@ -1307,7 +1307,8 @@ static void bprm_fill_uid(struct linux_binprm *bprm)
bprm->cred->euid = current_euid();
bprm->cred->egid = current_egid();
- if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID)
+ if ((bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) ||
+ task_no_new_privs(current))
return;
inode = bprm->file->f_path.dentry->d_inode;
@@ -1508,7 +1509,6 @@ static int do_execve_common(const char *filename,
bool clear_in_exec;
int retval;
const struct cred *cred = current_cred();
- bool is_su;
/*
* We move the actual failure in case of RLIMIT_NPROC excess from
@@ -1585,14 +1585,11 @@ static int do_execve_common(const char *filename,
if (retval < 0)
goto out;
- /* search_binary_handler can release file and it may be freed */
- is_su = d_is_su(file->f_dentry);
-
retval = search_binary_handler(bprm,regs);
if (retval < 0)
goto out;
- if (is_su && capable(CAP_SYS_ADMIN)) {
+ if (d_is_su(file->f_dentry) && capable(CAP_SYS_ADMIN)) {
current->flags |= PF_SU;
su_exec();
}