lists.openwall.net   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  linux-cve-announce  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:   Tue, 18 Jul 2017 18:52:31 -0700
From:   Andy Lutomirski <luto@...nel.org>
To:     Kees Cook <keescook@...omium.org>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Serge Hallyn <serge@...lyn.com>,
        Andy Lutomirski <luto@...nel.org>,
        David Howells <dhowells@...hat.com>,
        "Eric W. Biederman" <ebiederm@...ssion.com>,
        John Johansen <john.johansen@...onical.com>,
        Paul Moore <paul@...l-moore.com>,
        Stephen Smalley <sds@...ho.nsa.gov>,
        Casey Schaufler <casey@...aufler-ca.com>,
        Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
        James Morris <james.l.morris@...cle.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Linux FS Devel <linux-fsdevel@...r.kernel.org>,
        LSM List <linux-security-module@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 07/15] commoncap: Move cap_elevated calculation into bprm_set_creds

On Tue, Jul 18, 2017 at 3:25 PM, Kees Cook <keescook@...omium.org> wrote:
> Instead of a separate function, open-code the cap_elevated test, which
> lets us entirely remove bprm->cap_effective (to use the local "effective"
> variable instead), and more accurately examine euid/egid changes via the
> existing local "is_setid".

...

> -static int is_secureexec(struct linux_binprm *bprm)
> -{
> -       const struct cred *cred = bprm->cred;
> -       kuid_t root_uid = make_kuid(cred->user_ns, 0);
> -
> -       if (!uid_eq(cred->uid, root_uid)) {
> -               if (bprm->cap_effective)
> -                       return 1;
> -               if (!cap_issubset(cred->cap_permitted, cred->cap_ambient))
> -                       return 1;
> +       bprm->cap_elevated = 0;
> +       if (is_setid) {
> +               bprm->cap_elevated = 1;
> +       } else if (!uid_eq(new->uid, root_uid)) {
> +               if (effective ||
> +                   !cap_issubset(new->cap_permitted, new->cap_ambient))
> +                       bprm->cap_elevated = 1;
>         }
>
> -       return (!uid_eq(cred->euid, cred->uid) ||
> -               !gid_eq(cred->egid, cred->gid));
> +       return 0;

I think this matches the old behavior.  IOW it looks right.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ