[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrUc8VVyPKuGrS7PxBRHCsVhXbXaiEOmwjgHrzTRiXPT9Q@mail.gmail.com>
Date: Wed, 28 Sep 2016 16:22:53 -0700
From: Andy Lutomirski <luto@...capital.net>
To: Jann Horn <jann@...jh.net>
Cc: "security@...nel.org" <security@...nel.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Paul Moore <paul@...l-moore.com>,
Stephen Smalley <sds@...ho.nsa.gov>,
Eric Paris <eparis@...isplace.org>,
James Morris <james.l.morris@...cle.com>,
"Serge E. Hallyn" <serge@...lyn.com>,
Nick Kralevich <nnk@...gle.com>,
Janis Danisevskis <jdanis@...gle.com>,
LSM List <linux-security-module@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 2/3] mm: add LSM hook for writes to readonly memory
On Wed, Sep 28, 2016 at 3:54 PM, Jann Horn <jann@...jh.net> wrote:
> SELinux attempts to make it possible to whitelist trustworthy sources of
> code that may be mapped into memory, and Android makes use of this feature.
> To prevent an attacker from bypassing this by modifying R+X memory through
> /proc/$pid/mem or PTRACE_POKETEXT, it is necessary to call a security hook
> in check_vma_flags().
If selinux policy allows PTRACE_POKETEXT, is it really so bad for that
to result in code execution?
> -struct mm_struct *proc_mem_open(struct inode *inode, unsigned int mode)
> +struct mm_struct *proc_mem_open(struct inode *inode,
> + const struct cred **object_cred,
> + unsigned int mode)
> {
Why are you passing object_cred all over the place like this? You
have an inode, and an inode implies a task.
For that matter, would it possibly make sense to use MEMCG's mm->owner
and get rid of object_cred entirely? I can see this causing issues in
strange threading cases, e.g. accessing your own /proc/$$/mem vs
another thread in your process's.
Powered by blists - more mailing lists