Skip to content

Commit fed2512

Browse files
Mimi ZoharJames Morris
authored andcommitted
ima: based on policy require signed firmware (sysfs fallback)
With an IMA policy requiring signed firmware, this patch prevents the sysfs fallback method of loading firmware. Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com> Reviewed-by: Kees Cook <keescook@chromium.org> Cc: Luis R. Rodriguez <mcgrof@suse.com> Cc: Matthew Garrett <mjg59@google.com> Signed-off-by: James Morris <james.morris@microsoft.com>
1 parent 6e85265 commit fed2512

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎security/integrity/ima/ima_main.c‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,10 @@ int ima_post_read_file(struct file *file, void *buf, loff_t size,
472472

473473
if (!file && read_id == READING_FIRMWARE) {
474474
if ((ima_appraise & IMA_APPRAISE_FIRMWARE) &&
475-
(ima_appraise & IMA_APPRAISE_ENFORCE))
475+
(ima_appraise & IMA_APPRAISE_ENFORCE)) {
476+
pr_err("Prevent firmware loading_store.\n");
476477
return -EACCES; /* INTEGRITY_UNKNOWN */
478+
}
477479
return 0;
478480
}
479481

@@ -517,6 +519,12 @@ int ima_load_data(enum kernel_load_data_id id)
517519
pr_err("impossible to appraise a kernel image without a file descriptor; try using kexec_file_load syscall.\n");
518520
return -EACCES; /* INTEGRITY_UNKNOWN */
519521
}
522+
break;
523+
case LOADING_FIRMWARE:
524+
if (ima_appraise & IMA_APPRAISE_FIRMWARE) {
525+
pr_err("Prevent firmware sysfs fallback loading.\n");
526+
return -EACCES; /* INTEGRITY_UNKNOWN */
527+
}
520528
default:
521529
break;
522530
}

0 commit comments

Comments
 (0)