diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-01-07 10:37:36 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-01-07 10:37:36 -0500 |
commit | 7991b03d653865e4de7e6c056f85c004f542dbbe (patch) | |
tree | 8c96f4f81f2b1d660d89b9a503afd0aa813f4110 | |
parent | 0c4a842349b27d361f1503f6437df303e1b541c9 (diff) | |
parent | ade24c93ab173b392a905ef8d510874dfb05a417 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull integrity subsystem regression fix from James Morris:
"Commit fdf90729e578 "ima: support new kernel module syscall" by error
modified init_module() to return INTEGRITY_UNKNOWN (which is 4) to
user space if the kernel was built with CONFIG_IMA_APPRAISE=y.
As a result, user space can no longer load kernel modules using
init_module(). This commit fixes this regression."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
ima: fallback to MODULE_SIG_ENFORCE for existing kernel module syscall
-rw-r--r-- | security/integrity/ima/ima.h | 1 | ||||
-rw-r--r-- | security/integrity/ima/ima_main.c | 12 | ||||
-rw-r--r-- | security/integrity/ima/ima_policy.c | 3 |
3 files changed, 11 insertions, 5 deletions
diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h index 3b2adb794f1..079a85dc37b 100644 --- a/security/integrity/ima/ima.h +++ b/security/integrity/ima/ima.h | |||
@@ -139,6 +139,7 @@ void ima_delete_rules(void); | |||
139 | /* Appraise integrity measurements */ | 139 | /* Appraise integrity measurements */ |
140 | #define IMA_APPRAISE_ENFORCE 0x01 | 140 | #define IMA_APPRAISE_ENFORCE 0x01 |
141 | #define IMA_APPRAISE_FIX 0x02 | 141 | #define IMA_APPRAISE_FIX 0x02 |
142 | #define IMA_APPRAISE_MODULES 0x04 | ||
142 | 143 | ||
143 | #ifdef CONFIG_IMA_APPRAISE | 144 | #ifdef CONFIG_IMA_APPRAISE |
144 | int ima_appraise_measurement(struct integrity_iint_cache *iint, | 145 | int ima_appraise_measurement(struct integrity_iint_cache *iint, |
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c index 45de18e9a6f..dba965de90d 100644 --- a/security/integrity/ima/ima_main.c +++ b/security/integrity/ima/ima_main.c | |||
@@ -291,11 +291,15 @@ EXPORT_SYMBOL_GPL(ima_file_check); | |||
291 | */ | 291 | */ |
292 | int ima_module_check(struct file *file) | 292 | int ima_module_check(struct file *file) |
293 | { | 293 | { |
294 | int rc; | 294 | int rc = 0; |
295 | 295 | ||
296 | if (!file) | 296 | if (!file) { |
297 | rc = INTEGRITY_UNKNOWN; | 297 | if (ima_appraise & IMA_APPRAISE_MODULES) { |
298 | else | 298 | #ifndef CONFIG_MODULE_SIG_FORCE |
299 | rc = -EACCES; /* INTEGRITY_UNKNOWN */ | ||
300 | #endif | ||
301 | } | ||
302 | } else | ||
299 | rc = process_measurement(file, file->f_dentry->d_name.name, | 303 | rc = process_measurement(file, file->f_dentry->d_name.name, |
300 | MAY_EXEC, MODULE_CHECK); | 304 | MAY_EXEC, MODULE_CHECK); |
301 | return (ima_appraise & IMA_APPRAISE_ENFORCE) ? rc : 0; | 305 | return (ima_appraise & IMA_APPRAISE_ENFORCE) ? rc : 0; |
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c index af7d182d5a4..479fca940bb 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c | |||
@@ -523,7 +523,8 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) | |||
523 | } | 523 | } |
524 | if (!result && (entry->action == UNKNOWN)) | 524 | if (!result && (entry->action == UNKNOWN)) |
525 | result = -EINVAL; | 525 | result = -EINVAL; |
526 | 526 | else if (entry->func == MODULE_CHECK) | |
527 | ima_appraise |= IMA_APPRAISE_MODULES; | ||
527 | audit_log_format(ab, "res=%d", !result); | 528 | audit_log_format(ab, "res=%d", !result); |
528 | audit_log_end(ab); | 529 | audit_log_end(ab); |
529 | return result; | 530 | return result; |