From: Jann Horn <jann@thejh.net>
To: security@kernel.org, Alexander Viro <viro@zeniv.linux.org.uk>,
Paul Moore <paul@paul-moore.com>,
Stephen Smalley <sds@tycho.nsa.gov>,
Eric Paris <eparis@parisplace.org>,
James Morris <james.l.morris@oracle.com>,
"Serge E. Hallyn" <serge@hallyn.com>,
mchong@google.com, Andy Lutomirski <luto@amacapital.net>,
Ingo Molnar <mingo@kernel.org>, Oleg Nesterov <oleg@redhat.com>,
Nick Kralevich <nnk@google.com>,
Janis Danisevskis <jdanis@google.com>
Cc: linux-security-module@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/3] mm: add LSM hook for writes to readonly memory
Date: Thu, 3 Nov 2016 04:10:08 +0100 [thread overview]
Message-ID: <20161103031008.GC13748@pc.thejh.net> (raw)
In-Reply-To: <1478142286-18427-5-git-send-email-jann@thejh.net>
[-- Attachment #1: Type: text/plain, Size: 1231 bytes --]
On Thu, Nov 03, 2016 at 04:04:45AM +0100, Jann Horn 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, PTRACE_POKETEXT or DMA, it is necessary to call a security
> hook in check_vma_flags().
>
> PTRACE_POKETEXT can also be mitigated by blocking ptrace access, and
> /proc/$pid/mem can also be blocked at the VFS layer, but DMA is harder to
> deal with: Some driver functions (e.g. videobuf_dma_init_user_locked)
> write to user-specified DMA mappings even if those mappings are readonly
> or R+X.
Whoops, sorry for sending that twice. :/
A comment regarding the whole series: I'm not entirely sure whether this is
the best way to fix this after all. It's quite a bit of code churn, but it
has the benefit of having a single check in a central place.
As an alternative to this patch, it might be possible to break the ABIs
of the drivers that access DMA buffers with FOLL_FORCE by simply removing
FOLL_FORCE from those drivers. However, I'm not sure how much that would
break existing userspace code.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-11-03 3:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-03 3:04 [PATCH 1/3] fs/exec: don't force writing memory access Jann Horn
2016-11-03 3:04 ` Jann Horn
2016-11-03 3:04 ` [PATCH 2/3] mm: add LSM hook for writes to readonly memory Jann Horn
2016-11-03 3:04 ` Jann Horn
2016-11-03 10:39 ` Jann Horn
2016-11-03 3:04 ` [PATCH 3/3] selinux: require EXECMEM for forced ptrace poke Jann Horn
2016-11-03 3:04 ` Jann Horn
2016-11-03 3:04 ` [PATCH v3 1/3] fs/exec: don't force writing memory access Jann Horn
2016-11-03 3:04 ` Jann Horn
2016-11-03 18:24 ` Oleg Nesterov
2016-11-03 18:24 ` Oleg Nesterov
2016-11-03 3:04 ` [PATCH v3 2/3] mm: add LSM hook for writes to readonly memory Jann Horn
2016-11-03 3:04 ` Jann Horn
2016-11-03 3:10 ` Jann Horn [this message]
2016-11-03 3:04 ` [PATCH v3 3/3] selinux: require EXECMEM for forced ptrace poke Jann Horn
2016-11-03 3:04 ` Jann Horn
2016-11-03 13:21 ` Stephen Smalley
2016-11-03 13:21 ` Stephen Smalley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161103031008.GC13748@pc.thejh.net \
--to=jann@thejh.net \
--cc=eparis@parisplace.org \
--cc=james.l.morris@oracle.com \
--cc=jdanis@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-security-module@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mchong@google.com \
--cc=mingo@kernel.org \
--cc=nnk@google.com \
--cc=oleg@redhat.com \
--cc=paul@paul-moore.com \
--cc=sds@tycho.nsa.gov \
--cc=security@kernel.org \
--cc=serge@hallyn.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.