IMA: Add log statements for failure conditions
Subsystems (4)
PATCH 1/1 IMA: Add log statements for failure conditions
The final log statement in process_buffer_measurement() for failure condition is at debug level. This does not log the message unless the system log level is raised which would significantly increase the messages in the system log. Change this log message to error level, and add eventname and ima_hooks enum to the message for better triaging failures in the function.
ima_alloc_key_entry() does not log a message for failure condition. Add an error message for failure condition in this function.
--- security/integrity/ima/ima_main.c | 3 ++- security/integrity/ima/ima_queue_keys.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)
security/integrity/ima/ima_main.c +2 -1
@@ -756,7 +756,8 @@ void process_buffer_measurement(const void *buf, int size, out:if (ret <0 ) -pr_devel ("%s: failed, result: %d\n" , __func__, ret); +pr_err ("%s failed. eventname: %s, func: %d, result: %d\n" , + __func__, eventname, func, ret);return ; }
security/integrity/ima/ima_queue_keys.c +2 -0
@@ -88,6 +88,8 @@ static struct ima_key_entry *ima_alloc_key_entry(struct key *keyring, out:if (rc) { +pr_err ("%s failed. keyring: %s, result: %d\n" , + __func__, keyring->description, rc);ima_free_key_entry (entry); entry =NULL ; }
Signature · 1 line
2.27.0
Mimi Zohar
maintainer[Cc'ing Paul Moore]
Hi Lakshmi,
Quoted 11 lines · Lakshmi Ramasubramanian
The final log statement in
process_buffer_measurement()for failure condition is at debug level. This does not log the message unless the system log level is raised which would significantly increase the messages in the system log. Change this log message to error level, and add eventname andima_hooksenum to the message for better triaging failures in the function.
ima_alloc_key_entry()does not log a message for failure condition. Add an error message for failure condition in this function.Signed-off-by Lakshmi Ramasubramanian <[email protected]>
These messages should probably be turned into audit messages. Look at integerity_audit_msg().
Mimi
Quoted 32 lines
--- security/integrity/ima/ima_main.c | 3 ++- security/integrity/ima/ima_queue_keys.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)security/integrity/ima/ima_main.c +2
-1@@ -756,7 +756,8 @@ void process_buffer_measurement(const void *buf, int size, out:if (ret <0 ) -pr_devel ("%s: failed, result: %d\n" , __func__, ret); +pr_err ("%s failed. eventname: %s, func: %d, result: %d\n" , + __func__, eventname, func, ret);return ; }security/integrity/ima/ima_queue_keys.c +2
-0@@ -88,6 +88,8 @@ static struct ima_key_entry *ima_alloc_key_entry(struct key *keyring, out:if (rc) { +pr_err ("%s failed. keyring: %s, result: %d\n" , + __func__, keyring->description, rc);ima_free_key_entry (entry); entry =NULL ; }
Paul Moore
maintainerQuoted 2 lines · Mimi Zohar
[Cc'ing Paul Moore]
If it's audit related, it's generally best to CC the linux-audit list, not just me (fixed).
It's not clear to me what this pr_err() is trying to indicate other than *something* failed. Can someone provide some more background on this message?
Quoted 53 lines
Hi Lakshmi,
Quoted 11 lines · Lakshmi Ramasubramanian
The final log statement in
process_buffer_measurement()for failure condition is at debug level. This does not log the message unless the system log level is raised which would significantly increase the messages in the system log. Change this log message to error level, and add eventname andima_hooksenum to the message for better triaging failures in the function.
ima_alloc_key_entry()does not log a message for failure condition. Add an error message for failure condition in this function.Signed-off-by Lakshmi Ramasubramanian <[email protected]>These messages should probably be turned into audit messages. Look at
integerity_audit_msg().Mimi
Quoted 32 lines
--- security/integrity/ima/ima_main.c | 3 ++- security/integrity/ima/ima_queue_keys.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)security/integrity/ima/ima_main.c +2
-1@@ -756,7 +756,8 @@ void process_buffer_measurement(const void *buf, int size, out:if (ret <0 ) -pr_devel ("%s: failed, result: %d\n" , __func__, ret); +pr_err ("%s failed. eventname: %s, func: %d, result: %d\n" , + __func__, eventname, func, ret);return ; }security/integrity/ima/ima_queue_keys.c +2
-0@@ -88,6 +88,8 @@ static struct ima_key_entry *ima_alloc_key_entry(struct key *keyring, out:if (rc) { +pr_err ("%s failed. keyring: %s, result: %d\n" , + __func__, keyring->description, rc);ima_free_key_entry (entry); entry =NULL ; }
Signature · 2 lines
paul moore www.paul-moore.com
Quoted 6 lines · Paul Moore
If it's audit related, it's generally best to CC the linux-audit list, not just me (fixed).
It's not clear to me what this
pr_err()is trying to indicate other than *something* failed. Can someone provide some more background on this message?
process_buffer_measurement() is currently used to measure
"kexec command line", "keys", and "blacklist-hash". If there was any error in the measurement, this pr_err() will indicate which of the above measurement failed and the related error code.
Please let me know if you need more info on this one.
Since a pr_xyz() call was already present, I just wanted to change the log level to keep the code change to the minimum. But if audit log is the right approach for this case, I'll update.
thanks,
-lakshmi
Paul Moore
maintainerQuoted 9 lines · Lakshmi Ramasubramanian
Quoted 6 lines · Paul Moore
If it's audit related, it's generally best to CC the linux-audit list, not just me (fixed).
It's not clear to me what this
pr_err()is trying to indicate other than *something* failed. Can someone provide some more background on this message?
Quoted 6 lines
process_buffer_measurement()is currently used to measure "kexec command line", "keys", and "blacklist-hash". If there was any error in the measurement, thispr_err()will indicate which of the above measurement failed and the related error code.Please let me know if you need more info on this one.
That helps, thank you.
Quoted 3 lines
Since a
pr_xyz()call was already present, I just wanted to change the log level to keep the code change to the minimum. But if audit log is the right approach for this case, I'll update.
Generally we reserve audit for things that are required for various security certifications and/or "security relevant". From what you mentioned above, it seems like this would fall into the second category if not the first.
Looking at your patch it doesn't look like you are trying to record anything special so you may be able to use the existing integrity_audit_msg(...) helper. Of course then the question comes down to the audit record type (the audit_msgno argument), the operation (op), and the comm/cause (cause).
Do you feel that any of the existing audit record types are a good fit for this?
Signature · 2 lines
paul moore www.paul-moore.com
Quoted 10 lines · Paul Moore
Quoted 4 lines
Since a
pr_xyz()call was already present, I just wanted to change the log level to keep the code change to the minimum. But if audit log is the right approach for this case, I'll update.Generally we reserve audit for things that are required for various security certifications and/or "security relevant". From what you mentioned above, it seems like this would fall into the second category if not the first.
Quoted 8 lines
Looking at your patch it doesn't look like you are trying to record anything special so you may be able to use the existing
integrity_audit_msg(...)helper. Of course then the question comes down to the audit record type (theaudit_msgnoargument), the operation (op), and the comm/cause (cause).Do you feel that any of the existing audit record types are a good fit for this?
Maybe I can use the audit_msgno "AUDIT_INTEGRITY_PCR" with appropriate strings for "op" and "cause".
Mimi - please let me know if you think this audit_msgno would be ok to use. I see this code used, for instance, for boot aggregate measurement.
integrity_audit_msg(AUDIT_INTEGRITY_PCR, NULL, boot_aggregate_name, op,
audit_cause, result, 0);
thanks,
-lakshmi
Mimi Zohar
maintainerQuoted 21 lines · Lakshmi Ramasubramanian
Quoted 10 lines · Paul Moore
Quoted 4 lines
Since a
pr_xyz()call was already present, I just wanted to change the log level to keep the code change to the minimum. But if audit log is the right approach for this case, I'll update.Generally we reserve audit for things that are required for various security certifications and/or "security relevant". From what you mentioned above, it seems like this would fall into the second category if not the first.
Quoted 8 lines
Looking at your patch it doesn't look like you are trying to record anything special so you may be able to use the existing
integrity_audit_msg(...)helper. Of course then the question comes down to the audit record type (theaudit_msgnoargument), the operation (op), and the comm/cause (cause).Do you feel that any of the existing audit record types are a good fit for this?
Quoted 8 lines
Maybe I can use the
audit_msgno"AUDIT_INTEGRITY_PCR" with appropriate strings for "op" and "cause".Mimi - please let me know if you think this
audit_msgnowould be ok to use. I see this code used, for instance, for boot aggregate measurement.integrity_audit_msg(AUDIT_INTEGRITY_PCR, NULL,
boot_aggregate_name, op,audit_cause, result, 0);
Yes, AUDIT_INTEGRITY_PCR is also used for failures to add to the measurement list.
thanks,
Mimi
Quoted 4 lines · Mimi Zohar
Quoted 4 lines
Maybe I can use the
audit_msgno"AUDIT_INTEGRITY_PCR" with appropriate strings for "op" and "cause".
Quoted 9 lines
Quoted 5 lines
Mimi - please let me know if you think this
audit_msgnowould be ok to use. I see this code used, for instance, for boot aggregate measurement.integrity_audit_msg(AUDIT_INTEGRITY_PCR, NULL,
boot_aggregate_name, op,audit_cause, result, 0);Yes,
AUDIT_INTEGRITY_PCRis also used for failures to add to the measurement list.
thanks - i'll post an updated patch shortly.
-lakshmi