All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Aloni <dan@kernelim.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Kees Cook <keescook@chromium.org>,
	Paul Moore <paul@paul-moore.com>,
	SELinux <selinux@vger.kernel.org>,
	Jeffrey Vander Stoep <jeffv@google.com>,
	Ondrej Mosnacek <omosnace@redhat.com>,
	Connor Kuehl <cipkuehl@gmail.com>
Subject: Re: Does anyone use RANDSTRUCT?
Date: Sat, 14 Dec 2019 00:39:58 +0200	[thread overview]
Message-ID: <20191213223958.GB31026@gmail.com> (raw)
In-Reply-To: <7514d477-3a27-0d35-d611-335a103290ec@tycho.nsa.gov>

On Fri, Dec 13, 2019 at 01:36:38PM -0500, Stephen Smalley wrote:
> On 12/13/19 1:05 PM, Kees Cook wrote:
> > On Fri, Dec 13, 2019 at 10:40:54AM -0500, Stephen Smalley wrote:
> > > See $(subject). If yes, there are some obvious candidates among the SELinux
> > > data structures for randomized layouts to avoid fixed locations for
> > > enforcing, initialized, etc.  If not, then no point in pursuing it. Doesn't
> > > look like Fedora enables it, probably because they'd have to publish the
> > > random seeds anyway for third party kernel modules.  But maybe it would be
> > > useful for some distros/users?  ChromeOS?  Android?
> > 
> > It is used by "in-house" kernel builders who optimize for high security
> > above all other things (I've talked to a few of them over the years
> > when finding out what defenses they've wanted). I've also seen Huawai
> > Android patches that seem to indicate they're using it as well, but I
> > haven't been able to determine if any released devices are shipping with
> > it enabled. I've also had several people ask after the Clang randstruct
> > port, which is ongoing[1] by a couple people (added to CC).
> > 
> > I think it would be very handy to add some more markings to sensitive
> > data structures. Please send patches!
> 
> Do you know if there is something inhibiting usage in e.g. Pixel devices?
> Performance impact?

In Android, the use of Clang for building the kernel inhibits it, as
RANDSTRUCT support for Clang is still in development. The move to Clang
for AOSP kernels is motivated for enabling CFI [1] and other features
such as SCS [2]. AFAIK the move to Clang is already in effect for quite
awhile in the kernels running on Pixel devices.

About performance, the gcc RANDSTRUCT implementation also includes a
performance-preserving feature where randomization takes cacheline
boundary into consideration. The Clang implementation is expected to
have this as well. It's a valid concern and definitely garners testing
for anyone enabling the feature.

[1] https://source.android.com/devices/tech/debug/cfi
[2] https://source.android.com/devices/tech/debug/shadow-call-stack

-- 
Dan Aloni

  reply	other threads:[~2019-12-13 22:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-13 15:40 Does anyone use RANDSTRUCT? Stephen Smalley
     [not found] ` <CAOSEQ1qhxdA+JW4M6rOqjzTuMXu2hr0jxRt9NfkuEcWW7-_BEQ@mail.gmail.com>
2019-12-13 15:53   ` Stephen Smalley
2019-12-13 18:05 ` Kees Cook
2019-12-13 18:36   ` Stephen Smalley
2019-12-13 22:39     ` Dan Aloni [this message]
2019-12-15  0:33       ` Connor Kuehl

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=20191213223958.GB31026@gmail.com \
    --to=dan@kernelim.com \
    --cc=cipkuehl@gmail.com \
    --cc=jeffv@google.com \
    --cc=keescook@chromium.org \
    --cc=omosnace@redhat.com \
    --cc=paul@paul-moore.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@vger.kernel.org \
    /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.