]> www.infradead.org Git - users/hch/misc.git/commitdiff
ipe: also reject policy updates with the same version
authorLuca Boccassi <bluca@debian.org>
Wed, 25 Sep 2024 21:01:34 +0000 (23:01 +0200)
committerFan Wu <wufan@kernel.org>
Thu, 17 Oct 2024 18:38:15 +0000 (11:38 -0700)
Currently IPE accepts an update that has the same version as the policy
being updated, but it doesn't make it a no-op nor it checks that the
old and new policyes are the same. So it is possible to change the
content of a policy, without changing its version. This is very
confusing from userspace when managing policies.
Instead change the update logic to reject updates that have the same
version with ESTALE, as that is much clearer and intuitive behaviour.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Fan Wu <wufan@kernel.org>
Documentation/admin-guide/LSM/ipe.rst
security/ipe/policy.c

index f38e641df0e97fc45c8398125a24764209df191f..fcb3c493104b7e54219be18b41262a3543f6799f 100644 (file)
@@ -266,7 +266,7 @@ in the kernel. This file is write-only and accepts a PKCS#7 signed
 policy. Two checks will always be performed on this policy: First, the
 ``policy_names`` must match with the updated version and the existing
 version. Second the updated policy must have a policy version greater than
-or equal to the currently-running version. This is to prevent rollback attacks.
+the currently-running version. This is to prevent rollback attacks.
 
 The ``delete`` file is used to remove a policy that is no longer needed.
 This file is write-only and accepts a value of ``1`` to delete the policy.
index dcaac8c4bb38c82a6e1656d367bd3e0f194e4dfe..4cea067adf6a3eecaf777390e57794d238b1f42f 100644 (file)
@@ -106,7 +106,7 @@ int ipe_update_policy(struct inode *root, const char *text, size_t textlen,
                goto err;
        }
 
-       if (ver_to_u64(old) > ver_to_u64(new)) {
+       if (ver_to_u64(old) >= ver_to_u64(new)) {
                rc = -ESTALE;
                goto err;
        }