[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87a71sxdpf.fsf_-_@x220.int.ebiederm.org>
Date: Thu, 28 May 2020 10:48:44 -0500
From: ebiederm@...ssion.com (Eric W. Biederman)
To: <linux-kernel@...r.kernel.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Oleg Nesterov <oleg@...hat.com>, Jann Horn <jannh@...gle.com>,
Kees Cook <keescook@...omium.org>,
Greg Ungerer <gerg@...ux-m68k.org>,
Rob Landley <rob@...dley.net>,
Bernd Edlinger <bernd.edlinger@...mail.de>,
<linux-fsdevel@...r.kernel.org>, Al Viro <viro@...IV.linux.org.uk>,
Alexey Dobriyan <adobriyan@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Casey Schaufler <casey@...aufler-ca.com>,
linux-security-module@...r.kernel.org,
James Morris <jmorris@...ei.org>,
"Serge E. Hallyn" <serge@...lyn.com>,
Andy Lutomirski <luto@...capital.net>
Subject: [PATCH 07/11] exec: Set saved, fs, and effective ids together in bprm_fill_uid
Now that there is only one place in bprm_fill_uid where the
euid and the egid are set, move setting of the saved, and the
fs ids to that place.
This makes it clear that this is the only location in the function
that changes these ids.
Signed-off-by: "Eric W. Biederman" <ebiederm@...ssion.com>
---
fs/exec.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/fs/exec.c b/fs/exec.c
index 123402f218fe..8dd7254931dc 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1639,23 +1639,20 @@ static void bprm_fill_uid(struct linux_binprm *bprm)
if (!need_cap ||
(ns_capable(new->user_ns, CAP_SETUID) &&
!(bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS)))
- new->euid = uid;
+ new->suid = new->fsuid = new->euid = uid;
}
if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
bprm->per_clear = 1;
if (!need_cap ||
(ns_capable(new->user_ns, CAP_SETGID) &&
!(bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS)))
- new->egid = gid;
+ new->sgid = new->fsgid = new->egid = gid;
}
after_setid:
/* Will the new creds have multiple uids or gids? */
if (!uid_eq(new->euid, new->uid) || !gid_eq(new->egid, new->gid))
bprm->secureexec = 1;
-
- new->suid = new->fsuid = new->euid;
- new->sgid = new->fsgid = new->egid;
}
/*
--
2.25.0
Powered by blists - more mailing lists