The end-users of DM devices/targets may remove and re-create the same
device multiple times.  IMA does not measure such duplicate events if the
configuration CONFIG_IMA_DISABLE_HTABLE is set to 'n'.
To avoid confusion, the end-users need some indication on the client
if that configuration option is disabled.

Add a one-time warning to dmesg during dm_init if
CONFIG_IMA_DISABLE_HTABLE is set to 'n', to notify the end-users that
duplicate events will not be measured in the ima log.

Signed-off-by: Tushar Sugandhi <[email protected]>
---
 drivers/md/dm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 2e82757b4ab7..948cb0dc5fc4 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -265,6 +265,12 @@ static int __init dm_init(void)
 
        int r, i;
 
+#if (IS_ENABLED(CONFIG_BLK_DEV_DM) && IS_ENABLED(CONFIG_IMA) \
+       && !IS_ENABLED(CONFIG_IMA_DISABLE_HTABLE))
+       DMWARN("CONFIG_IMA_DISABLE_HTABLE is disabled."
+              " Duplicate IMA measurements will not be recorded in the IMA 
log.");
+#endif
+
        for (i = 0; i < count; i++) {
                r = _inits[i]();
                if (r)
-- 
2.32.0


--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

Reply via email to