Critical data structures of security modules are currently not measured. Therefore an attestation service, for instance, would not be able to attest whether the security modules are always operating with the policies and configuration that the system administrator had setup. The policies and configuration for the security modules could be tampered with by malware by exploiting kernel vulnerabilities or modified through some inadvertent actions on the system. Measuring such critical data would enable an attestation service to better assess the state of the system. IMA subsystem measures system files, command line arguments passed to kexec, boot aggregate, keys, etc. It can be used to measure critical data structures of security modules as well. This change aims to address measuring critical data structures of SELinux when they are initialized and when they are updated at runtime. This series is based on commit 3db0d0c276a7 ("integrity: remove redundant initialization of variable ret") in next-integrity This series also has a dependency on the following patch series and should be applied in the following order: https://patchwork.kernel.org/patch/11709527/ https://patchwork.kernel.org/patch/11711249/ Lakshmi Ramasubramanian (2): IMA: Handle early boot data measurement SELinux: Measure state and hash of policy using IMA security/integrity/ima/Kconfig | 5 +- security/integrity/ima/Makefile | 2 +- security/integrity/ima/ima.h | 37 ++-- security/integrity/ima/ima_asymmetric_keys.c | 6 +- security/integrity/ima/ima_init.c | 2 +- security/integrity/ima/ima_main.c | 9 + security/integrity/ima/ima_policy.c | 2 +- security/integrity/ima/ima_queue_data.c | 190 +++++++++++++++++ security/integrity/ima/ima_queue_keys.c | 174 ---------------- security/selinux/Makefile | 2 + security/selinux/hooks.c | 1 + security/selinux/include/security.h | 15 ++ security/selinux/measure.c | 204 +++++++++++++++++++ security/selinux/selinuxfs.c | 3 + security/selinux/ss/services.c | 71 ++++++- 15 files changed, 516 insertions(+), 207 deletions(-) create mode 100644 security/integrity/ima/ima_queue_data.c delete mode 100644 security/integrity/ima/ima_queue_keys.c create mode 100644 security/selinux/measure.c -- 2.28.0