From: Tushar Sugandhi <tusharsu@linux.microsoft.com> To: zohar@linux.ibm.com, stephen.smalley.work@gmail.com, casey@schaufler-ca.com, agk@redhat.com, snitzer@redhat.com, gmazyland@gmail.com, paul@paul-moore.com Cc: tyhicks@linux.microsoft.com, sashal@kernel.org, jmorris@namei.org, nramas@linux.microsoft.com, linux-integrity@vger.kernel.org, selinux@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, dm-devel@redhat.com Subject: [PATCH v9 0/8] IMA: support for measuring kernel integrity critical data Date: Sat, 12 Dec 2020 10:02:43 -0800 [thread overview] Message-ID: <20201212180251.9943-1-tusharsu@linux.microsoft.com> (raw) IMA measures files and buffer data such as keys, command-line arguments passed to the kernel on kexec system call, etc. While these measurements are necessary for monitoring and validating the integrity of the system, they are not sufficient. Various data structures, policies, and states stored in kernel memory also impact the integrity of the system. Several kernel subsystems contain such integrity critical data - e.g. LSMs like SELinux, AppArmor etc. or device-mapper targets like dm-crypt, dm-verity, dm-integrity etc. These kernel subsystems help protect the integrity of a device. Their integrity critical data is not expected to change frequently during run-time. Some of these structures cannot be defined as __ro_after_init, because they are initialized later. For a given device, various external services/infrastructure tools (including the attestation service) interact with it - both during the setup and during rest of the device run-time. They share sensitive data and/or execute critical workload on that device. The external services may want to verify the current run-time state of the relevant kernel subsystems before fully trusting the device with business critical data/workload. For instance, verifying that SELinux is in "enforce" mode along with the expected policy, disks are encrypted with a certain configuration, secure boot is enabled etc. This series provides the necessary IMA functionality for kernel subsystems to ensure their configuration can be measured: - by kernel subsystems themselves, - in a tamper resistant way, - and re-measured - triggered on state/configuration change. This patch set: - defines a new IMA hook ima_measure_critical_data() to measure integrity critical data, - limits the critical data being measured based on a label, - defines a builtin critical data measurement policy, - and includes an SELinux consumer of the new IMA critical data hook. This series is based on the following repo/branch: repo: https://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git branch: next-integrity commit 207cdd565dfc ("ima: Don't modify file descriptor mode on the fly") Change Log v9: Incorporated feedback from Tyler on v8 of this series. - Moved rule->data_source logic from Patch #4 to Patch #5. - Removed unnecessary variable event_name from selinux_event_name() in Patch #8. Change Log v8: Incorporated feedback from Tyler on v7 of this series. - Removed unnecessary 'else' clauses in ima_match_rule_data(). - Fixed ima_store_template() to pass the buffer hash in case the buffer is large. - fixed function description for ima_measure_critical_data(). - Moved some usage of CRITICAL_DATA from Patch #3 to Patch #4. - Moved IMA_DATA_SOURCE from Patch #4 to Patch #5. - Removed unnecessary pr_err() from ima_measure_critical_data() and selinux_event_name(). - Fixed log formatting in selinux_measure_state() to be consistent with other messages in that file. Change Log v7: Incorporated feedback from Mimi on v6 of this series. - Updated cover letter and patch descriptions as per Mimi's feedback. - Changed references to variable names and policy documentation from plural "data_sources" to singular "data_source". - Updated SELinux patch to measure only policy, instead of policy and state. The state measurement will be upstreamed through a separate patch. - Updated admin-guide/kernel-parameters.txt to document support for critical_data in builtin policy. Change Log v6: Incorporated feedback from Mimi on v5 of this series. - Got rid of patch 5 from the v5 of the series.(the allow list for data sources) - Updated function descriptions, changed variable names etc. - Moved the input param event_data_source in ima_measure_critical_data() to a new patch. (patch 6/8 of this series) - Split patch 4 from v5 of the series into two patches (patch 4/8 and patch 5/8) - Updated cover letter and patch descriptions as per feedback. Change Log v5: (1) Incorporated feedback from Stephen on the last SeLinux patch. SeLinux Patch: https://patchwork.kernel.org/patch/11801585/ - Freed memory in the reverse order of allocation in selinux_measure_state(). - Used scnprintf() instead of snprintf() to create the string for selinux state. - Allocated event name passed to ima_measure_critical_data() before gathering selinux state and policy information for measuring. (2) Incorporated feedback from Mimi on v4 of this series. V4 of this Series: https://patchwork.kernel.org/project/linux-integrity/list/?series=354437 - Removed patch "[v4,2/6] IMA: conditionally allow empty rule data" - Reversed the order of following patches. [v4,4/6] IMA: add policy to measure critical data from kernel components [v4,5/6] IMA: add hook to measure critical data from kernel components and renamed them to remove "from kernel components" - Added a new patch to this series - IMA: add critical_data to built-in policy rules - Added the next version of SeLinux patch (mentioned above) to this series selinux: measure state and hash of the policy using IMA - Updated cover-letter description to give broader perspective of the feature, rearranging paragraphs, removing unnecessary info, clarifying terms etc. - Got rid of opt_list param from ima_match_rule_data(). - Updated the documentation to remove sources that don't yet exist. - detailed IMA hook description added to ima_measure_critical_data(), as well as elaborating terms event_name, event_data_source. - "data_sources:=" is not a mandatory policy option for func=CRITICAL_DATA anymore. If not present, all the data sources specified in __ima_supported_kernel_data_sources will be measured. Lakshmi Ramasubramanian (2): IMA: define a builtin critical data measurement policy selinux: include a consumer of the new IMA critical data hook Tushar Sugandhi (6): IMA: generalize keyring specific measurement constructs IMA: add support to measure buffer data hash IMA: define a hook to measure kernel integrity critical data IMA: add policy rule to measure critical data IMA: limit critical data measurement based on a label IMA: extend critical data hook to limit the measurement based on a label Documentation/ABI/testing/ima_policy | 5 +- .../admin-guide/kernel-parameters.txt | 5 +- include/linux/ima.h | 8 ++ security/integrity/ima/ima.h | 8 +- security/integrity/ima/ima_api.c | 8 +- security/integrity/ima/ima_appraise.c | 2 +- security/integrity/ima/ima_asymmetric_keys.c | 2 +- security/integrity/ima/ima_main.c | 81 ++++++++++-- security/integrity/ima/ima_policy.c | 118 ++++++++++++++---- security/integrity/ima/ima_queue_keys.c | 3 +- security/selinux/Makefile | 2 + security/selinux/include/security.h | 11 +- security/selinux/measure.c | 79 ++++++++++++ security/selinux/ss/services.c | 71 +++++++++-- 14 files changed, 352 insertions(+), 51 deletions(-) create mode 100644 security/selinux/measure.c -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Tushar Sugandhi <tusharsu@linux.microsoft.com> To: zohar@linux.ibm.com, stephen.smalley.work@gmail.com, casey@schaufler-ca.com, agk@redhat.com, snitzer@redhat.com, gmazyland@gmail.com, paul@paul-moore.com Cc: sashal@kernel.org, dm-devel@redhat.com, selinux@vger.kernel.org, jmorris@namei.org, linux-kernel@vger.kernel.org, nramas@linux.microsoft.com, linux-security-module@vger.kernel.org, tyhicks@linux.microsoft.com, linux-integrity@vger.kernel.org Subject: [dm-devel] [PATCH v9 0/8] IMA: support for measuring kernel integrity critical data Date: Sat, 12 Dec 2020 10:02:43 -0800 [thread overview] Message-ID: <20201212180251.9943-1-tusharsu@linux.microsoft.com> (raw) IMA measures files and buffer data such as keys, command-line arguments passed to the kernel on kexec system call, etc. While these measurements are necessary for monitoring and validating the integrity of the system, they are not sufficient. Various data structures, policies, and states stored in kernel memory also impact the integrity of the system. Several kernel subsystems contain such integrity critical data - e.g. LSMs like SELinux, AppArmor etc. or device-mapper targets like dm-crypt, dm-verity, dm-integrity etc. These kernel subsystems help protect the integrity of a device. Their integrity critical data is not expected to change frequently during run-time. Some of these structures cannot be defined as __ro_after_init, because they are initialized later. For a given device, various external services/infrastructure tools (including the attestation service) interact with it - both during the setup and during rest of the device run-time. They share sensitive data and/or execute critical workload on that device. The external services may want to verify the current run-time state of the relevant kernel subsystems before fully trusting the device with business critical data/workload. For instance, verifying that SELinux is in "enforce" mode along with the expected policy, disks are encrypted with a certain configuration, secure boot is enabled etc. This series provides the necessary IMA functionality for kernel subsystems to ensure their configuration can be measured: - by kernel subsystems themselves, - in a tamper resistant way, - and re-measured - triggered on state/configuration change. This patch set: - defines a new IMA hook ima_measure_critical_data() to measure integrity critical data, - limits the critical data being measured based on a label, - defines a builtin critical data measurement policy, - and includes an SELinux consumer of the new IMA critical data hook. This series is based on the following repo/branch: repo: https://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git branch: next-integrity commit 207cdd565dfc ("ima: Don't modify file descriptor mode on the fly") Change Log v9: Incorporated feedback from Tyler on v8 of this series. - Moved rule->data_source logic from Patch #4 to Patch #5. - Removed unnecessary variable event_name from selinux_event_name() in Patch #8. Change Log v8: Incorporated feedback from Tyler on v7 of this series. - Removed unnecessary 'else' clauses in ima_match_rule_data(). - Fixed ima_store_template() to pass the buffer hash in case the buffer is large. - fixed function description for ima_measure_critical_data(). - Moved some usage of CRITICAL_DATA from Patch #3 to Patch #4. - Moved IMA_DATA_SOURCE from Patch #4 to Patch #5. - Removed unnecessary pr_err() from ima_measure_critical_data() and selinux_event_name(). - Fixed log formatting in selinux_measure_state() to be consistent with other messages in that file. Change Log v7: Incorporated feedback from Mimi on v6 of this series. - Updated cover letter and patch descriptions as per Mimi's feedback. - Changed references to variable names and policy documentation from plural "data_sources" to singular "data_source". - Updated SELinux patch to measure only policy, instead of policy and state. The state measurement will be upstreamed through a separate patch. - Updated admin-guide/kernel-parameters.txt to document support for critical_data in builtin policy. Change Log v6: Incorporated feedback from Mimi on v5 of this series. - Got rid of patch 5 from the v5 of the series.(the allow list for data sources) - Updated function descriptions, changed variable names etc. - Moved the input param event_data_source in ima_measure_critical_data() to a new patch. (patch 6/8 of this series) - Split patch 4 from v5 of the series into two patches (patch 4/8 and patch 5/8) - Updated cover letter and patch descriptions as per feedback. Change Log v5: (1) Incorporated feedback from Stephen on the last SeLinux patch. SeLinux Patch: https://patchwork.kernel.org/patch/11801585/ - Freed memory in the reverse order of allocation in selinux_measure_state(). - Used scnprintf() instead of snprintf() to create the string for selinux state. - Allocated event name passed to ima_measure_critical_data() before gathering selinux state and policy information for measuring. (2) Incorporated feedback from Mimi on v4 of this series. V4 of this Series: https://patchwork.kernel.org/project/linux-integrity/list/?series=354437 - Removed patch "[v4,2/6] IMA: conditionally allow empty rule data" - Reversed the order of following patches. [v4,4/6] IMA: add policy to measure critical data from kernel components [v4,5/6] IMA: add hook to measure critical data from kernel components and renamed them to remove "from kernel components" - Added a new patch to this series - IMA: add critical_data to built-in policy rules - Added the next version of SeLinux patch (mentioned above) to this series selinux: measure state and hash of the policy using IMA - Updated cover-letter description to give broader perspective of the feature, rearranging paragraphs, removing unnecessary info, clarifying terms etc. - Got rid of opt_list param from ima_match_rule_data(). - Updated the documentation to remove sources that don't yet exist. - detailed IMA hook description added to ima_measure_critical_data(), as well as elaborating terms event_name, event_data_source. - "data_sources:=" is not a mandatory policy option for func=CRITICAL_DATA anymore. If not present, all the data sources specified in __ima_supported_kernel_data_sources will be measured. Lakshmi Ramasubramanian (2): IMA: define a builtin critical data measurement policy selinux: include a consumer of the new IMA critical data hook Tushar Sugandhi (6): IMA: generalize keyring specific measurement constructs IMA: add support to measure buffer data hash IMA: define a hook to measure kernel integrity critical data IMA: add policy rule to measure critical data IMA: limit critical data measurement based on a label IMA: extend critical data hook to limit the measurement based on a label Documentation/ABI/testing/ima_policy | 5 +- .../admin-guide/kernel-parameters.txt | 5 +- include/linux/ima.h | 8 ++ security/integrity/ima/ima.h | 8 +- security/integrity/ima/ima_api.c | 8 +- security/integrity/ima/ima_appraise.c | 2 +- security/integrity/ima/ima_asymmetric_keys.c | 2 +- security/integrity/ima/ima_main.c | 81 ++++++++++-- security/integrity/ima/ima_policy.c | 118 ++++++++++++++---- security/integrity/ima/ima_queue_keys.c | 3 +- security/selinux/Makefile | 2 + security/selinux/include/security.h | 11 +- security/selinux/measure.c | 79 ++++++++++++ security/selinux/ss/services.c | 71 +++++++++-- 14 files changed, 352 insertions(+), 51 deletions(-) create mode 100644 security/selinux/measure.c -- 2.17.1 -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel
next reply other threads:[~2020-12-12 18:05 UTC|newest] Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-12 18:02 Tushar Sugandhi [this message] 2020-12-12 18:02 ` [dm-devel] [PATCH v9 0/8] IMA: support for measuring kernel integrity critical data Tushar Sugandhi 2020-12-12 18:02 ` [PATCH v9 1/8] IMA: generalize keyring specific measurement constructs Tushar Sugandhi 2020-12-12 18:02 ` [dm-devel] " Tushar Sugandhi 2020-12-24 13:06 ` Mimi Zohar 2020-12-24 13:06 ` [dm-devel] " Mimi Zohar 2021-01-05 18:48 ` Tushar Sugandhi 2021-01-05 18:48 ` [dm-devel] " Tushar Sugandhi 2020-12-12 18:02 ` [PATCH v9 2/8] IMA: add support to measure buffer data hash Tushar Sugandhi 2020-12-12 18:02 ` [dm-devel] " Tushar Sugandhi 2020-12-24 0:03 ` Mimi Zohar 2020-12-24 0:03 ` [dm-devel] " Mimi Zohar 2021-01-05 18:53 ` Tushar Sugandhi 2021-01-05 18:53 ` [dm-devel] " Tushar Sugandhi 2021-01-06 5:00 ` Tushar Sugandhi 2021-01-06 5:00 ` [dm-devel] " Tushar Sugandhi 2020-12-12 18:02 ` [PATCH v9 3/8] IMA: define a hook to measure kernel integrity critical data Tushar Sugandhi 2020-12-12 18:02 ` [dm-devel] " Tushar Sugandhi 2020-12-24 13:04 ` Mimi Zohar 2020-12-24 13:04 ` [dm-devel] " Mimi Zohar 2021-01-05 20:01 ` Tushar Sugandhi 2021-01-05 20:01 ` [dm-devel] " Tushar Sugandhi 2021-01-05 20:16 ` Mimi Zohar 2021-01-05 20:16 ` [dm-devel] " Mimi Zohar 2021-01-05 20:19 ` Tushar Sugandhi 2021-01-05 20:19 ` [dm-devel] " Tushar Sugandhi 2020-12-12 18:02 ` [PATCH v9 4/8] IMA: add policy rule to measure " Tushar Sugandhi 2020-12-12 18:02 ` [dm-devel] " Tushar Sugandhi 2020-12-12 19:20 ` Tyler Hicks 2020-12-12 19:20 ` [dm-devel] " Tyler Hicks 2020-12-13 1:21 ` Tushar Sugandhi 2020-12-13 1:21 ` [dm-devel] " Tushar Sugandhi 2020-12-24 13:48 ` Mimi Zohar 2020-12-24 13:48 ` [dm-devel] " Mimi Zohar 2021-01-05 20:12 ` Tushar Sugandhi 2021-01-05 20:12 ` [dm-devel] " Tushar Sugandhi 2020-12-12 18:02 ` [PATCH v9 5/8] IMA: limit critical data measurement based on a label Tushar Sugandhi 2020-12-12 18:02 ` [dm-devel] " Tushar Sugandhi 2020-12-12 19:20 ` Tyler Hicks 2020-12-12 19:20 ` [dm-devel] " Tyler Hicks 2020-12-13 1:21 ` Tushar Sugandhi 2020-12-13 1:21 ` [dm-devel] " Tushar Sugandhi 2020-12-24 14:29 ` Mimi Zohar 2020-12-24 14:29 ` [dm-devel] " Mimi Zohar 2021-01-05 20:28 ` Tushar Sugandhi 2021-01-05 20:28 ` [dm-devel] " Tushar Sugandhi 2020-12-12 18:02 ` [PATCH v9 6/8] IMA: extend critical data hook to limit the " Tushar Sugandhi 2020-12-12 18:02 ` [dm-devel] " Tushar Sugandhi 2020-12-12 18:02 ` [PATCH v9 7/8] IMA: define a builtin critical data measurement policy Tushar Sugandhi 2020-12-12 18:02 ` [dm-devel] " Tushar Sugandhi 2020-12-24 14:41 ` Mimi Zohar 2020-12-24 14:41 ` [dm-devel] " Mimi Zohar 2021-01-05 20:30 ` Tushar Sugandhi 2021-01-05 20:30 ` [dm-devel] " Tushar Sugandhi 2020-12-12 18:02 ` [PATCH v9 8/8] selinux: include a consumer of the new IMA critical data hook Tushar Sugandhi 2020-12-12 18:02 ` [dm-devel] " Tushar Sugandhi 2020-12-23 21:10 ` Paul Moore 2020-12-23 21:10 ` [dm-devel] " Paul Moore 2021-01-04 23:30 ` Lakshmi Ramasubramanian 2021-01-04 23:30 ` [dm-devel] " Lakshmi Ramasubramanian 2021-01-05 2:13 ` Paul Moore 2021-01-05 2:13 ` [dm-devel] " Paul Moore 2021-01-05 5:24 ` Lakshmi Ramasubramanian 2021-01-05 5:24 ` [dm-devel] " Lakshmi Ramasubramanian
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201212180251.9943-1-tusharsu@linux.microsoft.com \ --to=tusharsu@linux.microsoft.com \ --cc=agk@redhat.com \ --cc=casey@schaufler-ca.com \ --cc=dm-devel@redhat.com \ --cc=gmazyland@gmail.com \ --cc=jmorris@namei.org \ --cc=linux-integrity@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-security-module@vger.kernel.org \ --cc=nramas@linux.microsoft.com \ --cc=paul@paul-moore.com \ --cc=sashal@kernel.org \ --cc=selinux@vger.kernel.org \ --cc=snitzer@redhat.com \ --cc=stephen.smalley.work@gmail.com \ --cc=tyhicks@linux.microsoft.com \ --cc=zohar@linux.ibm.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.