Skip to contentSkip to conversation

ima: fix uid code style problems

PATCH In review Alex Henrie 2 participants 4 messages Oct 7, 2021 – Oct 8, 2021

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

PATCH v3 1/2 ima: fix uid code style problems

scripts/checkpatch.pl wants function arguments to have names, and Mimi prefers to keep the line length in functions to 80 characters or less.

---
v3: New patch

---
 security/integrity/ima/ima_policy.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
security/integrity/ima/ima_policy.c +6 -4
index 87b9b71cb820..29741eaa0ed8 100644
@@ -79,8 +79,8 @@ struct ima_rule_entry {
 	uuid_t fsuuid;
 	kuid_t uid;
 	kuid_t fowner;
-	bool (*uid_op)(kuid_t, kuid_t);    /* Handlers for operators       */
-	bool (*fowner_op)(kuid_t, kuid_t); /* uid_eq(), uid_gt(), uid_lt() */
+	bool (*uid_op)(kuid_t cred_uid, kuid_t rule_uid);    /* Handlers for operators       */
+	bool (*fowner_op)(kuid_t cred_uid, kuid_t rule_uid); /* uid_eq(), uid_gt(), uid_lt() */
 	int pcr;
 	unsigned int allowed_algos; /* bitfield of allowed hash algorithms */
 	struct {
@@ -1546,8 +1546,10 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
 
 			result = kstrtoul(args[0].from, 10, &lnum);
 			if (!result) {
-				entry->fowner = make_kuid(current_user_ns(), (uid_t)lnum);
-				if (!uid_valid(entry->fowner) || (((uid_t)lnum) != lnum))
+				entry->fowner = make_kuid(current_user_ns(),
+							  (uid_t)lnum);
+				if (!uid_valid(entry->fowner) ||
+				    (((uid_t)lnum) != lnum))
 					result = -EINVAL;
 				else
 					entry->flags |= IMA_FOWNER;
Signature · 1 line
2.33.0
#1 lore raw

PATCH v3 2/2 ima: add gid support

From: Curtis Veit <[email protected]>

IMA currently supports the concept of rules based on uid where the rule is based on the uid of the file owner or the uid of the user accessing the file. Provide the ability to have similar rules based on gid.

---
v3:
- Give function arguments names
- Fix order of arguments to gid_op
- Shorten commit message

---
 Documentation/ABI/testing/ima_policy |   8 +-
 security/integrity/ima/ima_policy.c  | 201 +++++++++++++++++++++++----
 2 files changed, 180 insertions(+), 29 deletions(-)
Documentation/ABI/testing/ima_policy +6 -2
index 5c2798534950..e1a04bd3b9e5 100644
@@ -22,8 +22,9 @@ Description:
 		  action: measure | dont_measure | appraise | dont_appraise |
 			  audit | hash | dont_hash
 		  condition:= base | lsm  [option]
-			base:	[[func=] [mask=] [fsmagic=] [fsuuid=] [uid=]
-				[euid=] [fowner=] [fsname=]]
+			base:	[[func=] [mask=] [fsmagic=] [fsuuid=] [fsname=]
+				[uid=] [euid=] [gid=] [egid=]
+				[fowner=] [fgroup=]]
 			lsm:	[[subj_user=] [subj_role=] [subj_type=]
 				 [obj_user=] [obj_role=] [obj_type=]]
 			option:	[[appraise_type=]] [template=] [permit_directio]
@@ -40,7 +41,10 @@ Description:
 			fsuuid:= file system UUID (e.g 8bcbe394-4f13-4144-be8e-5aa9ea2ce2f6)
 			uid:= decimal value
 			euid:= decimal value
+			gid:= decimal value
+			egid:= decimal value
 			fowner:= decimal value
+			fgroup:= decimal value
 		  lsm:  are LSM specific
 		  option:
 			appraise_type:= [imasig] [imasig|modsig]
security/integrity/ima/ima_policy.c +174 -27

354 lines not on this page · raw message

Signature · 1 line
2.33.0