Re: [PATCH v16 17/20] ipe: enable support for fs-verity as a trust provider

From: Eric Biggers
Date: Wed Apr 03 2024 - 01:10:44 EST


On Thu, Mar 28, 2024 at 01:17:24PM -0700, Fan Wu wrote:
> Enable IPE policy authors to indicate trust for a singular fsverity
> file, identified by the digest information, through "fsverity_digest"
> and all files using fsverity's builtin signatures via
> "fsverity_signature".

Again, I'm pretty sure you actually care about all files with *valid* builtin
signatures, not simply all files with builtin signatures...

> +/**
> + * ipe_inode_setintegrity - save integrity data from a inode to IPE's LSM blob.
> + * @inode: The inode to source the security blob from.
> + * @type: Supplies the integrity type.
> + * @value: The value to be stored.
> + * @size: The size of @value.
> + *
> + * Saves fsverity signature into inode security blob
> + *
> + * Return:
> + * * 0 - OK
> + * * !0 - Error
> + */
> +int ipe_inode_setintegrity(struct inode *inode, enum lsm_integrity_type type,
> + const void *value, size_t size)
> +{
> + struct ipe_inode *inode_sec = ipe_inode(inode);
> +
> + if (type == LSM_INT_FSVERITY_BUILTINSIG) {
> + inode_sec->fs_verity_signed = size > 0 && value;
> + return 0;
> + }
> +
> + return 0;

This is the actual code, and it's *still* documented incorrectly. No, it
doesn't "Save fsverity signature into inode security blob". All it actually
does is save a flag saying that there was a valid signature.

The flag also should be called something like fsverity_sig_valid, indicating
that there is a builtin signature *and* it's valid.

- Eric