diff options
author | Kees Cook <keescook@chromium.org> | 2014-05-21 18:23:46 -0400 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2014-07-18 15:13:38 -0400 |
commit | 1d4457f99928a968767f6405b4a1f50845aa15fd (patch) | |
tree | 522641b08f4a465035910a74a3871ad38e62df01 /fs | |
parent | 8855d608c145c1ca0e26f4da00741080bb49d80d (diff) |
sched: move no_new_privs into new atomic flags
Since seccomp transitions between threads requires updates to the
no_new_privs flag to be atomic, the flag must be part of an atomic flag
set. This moves the nnp flag into a separate task field, and introduces
accessors.
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Andy Lutomirski <luto@amacapital.net>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/exec.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1234,7 +1234,7 @@ static void check_unsafe_exec(struct linux_binprm *bprm) | |||
1234 | * This isn't strictly necessary, but it makes it harder for LSMs to | 1234 | * This isn't strictly necessary, but it makes it harder for LSMs to |
1235 | * mess up. | 1235 | * mess up. |
1236 | */ | 1236 | */ |
1237 | if (current->no_new_privs) | 1237 | if (task_no_new_privs(current)) |
1238 | bprm->unsafe |= LSM_UNSAFE_NO_NEW_PRIVS; | 1238 | bprm->unsafe |= LSM_UNSAFE_NO_NEW_PRIVS; |
1239 | 1239 | ||
1240 | t = p; | 1240 | t = p; |
@@ -1272,7 +1272,7 @@ int prepare_binprm(struct linux_binprm *bprm) | |||
1272 | bprm->cred->egid = current_egid(); | 1272 | bprm->cred->egid = current_egid(); |
1273 | 1273 | ||
1274 | if (!(bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) && | 1274 | if (!(bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) && |
1275 | !current->no_new_privs && | 1275 | !task_no_new_privs(current) && |
1276 | kuid_has_mapping(bprm->cred->user_ns, inode->i_uid) && | 1276 | kuid_has_mapping(bprm->cred->user_ns, inode->i_uid) && |
1277 | kgid_has_mapping(bprm->cred->user_ns, inode->i_gid)) { | 1277 | kgid_has_mapping(bprm->cred->user_ns, inode->i_gid)) { |
1278 | /* Set-uid? */ | 1278 | /* Set-uid? */ |