Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1704248

[PATCH v4 6/7] ima: Store measurement after appraisal

From Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject [PATCH v4 6/7] ima: Store measurement after appraisal
Date 2017-08-05 00:10 +0200
Message-ID <uaSX9-4qq-39@gated-at.bofh.it> (permalink)
References <uaSX8-4qq-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


When module-style signatures appended at the end of files are supported for
IMA appraisal, the code will fallback to the xattr signature if the
appended one fails to verify.

The problem is that we don't know whether we need to fallback to the xattr
signature until the appraise step, and by then the measure step was already
completed and would need to be done again in case the template includes the
signature.

To avoid this problem, do the appraisal first so that the correct signature
is stored by the template in the measure step.

Signed-off-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
---
 security/integrity/ima/ima_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
index 2aebb7984437..0b4845e7248d 100644
--- a/security/integrity/ima/ima_main.c
+++ b/security/integrity/ima/ima_main.c
@@ -244,12 +244,12 @@ static int process_measurement(struct file *file, char *buf, loff_t size,
 	if (!pathbuf)	/* ima_rdwr_violation possibly pre-fetched */
 		pathname = ima_d_path(&file->f_path, &pathbuf, filename);
 
-	if (action & IMA_MEASURE)
-		ima_store_measurement(iint, file, pathname,
-				      xattr_value, xattr_len, pcr);
 	if (action & IMA_APPRAISE_SUBMASK)
 		rc = ima_appraise_measurement(func, iint, file, pathname,
 					      xattr_value, xattr_len, opened);
+	if (action & IMA_MEASURE)
+		ima_store_measurement(iint, file, pathname,
+				      xattr_value, xattr_len, pcr);
 	if (action & IMA_AUDIT)
 		ima_audit_measurement(iint, pathname);
 
-- 
2.13.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 0/7] Appended signatures support for IMA appraisal Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> - 2017-08-05 00:10 +0200
  [PATCH v4 6/7] ima: Store measurement after appraisal Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> - 2017-08-05 00:10 +0200
  [PATCH v4 3/7] PKCS#7: Introduce pkcs7_get_message_sig and verify_pkcs7_message_sig Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> - 2017-08-05 00:10 +0200
  [PATCH v4 1/7] integrity: Introduce struct evm_xattr Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> - 2017-08-05 00:10 +0200
  [PATCH v4 2/7] MODSIGN: Export module signature definitions Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> - 2017-08-05 00:10 +0200

csiph-web