linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>,
	Andreas Dilger <adilger@dilger.ca>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	lsf-pc@lists.linux-foundation.org
Subject: Re: [Lsf-pc] [LSF/MM TOPIC] fs-verity: file system-level integrity protection
Date: Wed, 31 Jan 2018 11:05:10 -0500	[thread overview]
Message-ID: <20180131160510.GA18615@thunk.org> (raw)
In-Reply-To: <1517354702.3469.60.camel@linux.vnet.ibm.com>

On Tue, Jan 30, 2018 at 06:25:02PM -0500, Mimi Zohar wrote:
> On Mon, 2018-01-29 at 18:02 -0500, Theodore Ts'o wrote:
> > On Mon, Jan 29, 2018 at 07:09:01AM -0500, Mimi Zohar wrote:
> > > 
> > > The LSM security_file_open hook is where fs-verity and IMA meet. �The
> > > fs-verity Merkle tree hash signature would be another IMA-appraisal
> > > integrity verification method.
> > 
> > I wasn't planning on using the file open hook for fs-verity at all,
> > since the merkle hash signature is going to be cached in the per-file
> > system inode --- e.g., for ext4, it would be stored in EXT4_I(inode),
> > aka "struct ext4_inode_info".
> 
> Ok, so if not at open, at what point do you plan on validating the
> merkle hash signature?

I said we would not using the LSM file_open hook.  Instead it will be
done in ext4_file_open() or f2fs_file_open().  That's because the
place where the key is cached is in the file system specific portion
of the inode.  This is what I meant by EXT4_I(inode) aka struct
ext4_inode_info.  So it does happen at file open time; it just doesn't
use the LSM file_open hook.  One of the features of fs-verity is that
it does *not* require the use of the LSM infrastructure.

> I agree with you that the integrity architecture needs to be easily
> extendsible to support different integrity authentication methods.
> �The list, below, is a set of fs-verity functions needed to be
> exported for IMA. �Hopefully I didn't miss anything.

Just to be clear, who is signing up to do all of this work to enable
fs-verity for IMA?  In particular, if you and James are asking *me* to
do all of this development work, when I have no need for any of these
benefits, I'm going to have to decline the honor.  I'm happy to try to
modify the design to make it easier for IMA to use fs-verity.  That's
different from actually implementing it.

> > So I want to support a very simple case where the policy is simply
> > "the public key needed to verify the PKCS7 signing block is in a
> > trusted keyring".
> 
> Which trusted keyring? �How is the keyring populated? �What prevents
> other keys from being added to that keyring?

It will probably be a separate keyring, but in theory we could use the
keyring used to validate signed kernel modules.  There are a number of
different ways the policy for signed kernel modules can be
configured[1], and the same would be true for fs-verity.  (The reason
for a separate kernel keyring is to allow for a separation between
those keys trusted to sign kernel modules, and those trusted to sign
for fs-verity.)

[1] https://01.org/linuxgraphics/gfx-docs/drm/admin-guide/module-signing.html

> So the implied policy is that no signatures will be verified unless
> userspace turns the bit on. �So you're trust is based in userspace.

For the initial use case that we're interested in, yes.  The check to
make sure the verity bit is enabled for a small set of privileged
APK's will be done by the AOSP userspace, and the AOSP userspace lives
in a read-only system partition which is protected using dm-verity.
(And the keys for dm-verity are protected using asigned bootloader; it
is possible to do data integrity without using IMA/EVM, and millions
and millions of Android devices are doing in this way.)


The problem we're trying to solve is that in order to allow for the
privileged APK's to be upgraded more frequently, they are stored in
the /data partition, which is encrypted; however, fs-crypt does not
provide data integrity guarntees.  fs-verity allows us to protect
those APK's (which are equivalent in power to software in the system
partition, being privileged APK's).

Note also that an APK will often have large number of translations
that will never be used on a particular device, so doing full check of
the entire APK will mean doing unneeded work.  Obviously you have to
trade off the time of doing sequential reads versus the random reads
for doing on-demand Merkle tree checks, but if you have translation
resources for Russian, Chinese, French, Spanish, etc, and the only
language used on a particular device is English, then the on-demand
checks can often be far more efficient, especially if the one of the
figures of merit is how long it takes for an application to start
painting the first pixel after the user clicks on its icon.

> > If someone needs something more complex than the simple "key is in the
> > trusted keyring", I'm happy to say that the right answer is to use the
> > LSM hooks, and it should be straight forward to provide interfaces so
> > that the LSM can determine that file system supports verity and the
> > file has the verity bit set.  The LSM could also apply additional
> > restrictions (if the SELinux file type is supersekrit_t, then only a
> > smaller set of keys will be allowed to be used to sign the PKCS7
> > signature block).
> 
> Interesting, so there is an additional policy limiting which keys may
> be used based on an LSM labels, if so desired.

If someone implements it, yes.  If there is a business case where the
benefits outweighs the costs, and the headcount can be funded, it
would happen.  However, having spent time trying to understand the
IMA/EVM/LSM/SELinux architecture, I've spent enough time to decide
it's not something I would do on my own time, for fun.  :-)

						- Ted

  reply	other threads:[~2018-01-31 16:05 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-25 19:11 [LSF/MM TOPIC] fs-verity: file system-level integrity protection Theodore Ts'o
2018-01-25 21:49 ` Chuck Lever
2018-01-25 23:39   ` Theodore Ts'o
2018-01-26  0:47 ` James Bottomley
2018-01-26  2:30   ` Theodore Ts'o
2018-01-26  4:50     ` James Bottomley
2018-01-26 14:58       ` Theodore Ts'o
2018-01-26 16:44         ` [Lsf-pc] " James Bottomley
2018-01-26 21:55           ` Theodore Ts'o
2018-01-27  7:58             ` Andreas Dilger
2018-01-27 16:19               ` James Bottomley
2018-01-27 17:08                 ` James Bottomley
2018-01-28  2:46                 ` Theodore Ts'o
2018-01-28 17:19                   ` James Bottomley
2018-01-28 18:03                   ` James Bottomley
2018-01-28 18:19                     ` Chuck Lever
2018-01-29  6:39                       ` James Bottomley
2018-01-29 15:22                         ` Chuck Lever
2018-01-30  6:47                           ` James Bottomley
2018-01-28 21:49                     ` Theodore Ts'o
2018-01-28 22:49                       ` Theodore Ts'o
2018-01-28 23:04                       ` Mimi Zohar
2018-01-29  0:38                         ` Theodore Ts'o
2018-01-29  1:53                           ` Mimi Zohar
2018-01-29  2:38                             ` Theodore Ts'o
2018-01-29  3:39                               ` Mimi Zohar
2018-01-29  4:40                                 ` Theodore Ts'o
2018-01-29  4:50                                 ` Theodore Ts'o
2018-01-29 12:09                                   ` Mimi Zohar
2018-01-29 13:58                                     ` Mimi Zohar
2018-01-29 23:02                                     ` Theodore Ts'o
2018-01-30 23:25                                       ` Mimi Zohar
2018-01-31 16:05                                         ` Theodore Ts'o [this message]
2018-01-31 17:12                                           ` James Bottomley
2018-01-31 18:46                                             ` Theodore Ts'o
2018-01-31 20:41                                               ` James Bottomley
2018-02-01  0:03                                                 ` Theodore Ts'o
2018-02-01 23:04                                                   ` Dave Chinner
2018-02-01 23:43                                                     ` Andreas Dilger
2018-02-02  0:13                                                       ` Dave Chinner
2018-02-02  5:34                                                       ` James Bottomley
2018-02-02  2:40                                                     ` Theodore Ts'o
2018-02-02  9:05                                                       ` Dave Chinner
2018-01-31 20:40                                           ` Mimi Zohar
2018-01-31 22:00                                             ` Theodore Ts'o
2018-02-01 15:17                                               ` Mimi Zohar
2018-01-29  0:21                       ` James Bottomley
2018-01-29  1:03                         ` Theodore Ts'o
2018-01-29 21:21                           ` Andreas Dilger
2018-01-26 18:13         ` Mimi Zohar
2018-01-29 18:54   ` Michael Halcrow
2018-01-26  7:58 ` Colin Walters
2018-01-26 15:29   ` Theodore Ts'o
2018-01-26 16:40     ` Colin Walters
2018-01-26 16:49       ` [Lsf-pc] " James Bottomley
2018-01-26 17:05         ` Colin Walters
2018-01-26 17:54 ` Mimi Zohar
2018-02-02  0:02 ` Steve French
2018-02-07 13:04 ` David Gstir

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=20180131160510.GA18615@thunk.org \
    --to=tytso@mit.edu \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=adilger@dilger.ca \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=lsf-pc@lists.linux-foundation.org \
    --cc=zohar@linux.vnet.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).