Skip to contentSkip to conversation

ima: store the builtin/custom template definitions in a list

PATCH New [email protected] 1 participant 1 message Dec 20, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 7/15 ima: store the builtin/custom template definitions in a list

From: Mimi Zohar <[email protected]>
Subject: ima: store the builtin/custom template definitions in a list

The builtin and single custom templates are currently stored in an array. In preparation for being able to restore a measurement list containing multiple builtin/custom templates, this patch stores the builtin and custom templates as a linked list. This will permit defining more than one custom template per boot.

Cc Thiago Jung Bauermann <[email protected]>
Cc "Eric W. Biederman" <[email protected]>
Cc Andreas Steffen <[email protected]>
Cc Josh Sklar <[email protected]>
Cc Dave Young <[email protected]>
Cc Vivek Goyal <[email protected]>
Cc Baoquan He <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Stewart Smith <[email protected]>

---

 security/integrity/ima/ima.h          |    2 
 security/integrity/ima/ima_main.c     |    1 
 security/integrity/ima/ima_template.c |   51 ++++++++++++++++++------
 3 files changed, 43 insertions(+), 11 deletions(-)
security/integrity/ima/ima.h renamed from security/integrity/ima/ima.h~ima-store-the-builtin-custom-template-definitions-in-a-list +2 -0
diff -puN security/integrity/ima/ima.h~ima-store-the-builtin-custom-template-definitions-in-a-list security/integrity/ima/ima.h
@@ -85,6 +85,7 @@ struct ima_template_field {
 
 /* IMA template descriptor definition */
 struct ima_template_desc {
+	struct list_head list;
 	char *name;
 	char *fmt;
 	int num_fields;
@@ -146,6 +147,7 @@ int ima_restore_measurement_list(loff_t
 int ima_measurements_show(struct seq_file *m, void *v);
 unsigned long ima_get_binary_runtime_size(void);
 int ima_init_template(void);
+void ima_init_template_list(void);
 
 /*
  * used to protect h_table and sha_table
security/integrity/ima/ima_main.c renamed from security/integrity/ima/ima_main.c~ima-store-the-builtin-custom-template-definitions-in-a-list +1 -0
diff -puN security/integrity/ima/ima_main.c~ima-store-the-builtin-custom-template-definitions-in-a-list security/integrity/ima/ima_main.c
@@ -418,6 +418,7 @@ static int __init init_ima(void)
 {
 	int error;
 
+	ima_init_template_list();
 	hash_setup(CONFIG_IMA_DEFAULT_HASH);
 	error = ima_init();
 	if (!error) {
security/integrity/ima/ima_template.c renamed from security/integrity/ima/ima_template.c~ima-store-the-builtin-custom-template-definitions-in-a-list +40 -11

102 lines not on this page · raw message

_