lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 18 May 2020 19:29:41 -0500
From: (Eric W. Biederman)
To:     <>
Cc:     Linus Torvalds <>,
        Oleg Nesterov <>, Jann Horn <>,
        Kees Cook <>,
        Greg Ungerer <>,
        Rob Landley <>,
        Bernd Edlinger <>,
        <>, Al Viro <>,
        Alexey Dobriyan <>,
        Andrew Morton <>,
        Casey Schaufler <>,,
        James Morris <>,
        "Serge E. Hallyn" <>,
        Andy Lutomirski <>
Subject: [PATCH v2 1/8] exec: Teach prepare_exec_creds how exec treats uids & gids

It is almost possible to use the result of prepare_exec_creds with no
modifications during exec.  Update prepare_exec_creds to initialize
the suid and the fsuid to the euid, and the sgid and the fsgid to the
egid.  This is all that is needed to handle the common case of exec
when nothing special like a setuid exec is happening.

That this preserves the existing behavior of exec can be verified
by examing bprm_fill_uid and cap_bprm_set_creds.

This change makes it clear that the later parts of exec that
update bprm->cred are just need to handle special cases such
as setuid exec and change of domains.

Signed-off-by: "Eric W. Biederman" <>
 kernel/cred.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/cred.c b/kernel/cred.c
index 71a792616917..421b1149c651 100644
--- a/kernel/cred.c
+++ b/kernel/cred.c
@@ -315,6 +315,9 @@ struct cred *prepare_exec_creds(void)
 	new->process_keyring = NULL;
+	new->suid = new->fsuid = new->euid;
+	new->sgid = new->fsgid = new->egid;
 	return new;

Powered by blists - more mailing lists