OSDN Git Service

EVM: Allow userland to permit modification of EVM-protected metadata
authorMatthew Garrett <mjg59@google.com>
Tue, 7 Nov 2017 15:18:35 +0000 (07:18 -0800)
committerMimi Zohar <zohar@linux.vnet.ibm.com>
Mon, 11 Dec 2017 19:27:31 +0000 (14:27 -0500)
commitae1ba1676b88e6c62368a433c7e2d0417e9879fd
treebcbb1a5cba2e439031db519e846f89a91a8b8b2d
parentb7e27bc1d42e8e0cc58b602b529c25cd0071b336
EVM: Allow userland to permit modification of EVM-protected metadata

When EVM is enabled it forbids modification of metadata protected by
EVM unless there is already a valid EVM signature. If any modification
is made, the kernel will then generate a new EVM HMAC. However, this
does not map well on use cases which use only asymmetric EVM signatures,
as in this scenario the kernel is unable to generate new signatures.

This patch extends the /sys/kernel/security/evm interface to allow
userland to request that modification of these xattrs be permitted. This
is only permitted if no keys have already been loaded. In this
configuration, modifying the metadata will invalidate the EVM appraisal
on the file in question. This allows packaging systems to write out new
files, set the relevant extended attributes and then move them into
place.

There's also some refactoring of the use of evm_initialized in order to
avoid heading down codepaths that assume there's a key available.

Signed-off-by: Matthew Garrett <mjg59@google.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Documentation/ABI/testing/evm
security/integrity/evm/evm.h
security/integrity/evm/evm_main.c
security/integrity/evm/evm_secfs.c