Skip to contentSkip to conversation

ima: Add a space after printing a LSM rule for readability

PATCH Superseded [email protected] 2 participants 3 messages Jan 3, 2020 – Jan 5, 2020

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ima: Add a space after printing a LSM rule for readability

From: Clay Chang <[email protected]>

When reading ima_policy from securityfs, there is a missing space between output string of LSM rules.

---
 security/integrity/ima/ima_policy.c | 1 +
 1 file changed, 1 insertion(+)
security/integrity/ima/ima_policy.c +1 -0
index ef8dfd47c7e3..1a266e4f99bc 100644
@@ -1496,6 +1496,7 @@ int ima_policy_show(struct seq_file *m, void *v)
 					   (char *)entry->lsm[i].args_p);
 				break;
 			}
+			seq_puts(m, " ");
 		}
 	}
 	if (entry->template)
Signature · 1 line
2.18.1
maintainer
#1 lore raw
Quoted 1 line · On Fri, 2020-01-03 at 15:51 +0800, [email protected] wrote:

From: Clay Chang <[email protected]>

Normally this "From" line is only seen when the sender isn't the patch author.  Any ideas what happened?

Quoted 5 lines

When reading ima_policy from securityfs, there is a missing space between output string of LSM rules.

Good catch!  IMA policy rules based on LSM labels are used to constrain which files are in policy.  Normally a single LSM label is enough (e.g. dont_measure obj_type=auditd_log_t).  Could you include in this patch description a use case where multiple LSM labels are needed?

thanks,

Mimi

Quoted 16 lines
---
 security/integrity/ima/ima_policy.c | 1 +
 1 file changed, 1 insertion(+)
security/integrity/ima/ima_policy.c +1 -0
index ef8dfd47c7e3..1a266e4f99bc 100644
@@ -1496,6 +1496,7 @@ int ima_policy_show(struct seq_file *m, void *v)
 					   (char *)entry->lsm[i].args_p);
 				break;
 			}
+			seq_puts(m, " ");
 		}
 	}
 	if (entry->template)
author
#2 lore raw
Quoted 6 lines · Mimi Zohar
Quoted 1 line · On Fri, 2020-01-03 at 15:51 +0800, [email protected] wrote:

From: Clay Chang <[email protected]>

Normally this "From" line is only seen when the sender isn't the patch author.  Any ideas what happened?

Hi Mimi,

Apparently I should not use "--from" in git-send-email command.

Quoted 4 lines
Quoted 4 lines

When reading ima_policy from securityfs, there is a missing space between output string of LSM rules.

Quoted 8 lines
Quoted 1 line

Good catch!  IMA policy rules based on LSM labels are used to constrain which files are in policy.  Normally a single LSM label is enough (e.g. dont_measure obj_type=auditd_log_t).  Could you include in this patch description a use case where multiple LSM labels are needed?

Apology for not expressed my intention clearly. The intention of this patch is to add a space after printing LSM rules (if any) and the remaining rules.

Currently, if I have a policy, for example:
appraise func=BPRM_CHECK obj_type=shell_exec_t appraise_type=imasig

The read back result is:
appraise func=BPRM_CHECK obj_type=shell_exec_tappraise_type=imasig

which is not correct.

I do not have a case for multiple LSM labels, but if there is one such case, this patch will also apply.

I will post a v2 patch with tuned description.

Thanks,
Clay