diff options
-rw-r--r-- | init/Kconfig | 4 | ||||
-rw-r--r-- | security/integrity/ima/ima_audit.c | 5 | ||||
-rw-r--r-- | security/integrity/ima/ima_policy.c | 14 |
3 files changed, 10 insertions, 13 deletions
diff --git a/init/Kconfig b/init/Kconfig index 96ee3f32fe36..570cd337e961 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -923,10 +923,6 @@ config UIDGID_CONVERTED | |||
923 | bool | 923 | bool |
924 | default y | 924 | default y |
925 | 925 | ||
926 | # List of kernel pieces that need user namespace work | ||
927 | # Features | ||
928 | depends on IMA = n | ||
929 | |||
930 | # Networking | 926 | # Networking |
931 | depends on NET_9P = n | 927 | depends on NET_9P = n |
932 | 928 | ||
diff --git a/security/integrity/ima/ima_audit.c b/security/integrity/ima/ima_audit.c index 7a57f6769e9c..c586faae8fd6 100644 --- a/security/integrity/ima/ima_audit.c +++ b/security/integrity/ima/ima_audit.c | |||
@@ -39,8 +39,9 @@ void integrity_audit_msg(int audit_msgno, struct inode *inode, | |||
39 | 39 | ||
40 | ab = audit_log_start(current->audit_context, GFP_KERNEL, audit_msgno); | 40 | ab = audit_log_start(current->audit_context, GFP_KERNEL, audit_msgno); |
41 | audit_log_format(ab, "pid=%d uid=%u auid=%u ses=%u", | 41 | audit_log_format(ab, "pid=%d uid=%u auid=%u ses=%u", |
42 | current->pid, current_cred()->uid, | 42 | current->pid, |
43 | audit_get_loginuid(current), | 43 | from_kuid(&init_user_ns, current_cred()->uid), |
44 | from_kuid(&init_user_ns, audit_get_loginuid(current)), | ||
44 | audit_get_sessionid(current)); | 45 | audit_get_sessionid(current)); |
45 | audit_log_task_context(ab); | 46 | audit_log_task_context(ab); |
46 | audit_log_format(ab, " op="); | 47 | audit_log_format(ab, " op="); |
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c index 1a9583008aae..c84df05180cb 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c | |||
@@ -39,7 +39,7 @@ struct ima_measure_rule_entry { | |||
39 | enum ima_hooks func; | 39 | enum ima_hooks func; |
40 | int mask; | 40 | int mask; |
41 | unsigned long fsmagic; | 41 | unsigned long fsmagic; |
42 | uid_t uid; | 42 | kuid_t uid; |
43 | struct { | 43 | struct { |
44 | void *rule; /* LSM file metadata specific */ | 44 | void *rule; /* LSM file metadata specific */ |
45 | int type; /* audit type */ | 45 | int type; /* audit type */ |
@@ -71,7 +71,7 @@ static struct ima_measure_rule_entry default_rules[] = { | |||
71 | .flags = IMA_FUNC | IMA_MASK}, | 71 | .flags = IMA_FUNC | IMA_MASK}, |
72 | {.action = MEASURE,.func = BPRM_CHECK,.mask = MAY_EXEC, | 72 | {.action = MEASURE,.func = BPRM_CHECK,.mask = MAY_EXEC, |
73 | .flags = IMA_FUNC | IMA_MASK}, | 73 | .flags = IMA_FUNC | IMA_MASK}, |
74 | {.action = MEASURE,.func = FILE_CHECK,.mask = MAY_READ,.uid = 0, | 74 | {.action = MEASURE,.func = FILE_CHECK,.mask = MAY_READ,.uid = GLOBAL_ROOT_UID, |
75 | .flags = IMA_FUNC | IMA_MASK | IMA_UID}, | 75 | .flags = IMA_FUNC | IMA_MASK | IMA_UID}, |
76 | }; | 76 | }; |
77 | 77 | ||
@@ -112,7 +112,7 @@ static bool ima_match_rules(struct ima_measure_rule_entry *rule, | |||
112 | if ((rule->flags & IMA_FSMAGIC) | 112 | if ((rule->flags & IMA_FSMAGIC) |
113 | && rule->fsmagic != inode->i_sb->s_magic) | 113 | && rule->fsmagic != inode->i_sb->s_magic) |
114 | return false; | 114 | return false; |
115 | if ((rule->flags & IMA_UID) && rule->uid != cred->uid) | 115 | if ((rule->flags & IMA_UID) && !uid_eq(rule->uid, cred->uid)) |
116 | return false; | 116 | return false; |
117 | for (i = 0; i < MAX_LSM_RULES; i++) { | 117 | for (i = 0; i < MAX_LSM_RULES; i++) { |
118 | int rc = 0; | 118 | int rc = 0; |
@@ -277,7 +277,7 @@ static int ima_parse_rule(char *rule, struct ima_measure_rule_entry *entry) | |||
277 | 277 | ||
278 | ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_INTEGRITY_RULE); | 278 | ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_INTEGRITY_RULE); |
279 | 279 | ||
280 | entry->uid = -1; | 280 | entry->uid = INVALID_UID; |
281 | entry->action = UNKNOWN; | 281 | entry->action = UNKNOWN; |
282 | while ((p = strsep(&rule, " \t")) != NULL) { | 282 | while ((p = strsep(&rule, " \t")) != NULL) { |
283 | substring_t args[MAX_OPT_ARGS]; | 283 | substring_t args[MAX_OPT_ARGS]; |
@@ -361,15 +361,15 @@ static int ima_parse_rule(char *rule, struct ima_measure_rule_entry *entry) | |||
361 | case Opt_uid: | 361 | case Opt_uid: |
362 | ima_log_string(ab, "uid", args[0].from); | 362 | ima_log_string(ab, "uid", args[0].from); |
363 | 363 | ||
364 | if (entry->uid != -1) { | 364 | if (uid_valid(entry->uid)) { |
365 | result = -EINVAL; | 365 | result = -EINVAL; |
366 | break; | 366 | break; |
367 | } | 367 | } |
368 | 368 | ||
369 | result = strict_strtoul(args[0].from, 10, &lnum); | 369 | result = strict_strtoul(args[0].from, 10, &lnum); |
370 | if (!result) { | 370 | if (!result) { |
371 | entry->uid = (uid_t) lnum; | 371 | entry->uid = make_kuid(current_user_ns(), (uid_t)lnum); |
372 | if (entry->uid != lnum) | 372 | if (!uid_valid(entry->uid) || (((uid_t)lnum) != lnum)) |
373 | result = -EINVAL; | 373 | result = -EINVAL; |
374 | else | 374 | else |
375 | entry->flags |= IMA_UID; | 375 | entry->flags |= IMA_UID; |