diff options
author | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2015-11-19 12:39:22 -0500 |
---|---|---|
committer | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2016-02-21 09:03:44 -0500 |
commit | e40ba6d56b41754b37b995dbc8035b2b3a6afd8a (patch) | |
tree | 0bbc573dde5374e434d6acd883b330f92645bfe2 /include/linux/lsm_hooks.h | |
parent | 09596b94f7d28595602482e69ed954deab707437 (diff) |
firmware: replace call to fw_read_file_contents() with kernel version
Replace the fw_read_file_contents with kernel_file_read_from_path().
Although none of the upstreamed LSMs define a kernel_fw_from_file hook,
IMA is called by the security function to prevent unsigned firmware from
being loaded and to measure/appraise signed firmware, based on policy.
Instead of reading the firmware twice, once for measuring/appraising the
firmware and again for reading the firmware contents into memory, the
kernel_post_read_file() security hook calculates the file hash based on
the in memory file buffer. The firmware is read once.
This patch removes the LSM kernel_fw_from_file() hook and security call.
Changelog v4+:
- revert dropped buf->size assignment - reported by Sergey Senozhatsky
v3:
- remove kernel_fw_from_file hook
- use kernel_file_read_from_path() - requested by Luis
v2:
- reordered and squashed firmware patches
- fix MAX firmware size (Kees Cook)
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Acked-by: Kees Cook <keescook@chromium.org>
Acked-by: Luis R. Rodriguez <mcgrof@kernel.org>
Diffstat (limited to 'include/linux/lsm_hooks.h')
-rw-r--r-- | include/linux/lsm_hooks.h | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index 2337f33913c1..7d04a1220223 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h | |||
@@ -541,15 +541,6 @@ | |||
541 | * @inode points to the inode to use as a reference. | 541 | * @inode points to the inode to use as a reference. |
542 | * The current task must be the one that nominated @inode. | 542 | * The current task must be the one that nominated @inode. |
543 | * Return 0 if successful. | 543 | * Return 0 if successful. |
544 | * @kernel_fw_from_file: | ||
545 | * Load firmware from userspace (not called for built-in firmware). | ||
546 | * @file contains the file structure pointing to the file containing | ||
547 | * the firmware to load. This argument will be NULL if the firmware | ||
548 | * was loaded via the uevent-triggered blob-based interface exposed | ||
549 | * by CONFIG_FW_LOADER_USER_HELPER. | ||
550 | * @buf pointer to buffer containing firmware contents. | ||
551 | * @size length of the firmware contents. | ||
552 | * Return 0 if permission is granted. | ||
553 | * @kernel_module_request: | 544 | * @kernel_module_request: |
554 | * Ability to trigger the kernel to automatically upcall to userspace for | 545 | * Ability to trigger the kernel to automatically upcall to userspace for |
555 | * userspace to load a kernel module with the given name. | 546 | * userspace to load a kernel module with the given name. |
@@ -1462,7 +1453,6 @@ union security_list_options { | |||
1462 | void (*cred_transfer)(struct cred *new, const struct cred *old); | 1453 | void (*cred_transfer)(struct cred *new, const struct cred *old); |
1463 | int (*kernel_act_as)(struct cred *new, u32 secid); | 1454 | int (*kernel_act_as)(struct cred *new, u32 secid); |
1464 | int (*kernel_create_files_as)(struct cred *new, struct inode *inode); | 1455 | int (*kernel_create_files_as)(struct cred *new, struct inode *inode); |
1465 | int (*kernel_fw_from_file)(struct file *file, char *buf, size_t size); | ||
1466 | int (*kernel_module_request)(char *kmod_name); | 1456 | int (*kernel_module_request)(char *kmod_name); |
1467 | int (*kernel_module_from_file)(struct file *file); | 1457 | int (*kernel_module_from_file)(struct file *file); |
1468 | int (*kernel_post_read_file)(struct file *file, char *buf, loff_t size, | 1458 | int (*kernel_post_read_file)(struct file *file, char *buf, loff_t size, |
@@ -1725,7 +1715,6 @@ struct security_hook_heads { | |||
1725 | struct list_head cred_transfer; | 1715 | struct list_head cred_transfer; |
1726 | struct list_head kernel_act_as; | 1716 | struct list_head kernel_act_as; |
1727 | struct list_head kernel_create_files_as; | 1717 | struct list_head kernel_create_files_as; |
1728 | struct list_head kernel_fw_from_file; | ||
1729 | struct list_head kernel_post_read_file; | 1718 | struct list_head kernel_post_read_file; |
1730 | struct list_head kernel_module_request; | 1719 | struct list_head kernel_module_request; |
1731 | struct list_head kernel_module_from_file; | 1720 | struct list_head kernel_module_from_file; |