|
@@ -429,16 +429,6 @@ void ima_post_path_mknod(struct dentry *dentry)
|
|
|
*/
|
|
|
int ima_read_file(struct file *file, enum kernel_read_file_id read_id)
|
|
|
{
|
|
|
- bool sig_enforce = is_module_sig_enforced();
|
|
|
-
|
|
|
- if (!file && read_id == READING_MODULE) {
|
|
|
- if (!sig_enforce && (ima_appraise & IMA_APPRAISE_MODULES) &&
|
|
|
- (ima_appraise & IMA_APPRAISE_ENFORCE)) {
|
|
|
- pr_err("impossible to appraise a module without a file descriptor. sig_enforce kernel parameter might help\n");
|
|
|
- return -EACCES; /* INTEGRITY_UNKNOWN */
|
|
|
- }
|
|
|
- return 0; /* We rely on module signature checking */
|
|
|
- }
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -479,9 +469,6 @@ int ima_post_read_file(struct file *file, void *buf, loff_t size,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- if (!file && read_id == READING_MODULE) /* MODULE_SIG_FORCE enabled */
|
|
|
- return 0;
|
|
|
-
|
|
|
/* permit signed certs */
|
|
|
if (!file && read_id == READING_X509_CERTIFICATE)
|
|
|
return 0;
|
|
@@ -510,6 +497,8 @@ int ima_post_read_file(struct file *file, void *buf, loff_t size,
|
|
|
*/
|
|
|
int ima_load_data(enum kernel_load_data_id id)
|
|
|
{
|
|
|
+ bool sig_enforce;
|
|
|
+
|
|
|
if ((ima_appraise & IMA_APPRAISE_ENFORCE) != IMA_APPRAISE_ENFORCE)
|
|
|
return 0;
|
|
|
|
|
@@ -525,6 +514,14 @@ int ima_load_data(enum kernel_load_data_id id)
|
|
|
pr_err("Prevent firmware sysfs fallback loading.\n");
|
|
|
return -EACCES; /* INTEGRITY_UNKNOWN */
|
|
|
}
|
|
|
+ break;
|
|
|
+ case LOADING_MODULE:
|
|
|
+ sig_enforce = is_module_sig_enforced();
|
|
|
+
|
|
|
+ if (!sig_enforce && (ima_appraise & IMA_APPRAISE_MODULES)) {
|
|
|
+ pr_err("impossible to appraise a module without a file descriptor. sig_enforce kernel parameter might help\n");
|
|
|
+ return -EACCES; /* INTEGRITY_UNKNOWN */
|
|
|
+ }
|
|
|
default:
|
|
|
break;
|
|
|
}
|