Linux Integrity Measurement development
 help / color / mirror / Atom feed
* [PATCH v4 0/2] ima: measure write on securityfs policy file
@ 2026-06-17 15:58 Enrico Bravi
  2026-06-17 15:58 ` [PATCH v4 1/2] ima: measure loaded policy after " Enrico Bravi
  2026-06-17 15:58 ` [PATCH v4 2/2] ima: measure buffer sent to " Enrico Bravi
  0 siblings, 2 replies; 11+ messages in thread
From: Enrico Bravi @ 2026-06-17 15:58 UTC (permalink / raw)
  To: linux-integrity, zohar, dmitry.kasatkin, roberto.sassu
  Cc: eric.snowberg, Enrico Bravi

This series aims to introduce integrity measurements when the IMA policy is
written on the securityfs file.
In particular, when a signed policy is not mandatory, it can be written
directly on the securityfs file. This allows to override the boot policy
at the first write, and append new policy rules at the subsequent writes (if
CONFIG_IMA_WRITE_POLICY=y). In this case new policy can be loaded
without being measured.

The patch #1 introduces a new critical-data record for the newly loaded
policy. The measurement is performed over the textual representation of the
new policy once it becomes effective (after ima_update_policy()). As
suggested by Mimi, the new critical-data rule is added to the arch
specific policy rules (only when a signed policy is not mandatory).

The patch #2, following what was suggested by Roberto, measures the input
buffer sent to the securityfs policy file, regardless of whether the new
policy will be accepted or not. This is done by calling
process_buffer_measurement(), enabling POLICY_CHECK in ima_match_rules() and
ima_match_rule_data() in order to catch it when 'measure func=POLICY_CHECK'
is defined (e.g., ima_policy=tcb).

Changes in v4:
 - Added kernel-doc for the new ima_measure_loaded_policy() function as
   suggested by Mimi.
 - Increased the rule buffer size in ima_measure_loaded_policy() (suggested
   by Mimi) checking if seq_has_overflowed() calculating the policy length.
 - Acquire ima_write_mutex in before calling ima_measure_loaded_policy()
   and verify lockdep_assert_held(&ima_write_mutex) as suggested by Mimi.
 - Initialize file_len to zero in ima_measure_loaded_policy() as
   suggested by Mimi.
 - Changed ima_measure_policy_buf() returned error from -ENOPARAM to
   -EINVAL as suggested by Mimi.
 - Changed event name from "ima_write_policy_buf" to "ima_policy_written"
   as suggested by Mimi.
 - Updated patches description.

Changes in v3:
 - Include the newly defined critical-data rule only if a signed policy is
   not mandatory as suggested by Mimi.
 - Removed the ima_policy_text_len() function as suggested by Mimi.
 - Moved policy input buffer measurement from process_measurement() to
   process_buffer_measurement() as suggested by Mimi.
 - Changed ima_measure_policy_write() function name to ima_measure_policy_buf()
   as suggested by Mimi.
 - Updated patches description.

Changes in v2:
 - Set a new critical-data rule for measuring the loaded IMA policy.
 - Add the new critical-data rule to the specific arch policy rules.
 - Add patch #2 for measuring the input buffer sent to the securityfs
   policy file.

Enrico Bravi (2):
  ima: measure loaded policy after write on securityfs policy file
  ima: measure buffer sent to securityfs policy file

 security/integrity/ima/ima.h        |  4 ++
 security/integrity/ima/ima_efi.c    |  2 +
 security/integrity/ima/ima_fs.c     |  7 ++-
 security/integrity/ima/ima_main.c   | 19 ++++++++
 security/integrity/ima/ima_policy.c | 73 ++++++++++++++++++++++++++++-
 5 files changed, 102 insertions(+), 3 deletions(-)


base-commit: 8cd9520d35a6c38db6567e97dd93b1f11f185dc6
-- 
2.52.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-06-29 16:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-17 15:58 [PATCH v4 0/2] ima: measure write on securityfs policy file Enrico Bravi
2026-06-17 15:58 ` [PATCH v4 1/2] ima: measure loaded policy after " Enrico Bravi
2026-06-24 20:35   ` Mimi Zohar
2026-06-25 14:17     ` Mimi Zohar
2026-06-26  9:36       ` Enrico  Bravi
2026-06-26  9:32     ` Enrico  Bravi
2026-06-26 13:37       ` Mimi Zohar
2026-06-17 15:58 ` [PATCH v4 2/2] ima: measure buffer sent to " Enrico Bravi
2026-06-25  1:05   ` Mimi Zohar
2026-06-29  9:26     ` Enrico  Bravi
2026-06-29 16:38       ` Mimi Zohar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox