@@ -22,6 +22,7 @@ static struct ima_template_desc builtin_templates[] = {
{.name = "ima-sig", .fmt = "d-ng|n-ng|sig"},
{.name = "ima-buf", .fmt = "d-ng|n-ng|buf"},
{.name = "ima-modsig", .fmt = "d-ng|n-ng|sig|d-modsig|modsig"},
+ {.name = "ima-ns", .fmt = "d-ng|n-ng|ns"},
{.name = "", .fmt = ""}, /* placeholder for a custom format */
};
@@ -45,6 +46,8 @@ static const struct ima_template_field supported_fields[] = {
.field_show = ima_show_template_digest_ng},
{.field_id = "modsig", .field_init = ima_eventmodsig_init,
.field_show = ima_show_template_sig},
+ {.field_id = "ns", .field_init = ima_eventns_init,
+ .field_show = ima_show_template_buf},
};
/*
@@ -52,7 +55,7 @@ static const struct ima_template_field supported_fields[] = {
* need to be accounted for since they shouldn't be defined in the same template
* description as 'd-ng' and 'n-ng' respectively.
*/
-#define MAX_TEMPLATE_NAME_LEN sizeof("d-ng|n-ng|sig|buf|d-modisg|modsig")
+#define MAX_TEMPLATE_NAME_LEN sizeof("d-ng|n-ng|sig|buf|d-modisg|modsig|ns")
static struct ima_template_desc *ima_template;
@@ -484,3 +484,16 @@ int ima_eventmodsig_init(struct ima_event_data *event_data,
return ima_write_template_field_data(data, data_len, DATA_FMT_HEX,
field_data);
}
+
+/*
+ * ima_eventns_init - include the ima namespace id as part of the
+ * template data
+ */
+int ima_eventns_init(struct ima_event_data *event_data,
+ struct ima_field_data *field_data)
+{
+ return ima_write_template_field_data(&(event_data->ns_id),
+ sizeof(event_data->ns_id),
+ DATA_FMT_HEX,
+ field_data);
+}
@@ -46,4 +46,6 @@ int ima_eventbuf_init(struct ima_event_data *event_data,
struct ima_field_data *field_data);
int ima_eventmodsig_init(struct ima_event_data *event_data,
struct ima_field_data *field_data);
+int ima_eventns_init(struct ima_event_data *event_data,
+ struct ima_field_data *field_data);
#endif /* __LINUX_IMA_TEMPLATE_LIB_H */