Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cb6fd68f authored by Kees Cook's avatar Kees Cook Committed by Linus Torvalds
Browse files

exec: clarify reasoning for euid/egid reset



This section of code initially looks redundant, but is required. This
improves the comment to explain more clearly why the reset is needed.

Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Acked-by: default avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7f427d3a
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1387,7 +1387,12 @@ static void bprm_fill_uid(struct linux_binprm *bprm)
	kuid_t uid;
	kgid_t gid;

	/* clear any previous set[ug]id data from a previous binary */
	/*
	 * Since this can be called multiple times (via prepare_binprm),
	 * we must clear any previous work done when setting set[ug]id
	 * bits from any earlier bprm->file uses (for example when run
	 * first for a setuid script then again for its interpreter).
	 */
	bprm->cred->euid = current_euid();
	bprm->cred->egid = current_egid();