[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200828160021.11537-4-nramas@linux.microsoft.com>
Date: Fri, 28 Aug 2020 09:00:21 -0700
From: Lakshmi Ramasubramanian <nramas@...ux.microsoft.com>
To: zohar@...ux.ibm.com, stephen.smalley.work@...il.com,
casey@...aufler-ca.com
Cc: tyhicks@...ux.microsoft.com, tusharsu@...ux.microsoft.com,
sashal@...nel.org, jmorris@...ei.org,
linux-integrity@...r.kernel.org, selinux@...r.kernel.org,
linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH v2 3/3] IMA: Support early boot measurement of critical data
The IMA hook, namely ima_measure_critical_data(), to measure kernel
critical data requires a custom IMA policy to be loaded.
Update ima_measure_critical_data() to utilize early boot measurement
support to defer processing data if a custom IMA policy is not yet
loaded.
Signed-off-by: Lakshmi Ramasubramanian <nramas@...ux.microsoft.com>
---
security/integrity/ima/ima_main.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
index 41be4d1d839e..ce0ef310c575 100644
--- a/security/integrity/ima/ima_main.c
+++ b/security/integrity/ima/ima_main.c
@@ -885,12 +885,22 @@ int ima_measure_critical_data(const char *event_name,
const void *buf, int buf_len,
bool measure_buf_hash)
{
+ bool queued = false;
+
if (!event_name || !event_data_source || !buf || !buf_len)
return -EINVAL;
if (!ima_kernel_data_source_is_supported(event_data_source))
return -EPERM;
+ if (ima_should_queue_data())
+ queued = ima_queue_data(event_name, buf, buf_len,
+ event_data_source, CRITICAL_DATA,
+ measure_buf_hash);
+
+ if (queued)
+ return 0;
+
return process_buffer_measurement(NULL, buf, buf_len, event_name,
CRITICAL_DATA, 0, event_data_source,
measure_buf_hash);
--
2.28.0
Powered by blists - more mailing lists