[GIT,PULL] integrity subsystem updates for v5.4
mbox series

Message ID 1568237365.5783.39.camel@linux.ibm.com
State New
Headers show
Series
  • [GIT,PULL] integrity subsystem updates for v5.4
Related show

Pull-request

git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git next-integrity

Message

Mimi Zohar Sept. 11, 2019, 9:29 p.m. UTC
Hi Linus,

The major feature in this pull request is IMA support for measuring
and appraising appended file signatures.  In addition are a couple of
bug fixes and code cleanup to use struct_size().

In addition to the PE/COFF and IMA xattr signatures, the kexec kernel
image may be signed with an appended signature, using the same
scripts/sign-file tool that is used to sign kernel modules.
 Similarly, the initramfs may contain an appended signature.

(Stephen is carrying a patch to address a merge conflict with the
security tree.)

thanks,

Mimi

The following changes since commit 609488bc979f99f805f34e9a32c1e3b71179d10b:

  Linux 5.3-rc2 (2019-07-28 12:47:02 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git next-integrity

for you to fetch changes up to 2a7f0e53daf29ca6dc9fbe2a27158f13474ec1b5:

  ima: ima_api: Use struct_size() in kzalloc() (2019-08-29 14:23:30 -0400)

----------------------------------------------------------------
Gustavo A. R. Silva (2):
      ima: use struct_size() in kzalloc()
      ima: ima_api: Use struct_size() in kzalloc()

Mimi Zohar (2):
      ima: initialize the "template" field with the default template
      sefltest/ima: support appended signatures (modsig)

Sascha Hauer (2):
      ima: always return negative code for error
      ima: fix freeing ongoing ahash_request

Stephen Rothwell (1):
      MODSIGN: make new include file self contained

Thiago Jung Bauermann (11):
      MODSIGN: Export module signature definitions
      PKCS#7: Refactor verify_pkcs7_signature()
      PKCS#7: Introduce pkcs7_get_digest()
      integrity: Select CONFIG_KEYS instead of depending on it
      ima: Add modsig appraise_type option for module-style appended signatures
      ima: Factor xattr_verify() out of ima_appraise_measurement()
      ima: Implement support for module-style appended signatures
      ima: Collect modsig
      ima: Define ima-modsig template
      ima: Store the measurement again when appraising a modsig
      ima: Fix use after free in ima_read_modsig()

 Documentation/ABI/testing/ima_policy               |   6 +-
 Documentation/security/IMA-templates.rst           |   3 +
 arch/s390/Kconfig                                  |   2 +-
 arch/s390/kernel/machine_kexec_file.c              |  24 +--
 certs/system_keyring.c                             |  61 +++++--
 crypto/asymmetric_keys/pkcs7_verify.c              |  33 ++++
 include/crypto/pkcs7.h                             |   4 +
 include/linux/module.h                             |   3 -
 include/linux/module_signature.h                   |  46 +++++
 include/linux/verification.h                       |  10 ++
 init/Kconfig                                       |   6 +-
 kernel/Makefile                                    |   1 +
 kernel/module.c                                    |   1 +
 kernel/module_signature.c                          |  46 +++++
 kernel/module_signing.c                            |  56 +-----
 scripts/Makefile                                   |   2 +-
 security/integrity/Kconfig                         |   2 +-
 security/integrity/digsig.c                        |  43 ++++-
 security/integrity/ima/Kconfig                     |  13 ++
 security/integrity/ima/Makefile                    |   1 +
 security/integrity/ima/ima.h                       |  60 ++++++-
 security/integrity/ima/ima_api.c                   |  27 ++-
 security/integrity/ima/ima_appraise.c              | 194 ++++++++++++++-------
 security/integrity/ima/ima_crypto.c                |  10 +-
 security/integrity/ima/ima_main.c                  |  24 ++-
 security/integrity/ima/ima_modsig.c                | 168 ++++++++++++++++++
 security/integrity/ima/ima_policy.c                |  71 ++++++--
 security/integrity/ima/ima_template.c              |  31 +++-
 security/integrity/ima/ima_template_lib.c          |  64 ++++++-
 security/integrity/ima/ima_template_lib.h          |   4 +
 security/integrity/integrity.h                     |  20 +++
 .../selftests/kexec/test_kexec_file_load.sh        |  38 +++-
 32 files changed, 871 insertions(+), 203 deletions(-)
 create mode 100644 include/linux/module_signature.h
 create mode 100644 kernel/module_signature.c
 create mode 100644 security/integrity/ima/ima_modsig.c

Comments

Linus Torvalds Sept. 16, 2019, 8:38 p.m. UTC | #1
On Wed, Sep 11, 2019 at 2:29 PM Mimi Zohar <zohar@linux.ibm.com> wrote:
>
> The major feature in this pull request is IMA support for measuring
> and appraising appended file signatures.  In addition are a couple of
> bug fixes and code cleanup to use struct_size().

How is the file signature any different from (and/or better than) the
fs-verity support?

The fs-verity support got fairly extensively discussed, and is
apparently going to actually be widely used by Android, and it an
independent feature of any security model.

What does the IMA version bring to the table?

             Linus
Mimi Zohar Sept. 16, 2019, 10:13 p.m. UTC | #2
On Mon, 2019-09-16 at 13:38 -0700, Linus Torvalds wrote:
> On Wed, Sep 11, 2019 at 2:29 PM Mimi Zohar <zohar@linux.ibm.com> wrote:
> >
> > The major feature in this pull request is IMA support for measuring
> > and appraising appended file signatures.  In addition are a couple of
> > bug fixes and code cleanup to use struct_size().
> 
> How is the file signature any different from (and/or better than) the
> fs-verity support?
> 
> The fs-verity support got fairly extensively discussed, and is
> apparently going to actually be widely used by Android, and it an
> independent feature of any security model.
> 
> What does the IMA version bring to the table?

IMA currently defines a system wide policy for measuring, verifying a
file's integrity (both mutable/immutable files) against known good
values, and adding audit records containing the file hashes.  The
policy isn't hard coded in the kernel, allowing people/companies to
configure it as desired for their specific use case.

Support for appended signatures already exists in the kernel for
kernel modules.  This pull request adds IMA support for appended
signatures in order to verify the kexec kernel image on OpenPOWER, as
part of Secure and Trusted boot enablement.  This would allow distros
to sign kernel images similar to how they currently sign kernel
modules.

IMA verifies file signatures up front, before allowing access to the
file.  fs-verity verifies the signature of the Merkle tree (and other
info), but does not verify the file data at the time of first use.
 There are pros and cons to each of these approaches.

Mimi
Mimi Zohar Sept. 27, 2019, 4:08 p.m. UTC | #3
On Mon, 2019-09-16 at 18:13 -0400, Mimi Zohar wrote:
> On Mon, 2019-09-16 at 13:38 -0700, Linus Torvalds wrote:
> > On Wed, Sep 11, 2019 at 2:29 PM Mimi Zohar <zohar@linux.ibm.com> wrote:
> > >
> > > The major feature in this pull request is IMA support for measuring
> > > and appraising appended file signatures.  In addition are a couple of
> > > bug fixes and code cleanup to use struct_size().
> > 
> > How is the file signature any different from (and/or better than) the
> > fs-verity support?
> > 
> > The fs-verity support got fairly extensively discussed, and is
> > apparently going to actually be widely used by Android, and it an
> > independent feature of any security model.
> > 
> > What does the IMA version bring to the table?
> 
> IMA currently defines a system wide policy for measuring, verifying a
> file's integrity (both mutable/immutable files) against known good
> values, and adding audit records containing the file hashes.  The
> policy isn't hard coded in the kernel, allowing people/companies to
> configure it as desired for their specific use case.
> 
> Support for appended signatures already exists in the kernel for
> kernel modules.  This pull request adds IMA support for appended
> signatures in order to verify the kexec kernel image on OpenPOWER, as
> part of Secure and Trusted boot enablement.  This would allow distros
> to sign kernel images similar to how they currently sign kernel
> modules.
> 
> IMA verifies file signatures up front, before allowing access to the
> file.  fs-verity verifies the signature of the Merkle tree (and other
> info), but does not verify the file data at the time of first use.
>  There are pros and cons to each of these approaches.

My writing tends to be brief, hopefully concise.  I assume if you had
further questions you would have asked.

This pull request contained a lot of refactoring of the existing
appended signature verification code, so that IMA could retain the
existing framework of calculating the file hash once, storing it in
the IMA measurement list and extending the TPM, verifying the file's
integrity based on a file hash or signature (eg. xattrs), and adding
an audit record containing the file hash, all based on policy.  (The
IMA support for appended signatures patch set was posted and reviewed
11 times.)

The support for appended signature paves the way for adding other
signature verification methods, such as fs-verity, based on a single
system-wide policy.  The file hash used for verifying the signature
and the signature, itself, can be included in the IMA measurement
list.

Originally, IMA & EVM were limited to local kernel file systems, based
on i_version, but have been extended to support filesystems that don't
support i_version and for FUSE.  There are additional discussions for
extending IMA to support remote filesystems (eg. IETF NFS draft).  IMA
by itself isn't enough, since the remote file isn't pinned in memory,
but will need to be dependent on fs-verity.

Nayna Jain re-posted a patch set (v6) titled "powerpc: Enabling IMA
arch specific secure boot policies".  The changes are based on Michael
Ellerman's review.

thanks,

Mimi
pr-tracker-bot@kernel.org Sept. 28, 2019, 3 a.m. UTC | #4
The pull request you sent on Wed, 11 Sep 2019 17:29:25 -0400:

> git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git next-integrity

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/f1f2f614d535564992f32e720739cb53cf03489f

Thank you!