Kees Cook
b64fcae74b
LSM: Introduce kernel_post_load_data() hook
...
There are a few places in the kernel where LSMs would like to have
visibility into the contents of a kernel buffer that has been loaded or
read. While security_kernel_post_read_file() (which includes the
buffer) exists as a pairing for security_kernel_read_file(), no such
hook exists to pair with security_kernel_load_data().
Earlier proposals for just using security_kernel_post_read_file() with a
NULL file argument were rejected (i.e. "file" should always be valid for
the security_..._file hooks, but it appears at least one case was
left in the kernel during earlier refactoring. (This will be fixed in
a subsequent patch.)
Since not all cases of security_kernel_load_data() can have a single
contiguous buffer made available to the LSM hook (e.g. kexec image
segments are separately loaded), there needs to be a way for the LSM to
reason about its expectations of the hook coverage. In order to handle
this, add a "contents" argument to the "kernel_load_data" hook that
indicates if the newly added "kernel_post_load_data" hook will be called
with the full contents once loaded. That way, LSMs requiring full contents
can choose to unilaterally reject "kernel_load_data" with contents=false
(which is effectively the existing hook coverage), but when contents=true
they can allow it and later evaluate the "kernel_post_load_data" hook
once the buffer is loaded.
With this change, LSMs can gain coverage over non-file-backed data loads
(e.g. init_module(2) and firmware userspace helper), which will happen
in subsequent patches.
Additionally prepare IMA to start processing these cases.
Signed-off-by: Kees Cook <keescook@chromium.org >
Reviewed-by: KP Singh <kpsingh@google.com >
Link: https://lore.kernel.org/r/20201002173828.2099543-9-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-10-05 13:37:03 +02:00
..
2020-06-30 00:32:59 +02:00
2020-08-24 10:33:08 +02:00
2020-07-24 02:19:08 -07:00
2020-08-03 11:05:26 +02:00
2020-07-31 11:49:08 +02:00
2020-08-12 10:57:59 -07:00
2020-08-03 18:19:23 -07:00
2020-08-05 11:43:47 -07:00
2020-10-02 16:05:02 +02:00
2020-08-04 01:22:02 +02:00
2020-07-13 15:07:34 +01:00
2020-07-08 22:31:51 -07:00
2020-08-12 10:57:59 -07:00
2020-08-07 12:58:11 -07:00
2020-08-15 08:09:38 -07:00
2020-08-06 16:43:36 -07:00
2020-08-05 20:13:21 -07:00
2020-08-07 08:54:16 +02:00
2020-08-28 20:11:58 +02:00
2020-08-15 08:18:22 -07:00
2020-07-29 22:33:10 +02:00
2020-07-22 18:19:03 -07:00
2020-07-16 15:35:21 +02:00
2020-07-17 00:16:50 +01:00
2020-07-28 17:11:02 -07:00
2020-08-17 09:39:18 -07:00
2020-08-16 22:00:22 +01:00
2020-09-23 15:29:29 +05:30
2020-08-28 12:08:08 +02:00
2020-08-15 08:26:55 -07:00
2020-08-05 20:13:21 -07:00
2020-07-15 20:34:02 -07:00
2020-07-28 15:51:31 +01:00
2020-08-04 18:11:58 -07:00
2020-07-22 10:22:05 +02:00
2020-08-03 19:30:59 -07:00
2020-08-12 10:57:59 -07:00
2020-07-19 18:16:40 -07:00
2020-07-21 11:12:31 -04:00
2020-07-08 17:20:46 -06:00
2020-07-08 17:20:46 -06:00
2020-07-20 10:27:11 +01:00
2020-07-21 08:24:52 -05:00
2020-06-29 09:09:08 -06:00
2020-08-10 12:16:51 -07:00
2020-07-08 10:48:35 -07:00
2020-07-17 07:15:10 -06:00
2020-07-08 17:05:53 -06:00
2020-07-28 10:22:19 -06:00
2020-08-05 11:12:34 -07:00
2020-07-17 20:18:16 -07:00
2020-07-25 20:16:35 -07:00
2020-07-17 20:18:16 -07:00
2020-08-06 16:39:14 -07:00
2020-07-24 15:41:54 -07:00
2020-07-21 13:26:26 -07:00
2020-08-12 10:57:59 -07:00
2020-09-02 20:59:40 -06:00
2020-07-19 20:14:42 +02:00
2020-07-08 16:20:01 -06:00
2020-07-09 16:28:44 -07:00
2020-07-07 13:34:11 -07:00
2020-08-03 15:07:18 -07:00
2020-08-12 10:57:56 -07:00
2020-08-23 17:36:59 -05:00
2020-08-27 09:53:06 +02:00
2020-08-29 09:29:32 +02:00
2020-08-12 10:57:59 -07:00
2020-08-04 13:49:43 -07:00
2020-08-03 14:25:40 -07:00
2020-07-24 13:56:23 +02:00
2020-09-28 19:47:41 +02:00
2020-08-27 12:51:25 +02:00
2020-08-20 10:57:29 -07:00
2020-08-26 12:41:53 +02:00
2020-08-12 10:58:01 -07:00
2020-07-16 21:49:09 +10:00
2020-07-29 16:14:27 +02:00
2020-07-10 13:54:00 -07:00
2020-08-12 10:57:59 -07:00
2020-07-30 19:26:10 +02:00
2020-07-30 17:22:57 +09:00
2020-08-03 11:57:03 -07:00
2020-09-10 19:19:42 +02:00
2020-07-10 15:39:29 +05:30
2020-08-14 15:22:43 -07:00
2020-08-14 16:27:00 +02:00
2020-07-21 09:42:19 +02:00
2020-08-14 16:27:00 +02:00
2020-07-29 16:14:25 +02:00
2020-08-07 12:41:36 -07:00
2020-07-24 14:33:39 +02:00
2020-09-04 17:21:56 +02:00
2020-08-06 16:13:13 +02:00
2020-09-10 18:19:16 +02:00
2020-08-07 11:33:28 -07:00
2020-07-27 14:29:22 -04:00
2020-07-27 14:29:23 -04:00
2020-09-04 15:50:14 +02:00
2020-07-24 15:03:42 +02:00
2020-07-08 12:39:05 -07:00
2020-08-12 10:57:59 -07:00
2020-07-27 23:24:00 +02:00
2020-08-04 07:37:23 +02:00
2020-07-13 11:03:45 -07:00
2020-08-23 17:36:59 -05:00
2020-07-17 13:12:44 -04:00
2020-08-12 10:57:57 -07:00
2020-07-14 14:45:41 +02:00
2020-07-29 16:14:27 +02:00
2020-10-05 13:34:18 +02:00
2020-07-21 16:02:13 -07:00
2020-07-27 23:25:50 +02:00
2020-07-27 23:24:00 +02:00
2020-07-21 16:02:41 -07:00
2020-08-12 10:57:59 -07:00
2020-07-17 20:18:00 -06:00
2020-07-10 12:00:01 +02:00
2020-07-20 17:00:02 -07:00
2020-09-01 12:06:41 +02:00
2020-08-12 10:57:57 -07:00
2020-07-10 16:24:28 -03:00
2020-07-17 16:06:14 +02:00
2020-08-06 16:13:13 +02:00
2020-08-14 19:56:56 -07:00
2020-08-12 10:58:02 -07:00
2020-08-06 17:54:04 +02:00
2020-09-09 10:22:40 +02:00
2020-08-13 18:41:00 -07:00
2020-07-24 17:12:41 -07:00
2020-08-03 10:54:54 +02:00
2020-07-14 13:46:42 -07:00
2020-07-07 15:48:38 -07:00
2020-10-05 13:37:03 +02:00
2020-08-04 21:02:38 -04:00
2020-07-30 08:22:33 +02:00
2020-07-24 13:56:23 +02:00
2020-07-27 14:17:36 +02:00
2020-07-24 14:33:39 +02:00
2020-09-18 09:13:40 +03:00
2020-09-08 16:28:49 +03:00
2020-07-30 11:16:01 -07:00
2020-08-14 19:56:57 -07:00
2020-08-14 19:56:57 -07:00
2020-07-24 12:42:42 -07:00
2020-07-24 14:29:47 +02:00
2020-07-29 14:42:00 +02:00
2020-07-24 17:12:41 -07:00
2020-06-28 17:01:20 +02:00
2020-07-27 16:20:40 +02:00
2020-07-27 08:55:04 +01:00
2020-07-04 10:02:06 +02:00
2020-08-26 12:41:56 +02:00
2020-07-04 10:02:06 +02:00
2020-08-21 11:03:38 -07:00
2020-08-23 17:36:59 -05:00
2020-07-08 15:59:57 -07:00
2020-08-07 11:33:28 -07:00
2020-06-26 10:01:08 -06:00
2020-10-05 13:37:03 +02:00
2020-08-28 11:21:20 -07:00
2020-07-29 23:47:53 +10:00
2020-07-09 20:12:19 -07:00
2020-07-23 10:33:12 +02:00
2020-08-07 18:29:15 -07:00
2020-09-04 09:25:20 -07:00
2020-08-06 16:13:13 +02:00
2020-08-21 14:04:14 +01:00
2020-07-29 16:14:29 +02:00
2020-07-09 13:29:42 -04:00
2020-07-22 14:41:29 +02:00
2020-08-12 10:57:59 -07:00
2020-07-22 14:42:07 +02:00
2020-09-02 11:31:23 -06:00
2020-07-28 19:29:22 -06:00
2020-07-01 07:27:24 -06:00
2020-07-20 17:59:43 -07:00
2020-08-02 20:39:44 -07:00
2020-07-28 10:45:46 +02:00
2020-08-26 12:41:53 +02:00
2020-09-05 12:14:30 -07:00
2020-10-05 13:37:03 +02:00
2020-10-05 13:37:03 +02:00
2020-08-07 21:27:37 -07:00
2020-06-26 13:40:09 -07:00
2020-07-10 15:08:09 +02:00
2020-08-14 19:56:57 -07:00
2020-08-12 10:57:56 -07:00
2020-09-04 09:59:59 +02:00
2020-10-02 11:33:47 +02:00
2020-07-23 09:35:36 +02:00
2020-08-12 10:58:02 -07:00
2020-08-28 12:37:42 +02:00
2020-08-14 19:56:56 -07:00
2020-08-14 19:56:56 -07:00
2020-08-30 10:56:12 -07:00
2020-08-07 11:33:26 -07:00
2020-08-26 12:41:53 +02:00
2020-08-07 11:33:21 -07:00
2020-08-12 10:57:56 -07:00
2020-07-23 09:12:15 +02:00
2020-08-05 10:31:28 +02:00
2020-07-20 10:39:54 +02:00
2020-07-31 18:08:59 +10:00
2020-07-24 15:41:54 -07:00
2020-07-24 15:41:54 -07:00
2020-08-06 16:13:13 +02:00
2020-07-24 15:41:54 -07:00
2020-08-05 20:13:21 -07:00
2020-08-13 04:16:15 +02:00
2020-07-24 15:41:54 -07:00
2020-07-15 07:45:25 -07:00
2020-08-15 08:26:55 -07:00
2020-07-13 17:52:45 -04:00
2020-07-13 17:52:46 -04:00
2020-07-13 17:52:45 -04:00
2020-09-22 13:58:40 +02:00
2020-07-21 10:50:36 +01:00
2020-07-29 07:45:20 +02:00
2020-07-29 07:45:21 +02:00
2020-07-29 17:12:08 +02:00
2020-07-29 17:12:08 +02:00
2020-07-28 22:49:52 +02:00
2020-07-28 15:51:32 +01:00
2020-07-01 10:49:02 +02:00
2020-07-28 15:51:32 +01:00
2020-07-28 15:51:32 +01:00
2020-06-30 15:57:34 -07:00
2020-08-03 19:30:59 -07:00
2020-08-12 10:57:56 -07:00
2020-07-23 17:34:18 +10:00
2020-07-16 12:32:25 -07:00
2020-08-07 11:33:29 -07:00
2020-08-14 19:56:56 -07:00
2020-08-12 12:09:36 -07:00
2020-07-24 09:50:41 -05:00
2020-08-07 18:48:15 -07:00
2020-08-07 11:33:26 -07:00
2020-07-21 10:50:37 +01:00
2020-08-05 20:13:21 -07:00
2020-08-17 21:50:54 +03:00
2020-08-03 15:01:02 -07:00
2020-08-17 11:46:22 -07:00
2020-07-28 17:07:06 -07:00
2020-07-14 15:14:27 +02:00
2020-08-04 12:44:53 +02:00
2020-08-04 12:39:28 +02:00
2020-07-27 13:52:36 +02:00
2020-08-12 10:57:59 -07:00
2020-08-06 16:50:59 +02:00
2020-07-31 14:33:56 +02:00
2020-09-10 19:27:59 +02:00
2020-08-03 23:24:26 -07:00
2020-07-27 17:46:24 +09:00
2020-07-25 20:16:32 -07:00
2020-07-19 14:16:09 +02:00
2020-07-21 10:50:37 +01:00
2020-07-24 22:09:54 -04:00
2020-07-13 22:43:43 -07:00
2020-08-03 23:24:26 -07:00
2020-07-27 17:46:24 +09:00
2020-07-27 17:46:24 +09:00
2020-06-29 11:58:11 -07:00
2020-08-03 14:39:35 -07:00
2020-06-29 12:00:46 -07:00
2020-06-29 11:59:26 -07:00
2020-06-29 11:59:26 -07:00
2020-06-29 11:59:25 -07:00
2020-07-17 00:03:11 +01:00
2020-07-27 14:31:13 -04:00
2020-08-04 20:16:37 -07:00
2020-07-28 17:09:49 -07:00
2020-06-30 17:18:56 -04:00
2020-07-21 14:07:51 -07:00
2020-07-16 13:35:25 +02:00
2020-07-22 13:39:31 +02:00
2020-07-16 23:19:51 +02:00
2020-07-06 16:07:25 +02:00
2020-07-20 11:50:47 +01:00
2020-08-26 12:41:51 +02:00
2020-07-13 09:40:21 +01:00
2020-08-04 21:00:11 -07:00
2020-10-05 13:37:03 +02:00
2020-08-06 16:13:13 +02:00
2020-07-29 17:14:38 +02:00
2020-07-20 09:39:11 +02:00
2020-08-07 11:33:24 -07:00
2020-08-23 17:36:59 -05:00
2020-09-03 18:50:48 -07:00
2020-06-30 10:46:39 -07:00
2020-08-07 11:33:25 -07:00
2020-08-07 11:33:25 -07:00
2020-08-07 11:33:25 -07:00
2020-06-28 17:01:20 +02:00
2020-06-28 17:01:20 +02:00
2020-06-30 09:34:23 -04:00
2020-08-10 12:06:44 -07:00
2020-07-15 12:45:06 +03:00
2020-07-28 19:28:32 -06:00
2020-08-12 10:57:56 -07:00
2020-08-14 19:56:56 -07:00
2020-08-14 19:56:56 -07:00
2020-07-25 19:34:48 -06:00
2020-06-30 12:18:08 -06:00
2020-07-27 14:11:22 +02:00
2020-07-31 17:00:44 -07:00
2020-07-07 15:55:21 +02:00
2020-07-08 11:14:22 +02:00
2020-08-06 16:13:13 +02:00
2020-06-29 12:01:44 -07:00
2020-07-24 08:16:01 +03:00
2020-07-24 09:26:23 +03:00
2020-10-05 12:43:53 +02:00
2020-08-03 13:34:37 -04:00
2020-07-29 16:14:18 +02:00
2020-08-12 10:57:59 -07:00
2020-06-30 09:34:23 -04:00
2020-07-04 09:35:36 -05:00
2020-07-15 16:48:11 +02:00
2020-07-07 11:58:59 -05:00
2020-07-20 15:04:32 +02:00
2020-07-10 13:45:32 +02:00
2020-08-05 19:00:23 -04:00
2020-08-01 11:28:17 +02:00
2020-08-06 16:13:13 +02:00
2020-08-05 11:08:41 -04:00
2020-08-05 19:56:03 -04:00
2020-08-05 09:30:19 -04:00
2020-09-04 09:31:54 -07:00
2020-08-07 11:33:24 -07:00
2020-07-10 14:55:25 +02:00
2020-10-05 13:21:49 +02:00
2020-08-05 18:43:02 +02:00
2020-08-12 10:57:59 -07:00
2020-08-06 16:13:13 +02:00
2020-08-09 13:58:04 -07:00
2020-08-12 10:57:59 -07:00
2020-08-12 10:57:59 -07:00
2020-08-12 10:57:59 -07:00