Merge branch 'next-integrity' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull integrity updates from James Morris: "Mimi Zohar says: 'Linux 5.0 introduced the platform keyring to allow verifying the IMA kexec kernel image signature using the pre-boot keys. This pull request similarly makes keys on the platform keyring accessible for verifying the PE kernel image signature. Also included in this pull request is a new IMA hook that tags tmp files, in policy, indicating the file hash needs to be calculated. The remaining patches are cleanup'" * 'next-integrity' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: evm: Use defined constant for UUID representation ima: define ima_post_create_tmpfile() hook and add missing call evm: remove set but not used variable 'xattr' encrypted-keys: fix Opt_err/Opt_error = -1 kexec, KEYS: Make use of platform keyring for signature verify integrity, KEYS: add a reference to platform keyring
This commit is contained in:
@@ -87,6 +87,9 @@ static int __integrity_init_keyring(const unsigned int id, key_perm_t perm,
|
||||
pr_info("Can't allocate %s keyring (%d)\n",
|
||||
keyring_name[id], err);
|
||||
keyring[id] = NULL;
|
||||
} else {
|
||||
if (id == INTEGRITY_KEYRING_PLATFORM)
|
||||
set_platform_trusted_keys(keyring[id]);
|
||||
}
|
||||
|
||||
return err;
|
||||
|
@@ -173,8 +173,7 @@ static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
|
||||
crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc));
|
||||
if ((evm_hmac_attrs & EVM_ATTR_FSUUID) &&
|
||||
type != EVM_XATTR_PORTABLE_DIGSIG)
|
||||
crypto_shash_update(desc, &inode->i_sb->s_uuid.b[0],
|
||||
sizeof(inode->i_sb->s_uuid));
|
||||
crypto_shash_update(desc, (u8 *)&inode->i_sb->s_uuid, UUID_SIZE);
|
||||
crypto_shash_final(desc, digest);
|
||||
}
|
||||
|
||||
|
@@ -563,7 +563,6 @@ static int __init init_evm(void)
|
||||
{
|
||||
int error;
|
||||
struct list_head *pos, *q;
|
||||
struct xattr_list *xattr;
|
||||
|
||||
evm_init_config();
|
||||
|
||||
@@ -580,11 +579,8 @@ static int __init init_evm(void)
|
||||
error:
|
||||
if (error != 0) {
|
||||
if (!list_empty(&evm_config_xattrnames)) {
|
||||
list_for_each_safe(pos, q, &evm_config_xattrnames) {
|
||||
xattr = list_entry(pos, struct xattr_list,
|
||||
list);
|
||||
list_for_each_safe(pos, q, &evm_config_xattrnames)
|
||||
list_del(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -396,6 +396,33 @@ int ima_file_check(struct file *file, int mask)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ima_file_check);
|
||||
|
||||
/**
|
||||
* ima_post_create_tmpfile - mark newly created tmpfile as new
|
||||
* @file : newly created tmpfile
|
||||
*
|
||||
* No measuring, appraising or auditing of newly created tmpfiles is needed.
|
||||
* Skip calling process_measurement(), but indicate which newly, created
|
||||
* tmpfiles are in policy.
|
||||
*/
|
||||
void ima_post_create_tmpfile(struct inode *inode)
|
||||
{
|
||||
struct integrity_iint_cache *iint;
|
||||
int must_appraise;
|
||||
|
||||
must_appraise = ima_must_appraise(inode, MAY_ACCESS, FILE_CHECK);
|
||||
if (!must_appraise)
|
||||
return;
|
||||
|
||||
/* Nothing to do if we can't allocate memory */
|
||||
iint = integrity_inode_get(inode);
|
||||
if (!iint)
|
||||
return;
|
||||
|
||||
/* needed for writing the security xattrs */
|
||||
set_bit(IMA_UPDATE_XATTR, &iint->atomic_flags);
|
||||
iint->ima_file_status = INTEGRITY_PASS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ima_post_path_mknod - mark as a new inode
|
||||
* @dentry: newly created dentry
|
||||
@@ -413,9 +440,13 @@ void ima_post_path_mknod(struct dentry *dentry)
|
||||
if (!must_appraise)
|
||||
return;
|
||||
|
||||
/* Nothing to do if we can't allocate memory */
|
||||
iint = integrity_inode_get(inode);
|
||||
if (iint)
|
||||
iint->flags |= IMA_NEW_FILE;
|
||||
if (!iint)
|
||||
return;
|
||||
|
||||
/* needed for re-opening empty files */
|
||||
iint->flags |= IMA_NEW_FILE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user