Skip to content

Commit 5ceecb3

Browse files
blucajxwufan
authored andcommitted
ipe: also reject policy updates with the same version
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 <[email protected]> Reviewed-by: Serge Hallyn <[email protected]> Signed-off-by: Fan Wu <[email protected]>
1 parent 5799418 commit 5ceecb3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Documentation/admin-guide/LSM/ipe.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ in the kernel. This file is write-only and accepts a PKCS#7 signed
266266
policy. Two checks will always be performed on this policy: First, the
267267
``policy_names`` must match with the updated version and the existing
268268
version. Second the updated policy must have a policy version greater than
269-
or equal to the currently-running version. This is to prevent rollback attacks.
269+
the currently-running version. This is to prevent rollback attacks.
270270

271271
The ``delete`` file is used to remove a policy that is no longer needed.
272272
This file is write-only and accepts a value of ``1`` to delete the policy.

security/ipe/policy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ int ipe_update_policy(struct inode *root, const char *text, size_t textlen,
106106
goto err;
107107
}
108108

109-
if (ver_to_u64(old) > ver_to_u64(new)) {
109+
if (ver_to_u64(old) >= ver_to_u64(new)) {
110110
rc = -ESTALE;
111111
goto err;
112112
}

0 commit comments

Comments
 (0)