Integrity Policy Enforcement LSM (IPE)
Subsystems (11)
v8 cover Integrity Policy Enforcement LSM (IPE)
Overview:
---------
IPE is a Linux Security Module which takes a complimentary approach to access control. Whereas existing mandatory access control mechanisms base their decisions on labels and paths, IPE instead determines whether or not an operation should be allowed based on immutable security properties of the system component the operation is being performed on.
IPE itself does not mandate how the security property should be evaluated, but relies on an extensible set of external property providers to evaluate the component. IPE makes its decision based on reference values for the selected properties, specified in the IPE policy.
The reference values represent the value that the policy writer and the local system administrator (based on the policy signature) trust for the system to accomplish the desired tasks.
One such provider is for example dm-verity, which is able to represent the integrity property of a partition (its immutable state) with a digest.
IPE is compiled under CONFIG_SECURITY_IPE.
Use Cases
---------
IPE works best in fixed-function devices: Devices in which their purpose is clearly defined and not supposed to be changed (e.g. network firewall device in a data center, an IoT device, etcetera), where all software and configuration is built and provisioned by the system owner.
IPE is a long-way off for use in general-purpose computing: the Linux community as a whole tends to follow a decentralized trust model, known as the web of trust, which IPE has no support for as of yet.
There are exceptions, to this general-purpose computing rule; however, such as the scenario, wherein Linux distribution vendors trust only their own keys - in this case, IPE can be used to enforce the trust reqiurement.
IPE, instead of supporting web of trust, supports PKI, which generally designates a set of entities that provide a measure absolute trust. Commonly used in embedded systems,
Additionally, while most packages are signed today, the files inside the packages (for instance, the executables), tend to be unsigned. This makes it difficult to utilize IPE in systems where a package manager is expected to be functional, without major changes to the package manager and ecosystem behind it.
DIGLIM[1] is a system that when combined with IPE, could be used to enable general purpose computing scenarios.
Policy:
-------
IPE policy is a plain-text policy composed of multiple statements over several lines. There is one required line, at the top of the policy, indicating the policy name, and the policy version, for instance:
policy_name="Ex Policy" policy_version=0.0.0
The policy version indicates the current version of the policy (NOT the policy syntax version). This is used to prevent roll-back of policy to potentially insecure previous versions of the policy.
The next portion of IPE policy, are rules. Rules are formed by key=value pairs, known as properties. IPE rules require two keys: "action", which determines what IPE does when it encounters a match against the policy
and "op", which determines when that rule should be evaluated.
Thus, a minimal rule is:
op=EXECUTE action=ALLOW
This example will allow any execution. Additional properties are used to restrict attributes about the files being evaluated. These properties are intended to be deterministic attributes that are resident in the kernel. Available properties for IPE described in the documentation patch of this series.
A rule is required to have the "op" property as the first token of a rule, and the "action" as the last token of the rule. Rules are evaluated top-to-bottom. As a result, any revocation rules, or denies should be placed early in the file to ensure that these rules are evaluated before a rule with "action=ALLOW" is hit.
Any unknown syntax in IPE policy will result in a fatal error to parse the policy. User mode can interrogate the kernel to understand what properties and the associated versions through the securityfs node, $securityfs/ipe/config, which will return a string of form:
key1=version1
key2=version2
.
.
.
keyN=versionN
User-mode should correlate these versions with the supported values identified in the documentation to determine whether a policy should be accepted by the system without actually trying to deploy the policy.
Additionally, a DEFAULT operation must be set for all understood operations within IPE. For policies to remain completely forwards compatible, it is recommended that users add a "DEFAULT action=ALLOW" and override the defaults on a per-operation basis.
For more information about the policy syntax, see the kernel documentation page.
Early Usermode Protection:
--------------------------
IPE can be provided with a policy at startup to load and enforce. This is intended to be a minimal policy to get the system to a state where userland is setup and ready to receive commands, at which point a policy can be deployed via securityfs. This "boot policy" can be specified via the config, SECURITY_IPE_BOOT_POLICY, which accepts a path to a plain-text version of the IPE policy to apply. This policy will be compiled into the kernel. If not specified, IPE will be disabled until a policy is deployed and activated through the method above.
Policy Examples:
----------------
Allow all:
policy_name="Allow All" policy_version=0.0.0
DEFAULT action=ALLOW
Allow only initial superblock:
policy_name="Allow All Initial SB" policy_version=0.0.0 DEFAULT action=DENY
op=EXECUTE boot_verified=TRUE action=ALLOW
Allow any signed dm-verity volume and the initial superblock:
policy_name="AllowSignedAndInitial" policy_version=0.0.0 DEFAULT action=DENY
op=EXECUTE boot_verified=TRUE action=ALLOW
op=EXECUTE dmverity_signature=TRUE action=ALLOW
Prohibit execution from a specific dm-verity volume, while allowing all signed volumes and the initial superblock:
policy_name="ProhibitSingleVolume" policy_version=0.0.0 DEFAULT action=DENY
op=EXECUTE dmverity_roothash=sha256:401fcec5944823ae12f62726e8184407a5fa9599783f030dec146938 action=DENY op=EXECUTE boot_verified=TRUE action=ALLOW
op=EXECUTE dmverity_signature=TRUE action=ALLOW
Allow only a specific dm-verity volume:
policy_name="AllowSpecific" policy_version=0.0.0 DEFAULT action=DENY
op=EXECUTE dmverity_roothash=sha256:401fcec5944823ae12f62726e8184407a5fa9599783f030dec146938 action=ALLOW
Deploying Policies:
-------------------
First sign a plain text policy, with a certificate that is present in the SYSTEM_TRUSTED_KEYRING of your test machine. Through openssl, the signing can be done via:
openssl smime -sign -in "$MY_POLICY" -signer "$MY_CERTIFICATE" \
-inkey "$MY_PRIVATE_KEY" -outform der -noattr -nodetach \
-out "$MY_POLICY.p7s"Then, simply cat the file into the IPE's "new_policy" securityfs node:
cat "$MY_POLICY.p7s" > /sys/kernel/security/ipe/new_policy
The policy should now be present under the policies/ subdirectory, under its "policy_name" attribute.
The policy is now present in the kernel and can be marked as active, via the securityfs node:
echo 1 > "/sys/kernel/security/ipe/$MY_POLICY_NAME/active"
This will now mark the policy as active and the system will be enforcing $MY_POLICY_NAME.
There is one requirement when marking a policy as active, the policy_version attribute must either increase, or remain the same as the currently running policy.
Policies can be updated via:
cat "$MY_UPDATED_POLICY.p7s" > \
"/sys/kernel/security/ipe/policies/$MY_POLICY_NAME/update"Additionally, policies can be deleted via the "delete" securityfs node. Simply write "1" to the corresponding node in the policy folder:
echo 1 > "/sys/kernel/security/ipe/policies/$MY_POLICY_NAME/delete"
There is only one requirement to delete policies, the policy being deleted must not be the active policy.
NOTE: Any securityfs write to IPE's nodes will require CAP_MAC_ADMIN.
Integrations:
-------------
This patch series adds support for fsverity via digest and signature (fsverity_signature and fsverity_digest), dm-verity by digest and signature (dmverity_signature and dmverity_roothash), and trust for the initramfs (boot_verified).
Please see the documentation patch for more information about the integrations available.
Testing:
--------
KUnit Tests are available. Recommended kunitconfig:
CONFIG_KUNIT=y
CONFIG_SECURITY=y
CONFIG_SECURITYFS=y
CONFIG_PKCS7_MESSAGE_PARSER=y
CONFIG_SYSTEM_DATA_VERIFICATION=y
CONFIG_FS_VERITY=y
CONFIG_FS_VERITY_BUILTIN_SIGNATURES=y
CONFIG_BLOCK=y
CONFIG_MD=y
CONFIG_BLK_DEV_DM=y
CONFIG_DM_VERITY=y
CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG=y
CONFIG_SECURITY_IPE=y
CONFIG_SECURITY_IPE_KUNIT_TEST=y
CONFIG_IPE_PROP_BOOT_VERIFIED=y
CONFIG_IPE_PROP_DM_VERITY_SIGNATURE=y
CONFIG_IPE_PROP_DM_VERITY_ROOTHASH=y
CONFIG_IPE_PROP_FS_VERITY_SIGNATURE=y
CONFIG_IPE_PROP_FS_VERITY_DIGEST=y
Simply run:
make ARCH=um mrproper
./tools/testing/kunit/kunit.py run --kunitconfig <path/to/config>
And the tests will execute and report the result. For more indepth testing, it will require you to create and mount a dm-verity volume or fs-verity enabled file.
Documentation:
--------------
There is both documentation available on github at
https://microsoft.github.io/ipe, and Documentation in this patch series, to be added in-tree.
Known Gaps:
-----------
IPE has two known gaps:
1. IPE cannot verify the integrity of anonymous executable memory, such as the trampolines created by gcc closures and libffi (<3.4.2), or JIT'd code. Unfortunately, as this is dynamically generated code, there is no way for IPE to ensure the integrity of this code to form a trust basis. In all cases, the return result for these operations will be whatever the admin configures the DEFAULT action for "EXECUTE".
2. IPE cannot verify the integrity of interpreted languages' programs when these scripts invoked via ``<interpreter> <file>``. This is because the way interpreters execute these files, the scripts themselves are not evaluated as executable code through one of IPE's hooks. Interpreters can be enlightened to the usage of IPE by trying to mmap a file into executable memory (+X), after opening the file and responding to the error code appropriately. This also applies to included files, or high value files, such as configuration files of critical system components.
Appendix:
---------
A. IPE Github Repository: https://github.com/microsoft/ipe
B. IPE Users' Guide: Documentation/admin-guide/LSM/ipe.rst
References:
-----------
1: https://lore.kernel.org/bpf/[email protected]/T/
FAQ:
----
Q: What is the difference between IMA and IPE?
A: See the documentation patch for more on this topic.
Previous Postings
-----------------
v1: https://patchwork.kernel.org/project/linux-security-module/list/?series=267061&archive=both
v2: https://patchwork.kernel.org/project/linux-security-module/list/?series=267169&archive=both
v3: https://patchwork.kernel.org/project/linux-security-module/list/?series=271685&archive=both
v4: https://patchwork.kernel.org/project/linux-security-module/list/?series=320403&archive=both
v5: https://patchwork.kernel.org/project/linux-security-module/list/?series=325703&archive=both
v6: https://patchwork.kernel.org/project/linux-security-module/list/?series=326359&archive=both
v7: https://patchwork.kernel.org/project/linux-security-module/list/?series=562971&archive=both
Changelog:
----------
v2:
Split the second patch of the previous series into two. Minor corrections in the cover-letter and documentation comments regarding CAP_MAC_ADMIN checks in IPE.
v3:
Address various comments by Jann Horn. Highlights:
Switch various audit allocators to GFP_KERNEL. Utilize rcu_access_pointer() in various locations. Strip out the caching system for properties
Strip comments from headers
Move functions around in patches
Remove kernel command line parameters
Reconcile the race condition on the delete node for policy by
expanding the policy critical section.
Address a few comments by Jonathan Corbet around the documentation
pages for IPE.
Fix an issue with the initialization of IPE policy with a "-0"
version, caused by not initializing the hlist entries before freeing.
v4:
Address a concern around IPE's behavior with unknown syntax.
Specifically, make any unknown syntax a fatal error instead of a warning, as suggested by Mickaël Salaün.
Introduce a new securityfs node, $securityfs/ipe/property_config,
which provides a listing of what properties are enabled by the kernel and their versions. This allows usermode to predict what policies should be allowed.
Strip some comments from c files that I missed.
Clarify some documentation comments around 'boot_verified'.
While this currently does not functionally change the property itself, the distinction is important when IPE can enforce verified reads. Additionally, 'KERNEL_READ' was omitted from the documentation. This has been corrected.
Change SecurityFS and SHA1 to a reverse dependency.
Update the cover-letter with the updated behavior of unknown syntax. Remove all sysctls, making an equivalent function in securityfs. Rework the active/delete mechanism to be a node under the policy in
$securityfs/ipe/policies.
The kernel command line parameters ipe.enforce and ipe.success_audit
have returned as this functionality is no longer exposed through sysfs.
v5:
Correct some grammatical errors reported by Randy Dunlap. Fix some warnings reported by kernel test bot.
Change convention around security_bdev_setsecurity. -ENOSYS
is now expected if an LSM does not implement a particular @name, as suggested by Casey Schaufler.
Minor string corrections related to the move from sysfs to securityfs Correct a spelling of an #ifdef for the permissive argument. Add the kernel parameters re-added to the documentation. Fix a minor bug where the mode being audited on permissive switch
was the original mode, not the mode being swapped to.
Cleanup doc comments, fix some whitespace alignment issues.
v6:
Change if statement condition in security_bdev_setsecurity to be
more concise, as suggested by Casey Schaufler and Al Viro
Drop the 6th patch in the series, "dm-verity move signature check..."
due to numerous issues, and it ultimately providing no real value.
Fix the patch tree - the previous iteration appears to have been in a
torn state (patches 8+9 were merged). This has since been corrected.
v7:
* Reword cover letter to more accurate convey IPE's purpose and latest updates.
* Refactor series to:
1. Support a context structure, enabling:
1. Easier Testing via KUNIT
2. A better architecture for future designs
2. Make parser code cleaner
* Move patch 01/12 to [14/16] of the series
* Split up patch 02/12 into four parts:
1. context creation [01/16]
2. audit [07/16]
3. evaluation loop [03/16]
4. access control hooks [05/16]
5. permissive mode [08/16]
* Split up patch 03/12 into two parts:
1. parser [02/16]
2. userspace interface [04/16]
* Reword and refactor patch 04/12 to [09/16]
* Squash patch 05/12, 07/12, 09/12 to [10/16]
* Squash patch 08/12, 10/12 to [11/16]
* Change audit records to MAC region (14XX) from Integrity region (18XX)
* Add FSVerity Support
* Interface changes:
1. "raw" was renamed to "pkcs7" and made read only
2. "raw"'s write functionality (update a policy) moved to "update"
3. introduced "version", "policy_name" nodes.
4. "content" renamed to "policy"
5. The boot policy can now be updated like any other policy.
* Add additional developer-level documentation
* Update admin-guide docs to reflect changes.
* Kunit tests
* Dropped CONFIG_SECURITY_IPE_PERMISSIVE_SWITCH - functionality can easily come later with a small patch.
* Use partition0 for block_device for dm-verity patch
v8:
* Add changelog information to individual commits
* A large number of changes to the audit patch.
* split fs/ & security/ changes to two separate patches.
* split block/, security/ & drivers/md/ changes to separate patches.
* Add some historical context to what lead to the creation of IPE in the documentation patch.
* Cover-letter changes suggested by Roberto Sassu.
Deven Bowers (15):
security: add ipe lsm & initial context creation
ipe: add policy parser
ipe: add evaluation loop
ipe: add userspace interface
ipe: add LSM hooks on execution and kernel read uapi|audit: add ipe audit message definitions
ipe: add auditing support
ipe: add permissive toggle
ipe: introduce 'boot_verified' as a trust provider block|security: add LSM blob to block_device
dm-verity: consume root hash digest and signature data via LSM hook
ipe: add support for dm-verity as a trust provider
scripts: add boot policy generation program
ipe: kunit tests
documentation: add ipe documentation
Fan Wu (2):
fsverity: consume builtin signature via LSM hook
ipe: enable support for fs-verity as a trust provider
Documentation/admin-guide/LSM/index.rst | 1 + Documentation/admin-guide/LSM/ipe.rst | 739 ++++++++++++ .../admin-guide/kernel-parameters.txt | 12 + Documentation/security/index.rst | 1 + Documentation/security/ipe.rst | 559 +++++++++ MAINTAINERS | 9 + block/bdev.c | 7 + drivers/md/dm-verity-target.c | 25 +- drivers/md/dm-verity-verify-sig.c | 16 +- drivers/md/dm-verity-verify-sig.h | 10 +- fs/verity/fsverity_private.h | 2 +- fs/verity/open.c | 13 +- fs/verity/signature.c | 1 + include/asm-generic/vmlinux.lds.h | 16 + include/linux/blk_types.h | 1 + include/linux/dm-verity.h | 19 + include/linux/fsverity.h | 2 + include/linux/lsm_hook_defs.h | 5 + include/linux/lsm_hooks.h | 12 + include/linux/security.h | 22 + include/uapi/linux/audit.h | 1 + scripts/Makefile | 1 + scripts/ipe/Makefile | 2 + scripts/ipe/polgen/.gitignore | 1 + scripts/ipe/polgen/Makefile | 6 + scripts/ipe/polgen/polgen.c | 145 +++ security/Kconfig | 11 +- security/Makefile | 1 + security/ipe/.gitignore | 1 + security/ipe/Kconfig | 101 ++ security/ipe/Makefile | 37 + security/ipe/audit.c | 227 ++++ security/ipe/audit.h | 39 + security/ipe/ctx.c | 368 ++++++ security/ipe/ctx.h | 43 + security/ipe/ctx_test.c | 718 ++++++++++++ security/ipe/eval.c | 240 ++++ security/ipe/eval.h | 52 + security/ipe/fs.c | 340 ++++++ security/ipe/fs.h | 13 + security/ipe/hooks.c | 298 +++++ security/ipe/hooks.h | 45 + security/ipe/ipe.c | 159 +++ security/ipe/ipe.h | 28 + security/ipe/ipe_parser.h | 59 + security/ipe/modules.c | 272 +++++ security/ipe/modules.h | 17 + security/ipe/modules/Kconfig | 66 ++ security/ipe/modules/Makefile | 12 + security/ipe/modules/boot_verified.c | 26 + security/ipe/modules/dmverity_roothash.c | 31 + security/ipe/modules/dmverity_signature.c | 26 + security/ipe/modules/fsverity_digest.c | 39 + security/ipe/modules/fsverity_signature.c | 34 + security/ipe/modules/ipe_module.h | 46 + security/ipe/parsers.c | 143 +++ security/ipe/parsers/Makefile | 12 + security/ipe/parsers/default.c | 106 ++ security/ipe/parsers/policy_header.c | 126 ++ security/ipe/policy.c | 1037 +++++++++++++++++ security/ipe/policy.h | 113 ++ security/ipe/policy_parser_tests.c | 313 +++++ security/ipe/policyfs.c | 528 +++++++++ security/security.c | 70 ++ 64 files changed, 7409 insertions(+), 16 deletions(-) create mode 100644 Documentation/admin-guide/LSM/ipe.rst create mode 100644 Documentation/security/ipe.rst create mode 100644 include/linux/dm-verity.h create mode 100644 scripts/ipe/Makefile create mode 100644 scripts/ipe/polgen/.gitignore create mode 100644 scripts/ipe/polgen/Makefile create mode 100644 scripts/ipe/polgen/polgen.c create mode 100644 security/ipe/.gitignore create mode 100644 security/ipe/Kconfig create mode 100644 security/ipe/Makefile create mode 100644 security/ipe/audit.c create mode 100644 security/ipe/audit.h create mode 100644 security/ipe/ctx.c create mode 100644 security/ipe/ctx.h create mode 100644 security/ipe/ctx_test.c create mode 100644 security/ipe/eval.c create mode 100644 security/ipe/eval.h create mode 100644 security/ipe/fs.c create mode 100644 security/ipe/fs.h create mode 100644 security/ipe/hooks.c create mode 100644 security/ipe/hooks.h create mode 100644 security/ipe/ipe.c create mode 100644 security/ipe/ipe.h create mode 100644 security/ipe/ipe_parser.h create mode 100644 security/ipe/modules.c create mode 100644 security/ipe/modules.h create mode 100644 security/ipe/modules/Kconfig create mode 100644 security/ipe/modules/Makefile create mode 100644 security/ipe/modules/boot_verified.c create mode 100644 security/ipe/modules/dmverity_roothash.c create mode 100644 security/ipe/modules/dmverity_signature.c create mode 100644 security/ipe/modules/fsverity_digest.c create mode 100644 security/ipe/modules/fsverity_signature.c create mode 100644 security/ipe/modules/ipe_module.h create mode 100644 security/ipe/parsers.c create mode 100644 security/ipe/parsers/Makefile create mode 100644 security/ipe/parsers/default.c create mode 100644 security/ipe/parsers/policy_header.c create mode 100644 security/ipe/policy.c create mode 100644 security/ipe/policy.h create mode 100644 security/ipe/policy_parser_tests.c create mode 100644 security/ipe/policyfs.c
--
2.25.1
RFC PATCH v8 1/17 security: add ipe lsm & initial context creation
Integrity Policy Enforcement (IPE) is an LSM that provides an complimentary approach to Mandatory Access Control than existing LSMs today.
Existing LSMs have centered around the concept of access to a resource should be controlled by the current user's credentials. IPE's approach, is that access to a resource should be controlled by the system's trust of a current resource.
The basis of this approach is that every process in the kernel is associated with a context that determines the policy for what is trusted by said process and its descendents, starting with 'init'.
---
v2:
+ Split evaluation loop, access control hooks, and evaluation loop from policy parser and userspace interface to pass mailing list character limit
v3:
+ Move ipe_load_properties to patch 04.
+ Remove useless 0-initializations
+ Prefix extern variables with ipe_
+ Remove kernel module parameters, as these are exposed through sysctls.
+ Add more prose to the IPE base config option help text.
+ Use GFP_KERNEL for audit_log_start.
+ Remove unnecessary caching system.
+ Remove comments from headers
+ Use rcu_access_pointer for rcu-pointer null check
+ Remove usage of reqprot; use prot only.
+ Move policy load and activation audit event to 03/12
v4:
+ Remove sysctls in favor of securityfs nodes
+ Re-add kernel module parameters, as these are now exposed through securityfs.
+ Refactor property audit loop to a separate function.
v5:
+ fix minor grammatical errors
+ do not group rule by curly-brace in audit record, reconstruct the exact rule.
v6:
+ No changes
v7:
+ Further split lsm creation into a separate commit from the evaluation loop and audit system, for easier review.
+ Introduce the concept of an ipe_context, a scoped way to introduce execution policies, used initially for allowing for kunit tests in isolation.
v8:
+ Follow lsmname_hook_name convention for lsm hooks.
+ Move LSM blob accessors to ipe.c and mark LSM blobs as static.
--- MAINTAINERS | 6 ++ security/Kconfig | 11 ++-- security/Makefile | 1 + security/ipe/Kconfig | 17 +++++ security/ipe/Makefile | 11 ++++ security/ipe/ctx.c | 145 ++++++++++++++++++++++++++++++++++++++++++ security/ipe/ctx.h | 28 ++++++++ security/ipe/hooks.c | 54 ++++++++++++++++ security/ipe/hooks.h | 16 +++++ security/ipe/ipe.c | 73 +++++++++++++++++++++ security/ipe/ipe.h | 17 +++++ 11 files changed, 374 insertions(+), 5 deletions(-) create mode 100644 security/ipe/Kconfig create mode 100644 security/ipe/Makefile create mode 100644 security/ipe/ctx.c create mode 100644 security/ipe/ctx.h create mode 100644 security/ipe/hooks.c create mode 100644 security/ipe/hooks.h create mode 100644 security/ipe/ipe.c create mode 100644 security/ipe/ipe.h
MAINTAINERS +6 -0
@@ -9793,6 +9793,12 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git F: security/integrity/ima/ F: security/integrity/ +INTEGRITY POLICY ENFORCEMENT (IPE) +M: Deven Bowers <[email protected]> +M: Fan Wu <[email protected]> +S: Supported +F: security/ipe/ + INTEL 810/815 FRAMEBUFFER DRIVER M: Antonino Daplas <[email protected]> L: [email protected]
security/Kconfig +6 -5
@@ -218,6 +218,7 @@ source "security/yama/Kconfig" source "security/safesetid/Kconfig" source "security/lockdown/Kconfig" source "security/landlock/Kconfig" +source "security/ipe/Kconfig" source "security/integrity/Kconfig"
@@ -257,11 +258,11 @@ endchoice config LSM string "Ordered list of enabled LSMs" - default "landlock,lockdown,yama,loadpin,safesetid,integrity,smack,selinux,tomoyo,apparmor,bpf" if DEFAULT_SECURITY_SMACK - default "landlock,lockdown,yama,loadpin,safesetid,integrity,apparmor,selinux,smack,tomoyo,bpf" if DEFAULT_SECURITY_APPARMOR - default "landlock,lockdown,yama,loadpin,safesetid,integrity,tomoyo,bpf" if DEFAULT_SECURITY_TOMOYO - default "landlock,lockdown,yama,loadpin,safesetid,integrity,bpf" if DEFAULT_SECURITY_DAC - default "landlock,lockdown,yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor,bpf" + default "landlock,lockdown,yama,loadpin,safesetid,integrity,smack,selinux,tomoyo,apparmor,bpf,ipe" if DEFAULT_SECURITY_SMACK + default "landlock,lockdown,yama,loadpin,safesetid,integrity,apparmor,selinux,smack,tomoyo,bpf,ipe" if DEFAULT_SECURITY_APPARMOR + default "landlock,lockdown,yama,loadpin,safesetid,integrity,tomoyo,bpf,ipe" if DEFAULT_SECURITY_TOMOYO + default "landlock,lockdown,yama,loadpin,safesetid,integrity,bpf,ipe" if DEFAULT_SECURITY_DAC + default "landlock,lockdown,yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor,bpf,ipe" help A comma-separated list of LSMs, in initialization order. Any LSMs left off this list will be ignored. This can be
security/Makefile +1 -0
@@ -24,6 +24,7 @@ obj-$(CONFIG_SECURITY_LOCKDOWN_LSM) += lockdown/ obj-$(CONFIG_CGROUPS) += device_cgroup.o obj-$(CONFIG_BPF_LSM) += bpf/ obj-$(CONFIG_SECURITY_LANDLOCK) += landlock/ +obj-$(CONFIG_SECURITY_IPE) += ipe/ # Object integrity file lists obj-$(CONFIG_INTEGRITY) += integrity/
security/ipe/Kconfig new file +17 -0
@@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Integrity Policy Enforcement (IPE) configuration +# + +menuconfig SECURITY_IPE + bool "Integrity Policy Enforcement (IPE)" + depends on SECURITY && SECURITYFS + select PKCS7_MESSAGE_PARSER + select SYSTEM_DATA_VERIFICATION + help + This option enables the Integrity Policy Enforcement LSM + allowing users to define a policy to enforce a trust-based access + control. A key feature of IPE is a customizable policy to allow + admins to reconfigure trust requirements on the fly. + + If unsure, answer N.
security/ipe/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# +# Makefile for building the IPE module as part of the kernel tree. +# + +obj-$(CONFIG_SECURITY_IPE) += \ + ctx.o \ + hooks.o \ + ipe.o \
security/ipe/ctx.c new file +145 -0
145 lines not on this page · raw message
security/ipe/ctx.h new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) Microsoft Corporation. All rights reserved. +*/ +#ifndef IPE_CONTEXT_H +#define IPE_CONTEXT_H + +#include <linux/sched.h> +#include <linux/types.h> +#include <linux/refcount.h> +#include <linux/spinlock.h> +#include <linux/workqueue.h> + +struct ipe_context { +refcount_t refcount; +/* Protects concurrent writers */ +spinlock_t lock; + +struct work_struct free_work; +}; + +int __init ipe_init_ctx (void ); +struct ipe_context __rcu **ipe_tsk_ctx (struct task_struct *tsk); +struct ipe_context *ipe_current_ctx (void ); +struct ipe_context *ipe_get_ctx_rcu (struct ipe_context __rcu *ctx); +void ipe_put_ctx (struct ipe_context *ctx); + +#endif /* IPE_CONTEXT_H */
security/ipe/hooks.c new file +54 -0
54 lines not on this page · raw message
security/ipe/hooks.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) Microsoft Corporation. All rights reserved. +*/ +#ifndef IPE_HOOKS_H +#define IPE_HOOKS_H + +#include <linux/types.h> +#include <linux/sched.h> + +int ipe_task_alloc (struct task_struct *task, +unsigned long clone_flags); + +void ipe_task_free (struct task_struct *task); + +#endif /* IPE_HOOKS_H */
security/ipe/ipe.c new file +73 -0
73 lines not on this page · raw message
security/ipe/ipe.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) Microsoft Corporation. All rights reserved. +*/ + +#ifndef IPE_H +#define IPE_H + +#define pr_fmt (fmt) "IPE " fmt "\n" + +#include "ctx.h" + +#include <linux/types.h> +#include <linux/sched.h> +#include <linux/lsm_hooks.h> + +#endif /* IPE_H */
Signature · 1 line
2.25.1
RFC PATCH v8 2/17 ipe: add policy parser
In reply to Deven BowersIPE's interpretation of the what the user trusts is accomplished through its policy. IPE's design is to not provide support for a single trust provider, but to support multiple providers to enable the end-user to choose the best one to seek their needs.
This requires the policy to be rather flexible and modular so that integrity providers, like fs-verity, dm-verity, dm-integrity, or some other system, can plug into the policy with minimal code changes, and IPE can
---
v2:
+ Split evaluation loop, access control hooks, and evaluation loop from policy parser and userspace interface to pass mailing list character limit
v3:
+ Move policy load and activation audit event to 03/12
+ Fix a potential panic when a policy failed to load.
+ use pr_warn for a failure to parse instead of an audit record
+ Remove comments from headers
+ Add lockdep assertions to ipe_update_active_policy and ipe_activate_policy
+ Fix up warnings with checkpatch --strict
+ Use file_ns_capable for CAP_MAC_ADMIN for securityfs nodes.
+ Use memdup_user instead of kzalloc+simple_write_to_buffer.
+ Remove strict_parse command line parameter, as it is added by the sysctl command line.
+ Prefix extern variables with ipe_
v4:
+ Remove securityfs to reverse-dependency
+ Add SHA1 reverse dependency.
+ Add versioning scheme for IPE properties, and associated interface to query the versioning scheme.
+ Cause a parser to always return an error on unknown syntax.
+ Remove strict_parse option
+ Change active_policy interface from sysctl, to securityfs, and change scheme.
v5:
+ Cause an error if a default action is not defined for each operaiton.
+ Minor function renames
v6:
+ No changes
v7:
+ Further split parser and userspace interface into two separate commits, for easier review.
+ Refactor policy parser to make code cleaner via introducing a more modular design, for easier extension of policy, and easier review.
v8:
+ remove unnecessary pr_info emission on parser loading
+ add explicit newline to the pr_err emitted when a parser fails to load.
--- include/asm-generic/vmlinux.lds.h | 16 + security/ipe/Makefile | 6 + security/ipe/ipe.c | 61 ++ security/ipe/ipe.h | 5 + security/ipe/ipe_parser.h | 59 ++ security/ipe/modules.c | 109 +++ security/ipe/modules.h | 17 + security/ipe/modules/ipe_module.h | 33 + security/ipe/parsers.c | 143 ++++ security/ipe/parsers/Makefile | 12 + security/ipe/parsers/default.c | 106 +++ security/ipe/parsers/policy_header.c | 126 ++++ security/ipe/policy.c | 946 +++++++++++++++++++++++++++ security/ipe/policy.h | 97 +++ 14 files changed, 1736 insertions(+) create mode 100644 security/ipe/ipe_parser.h create mode 100644 security/ipe/modules.c create mode 100644 security/ipe/modules.h create mode 100644 security/ipe/modules/ipe_module.h create mode 100644 security/ipe/parsers.c create mode 100644 security/ipe/parsers/Makefile create mode 100644 security/ipe/parsers/default.c create mode 100644 security/ipe/parsers/policy_header.c create mode 100644 security/ipe/policy.c create mode 100644 security/ipe/policy.h
include/asm-generic/vmlinux.lds.h +16 -0
@@ -284,6 +284,20 @@#define EARLY_LSM_TABLE ()#endif +#ifdef CONFIG_SECURITY_IPE +#define IPE_PARSER_TABLE () . = ALIGN(8); \ + __start_ipe_parsers = .; \ + KEEP(*(.ipe_parsers)) \ + __end_ipe_parsers = .; +#define IPE_MODULE_TABLE () . = ALIGN(8); \ + __start_ipe_modules = .; \ + KEEP(*(.ipe_modules)) \ + __end_ipe_modules = .; +#else +#define IPE_PARSER_TABLE () +#define IPE_MODULE_TABLE () +#endif +#define ___OF_TABLE (cfg, name) _OF_TABLE_##cfg(name)#define __OF_TABLE (cfg, name) ___OF_TABLE(cfg, name)#define OF_TABLE (cfg, name) __OF_TABLE(IS_ENABLED(cfg), name)
@@ -436,6 +450,8 @@ KEEP(*(__tracepoints_ptrs)) /* Tracepoints: pointer array */ \ __stop___tracepoints_ptrs = .; \ *(__tracepoints_strings)/* Tracepoints: strings */ \ + IPE_PARSER_TABLE() \ +IPE_MODULE_TABLE () \ } \ \ .rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \
security/ipe/Makefile +6 -0
@@ -5,7 +5,13 @@ # Makefile for building the IPE module as part of the kernel tree. # +ccflags-y := -I$(srctree)/security/ipe/modules + obj-$(CONFIG_SECURITY_IPE) += \ ctx.o \ hooks.o \ ipe.o \ + modules.o \ + parsers/ \ + parsers.o \ + policy.o \
security/ipe/ipe.c +61 -0
79 lines not on this page · raw message
security/ipe/ipe.h +5 -0
@@ -9,9 +9,14 @@#define pr_fmt (fmt) "IPE " fmt "\n"#include "ctx.h" +#include "ipe_parser.h" +#include "modules/ipe_module.h" #include <linux/types.h> #include <linux/sched.h> #include <linux/lsm_hooks.h> +extern struct ipe_parser __start_ipe_parsers[], __end_ipe_parsers[]; +extern struct ipe_module __start_ipe_modules[], __end_ipe_modules[]; +#endif /* IPE_H */
security/ipe/ipe_parser.h new file +59 -0
59 lines not on this page · raw message
security/ipe/modules.c new file +109 -0
109 lines not on this page · raw message
security/ipe/modules.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) Microsoft Corporation. All rights reserved. +*/ +#ifndef IPE_MODULES_H +#define IPE_MODULES_H + +#include "ipe.h" +#include "ipe_module.h" + +#include <linux/types.h> +#include <linux/rbtree.h> + +const struct ipe_module *ipe_lookup_module (const char *key); +int ipe_register_module (struct ipe_module *m); + +#endif /* IPE_MODULES_H */
security/ipe/modules/ipe_module.h new file +33 -0
@@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) Microsoft Corporation. All rights reserved. +*/ +#ifndef IPE_MODULE_H +#define IPE_MODULE_H + +#include <linux/types.h> + +/** +* ipe_module: definition of an extensible module for IPE properties. +* These structures are used to implement 'key=value' pairs +* in IPE policy, which will be evaluated on every IPE policy +* evaluation. +* +* Integrity mechanisms should be define as a module, and modules +* should manage their own dependencies via KConfig. @name is both +* the key half of the key=value pair in the policy, and the unique +* identifier for the module. +*/ +struct ipe_module { +const char *const name;/* required */ +u16 version;/* required */ +int (*parse)(const char *valstr,void **value);/* required */ +void (*free)(void **value);/* optional */ +}; + +#define IPE_MODULE (parser) \ + static struct ipe_module __ipe_module_##parser \ + __used __section(".ipe_modules") \ + __aligned(sizeof(unsigned long)) + +#endif /* IPE_MODULE_H */
security/ipe/parsers.c new file +143 -0
143 lines not on this page · raw message
security/ipe/parsers/Makefile new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# +# Makefile for building the IPE module as part of the kernel tree. +# + +ccflags-y := -I$(srctree)/security/ipe + +obj-$(CONFIG_SECURITY_IPE) += \ + default.o \ + policy_header.o \
security/ipe/parsers/default.c new file +106 -0
106 lines not on this page · raw message
security/ipe/parsers/policy_header.c new file +126 -0
126 lines not on this page · raw message
security/ipe/policy.c new file +946 -0
946 lines not on this page · raw message
security/ipe/policy.h new file +97 -0
97 lines not on this page · raw message
Signature · 1 line
2.25.1
Paul Moore
maintainerRe: [RFC PATCH v8 02/17] ipe: add policy parser
Quoted 84 lines · Deven Bowers
IPE's interpretation of the what the user trusts is accomplished through its policy. IPE's design is to not provide support for a single trust provider, but to support multiple providers to enable the end-user to choose the best one to seek their needs.
This requires the policy to be rather flexible and modular so that integrity providers, like fs-verity, dm-verity, dm-integrity, or some other system, can plug into the policy with minimal code changes, and IPE can
Signed-off-by Deven Bowers <[email protected]>---
v2:
+ Split evaluation loop, access control hooks, and evaluation loop from policy parser and userspace interface to pass mailing list character limitv3:
+ Move policy load and activation audit event to 03/12
+ Fix a potential panic when a policy failed to load.
+ usepr_warnfor a failure to parse instead of an audit record
+ Remove comments from headers
+ Add lockdep assertions toipe_update_active_policyandipe_activate_policy
+ Fix up warnings with checkpatch --strict
+ Usefile_ns_capableforCAP_MAC_ADMINfor securityfs nodes.
+ Usememdup_userinstead of kzalloc+simple_write_to_buffer.
+ Removestrict_parsecommand line parameter, as it is added by the sysctl command line.
+ Prefix extern variables withipe_v4:
+ Remove securityfs to reverse-dependency
+ Add SHA1 reverse dependency.
+ Add versioning scheme for IPE properties, and associated interface to query the versioning scheme.
+ Cause a parser to always return an error on unknown syntax.
+ Removestrict_parseoption
+ Changeactive_policyinterface from sysctl, to securityfs, and change scheme.v5:
+ Cause an error if a default action is not defined for each operaiton.
+ Minor function renamesv6:
+ No changesv7:
+ Further split parser and userspace interface into two separate commits, for easier review.+ Refactor policy parser to make code cleaner via introducing a more modular design, for easier extension of policy, and easier review.
v8:
+ remove unnecessarypr_infoemission on parser loading+ add explicit newline to the
pr_erremitted when a parser fails to load.--- include/asm-generic/vmlinux.lds.h | 16 + security/ipe/Makefile | 6 + security/ipe/ipe.c | 61 ++ security/ipe/ipe.h | 5 + security/ipe/ipe_parser.h | 59 ++ security/ipe/modules.c | 109 +++ security/ipe/modules.h | 17 + security/ipe/modules/ipe_module.h | 33 + security/ipe/parsers.c | 143 ++++ security/ipe/parsers/Makefile | 12 + security/ipe/parsers/default.c | 106 +++ security/ipe/parsers/policy_header.c | 126 ++++ security/ipe/policy.c | 946 +++++++++++++++++++++++++++ security/ipe/policy.h | 97 +++ 14 files changed, 1736 insertions(+) create mode 100644 security/ipe/ipe_parser.h create mode 100644 security/ipe/modules.c
Quoted 8 lines
create mode 100644 security/ipe/modules.h create mode 100644 security/ipe/modules/ipe_module.h create mode 100644 security/ipe/parsers.c create mode 100644 security/ipe/parsers/Makefile create mode 100644 security/ipe/parsers/default.c create mode 100644 security/ipe/parsers/policy_header.c create mode 100644 security/ipe/policy.c create mode 100644 security/ipe/policy.h
I had a few small comments while reading through this code, e.g. try to drop the support for quoted values, but I think my big issue here is that non-trivial string parsers in the kernel make me nervous and with +1700 lines spread across 14 files this is definitely a non-trivial parser.
I understand the basic 'key=value' pair format, and I think that's okay, but I worry about the added complexity in the parser brought about by the need to introduce an abstraction layer between the core parser(s) and modules. I realize flexibility is an important part of IPE, and this relies on the ability to add support for new language keys/modules, but I don't believe that requires the level of indirection seen here.
I'm not asking you to make radical changes to the IPE policy language, but I do believe spending some time to rethink how you parse the language would be a good idea. When in doubt keep the parser as simple as possible, you can always add complexity and more nuance in the future when the language requires it. The IPE policy language grammar is the immutable kernel/userspace API promise, not the parser implementation.
--
paul-moore.com
RFC PATCH v8 3/17 ipe: add evaluation loop
In reply to Deven BowersIPE must have a centralized function to evaluate incoming callers against IPE's policy. This iteration of the policy for against the rules for that specific caller is known as the evaluation loop.
---
v2:
+ Split evaluation loop, access control hooks, and evaluation loop from policy parser and userspace interface to pass mailing list character limit
v3:
+ Move ipe_load_properties to patch 04.
+ Remove useless 0-initializations
+ Prefix extern variables with ipe_
+ Remove kernel module parameters, as these are exposed through sysctls.
+ Add more prose to the IPE base config option help text.
+ Use GFP_KERNEL for audit_log_start.
+ Remove unnecessary caching system.
+ Remove comments from headers
+ Use rcu_access_pointer for rcu-pointer null check
+ Remove usage of reqprot; use prot only.
+ Move policy load and activation audit event to 03/12
v4:
+ Remove sysctls in favor of securityfs nodes
+ Re-add kernel module parameters, as these are now exposed through securityfs.
+ Refactor property audit loop to a separate function.
v5:
+ fix minor grammatical errors
+ do not group rule by curly-brace in audit record, reconstruct the exact rule.
v6:
+ No changes
v7:
+ Further split lsm creation into a separate commit from the evaluation loop and audit system, for easier review.
+ Propogating changes to support the new ipe_context structure in the evaluation loop.
Introduced in v8:
+ Remove ipe_hook enumeration; hooks can be correlated via syscall record.
--- security/ipe/Makefile | 1 + security/ipe/ctx.c | 59 +++++++++++- security/ipe/ctx.h | 6 ++ security/ipe/eval.c | 144 ++++++++++++++++++++++++++++++ security/ipe/eval.h | 24 +++++ security/ipe/modules/ipe_module.h | 3 + security/ipe/policy.c | 27 ++++++ security/ipe/policy.h | 4 + 8 files changed, 267 insertions(+), 1 deletion(-) create mode 100644 security/ipe/eval.c create mode 100644 security/ipe/eval.h
security/ipe/Makefile +1 -0
@@ -9,6 +9,7 @@ ccflags-y := -I$(srctree)/security/ipe/modules obj-$(CONFIG_SECURITY_IPE) += \ ctx.o \ + eval.o \ hooks.o \ ipe.o \ modules.o \
security/ipe/ctx.c +58 -1
89 lines not on this page · raw message
security/ipe/ctx.h +6 -0
@@ -12,10 +12,14 @@#include <linux/workqueue.h> struct ipe_context { +struct ipe_policy __rcu *active_policy; +refcount_t refcount;/* Protects concurrent writers */ spinlock_t lock; +struct list_head policies;/* type: ipe_policy */ +struct work_struct free_work; };
@@ -24,5 +28,7 @@ struct ipe_context __rcu **ipe_tsk_ctx(struct task_struct *tsk);struct ipe_context *ipe_current_ctx (void );struct ipe_context *ipe_get_ctx_rcu (struct ipe_context __rcu *ctx);void ipe_put_ctx (struct ipe_context *ctx); +void ipe_add_policy (struct ipe_context *ctx,struct ipe_policy *p); +void ipe_remove_policy (struct ipe_policy *p);#endif /* IPE_CONTEXT_H */
security/ipe/eval.c new file +144 -0
144 lines not on this page · raw message
security/ipe/eval.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) Microsoft Corporation. All rights reserved. +*/ + +#ifndef IPE_EVAL_H +#define IPE_EVAL_H + +#include <linux/file.h> + +#include "ctx.h" +#include "hooks.h" +#include "policy.h" + +struct ipe_eval_ctx { +enum ipe_operation op; + +const struct file *file; +struct ipe_context *ci_ctx; +}; + +int ipe_process_event (const struct file *file,enum ipe_operation op); + +#endif /* IPE_EVAL_H */
security/ipe/modules/ipe_module.h +3 -0
@@ -6,6 +6,7 @@#define IPE_MODULE_H #include <linux/types.h> +#include "../eval.h" /** * ipe_module: definition of an extensible module for IPE properties.
@@ -23,6 +24,8 @@ struct ipe_module {u16 version;/* required */ int (*parse)(const char *valstr,void **value);/* required */ void (*free)(void **value);/* optional */ +bool (*eval)(const struct ipe_eval_ctx *ctx,/* required */ +const void *val); };#define IPE_MODULE (parser) \
security/ipe/policy.c +27 -0
@@ -874,6 +874,32 @@ void ipe_put_policy(struct ipe_policy *p)kfree (p); } +/** +* ipe_get_policy_rcu: Dereference rcu-protected @p and increase the reference +* count. +* @p: rcu-protected pointer to dereference +* +* Not safe to call on IS_ERR. +* +* Return: +* !NULL - reference count of @p was valid, and increased by one. +* NULL - reference count of @p is not valid. +*/ +struct ipe_policy *ipe_get_policy_rcu (struct ipe_policy __rcu *p) +{ +struct ipe_policy *rv =NULL ; + +rcu_read_lock (); + + rv =rcu_dereference (p); +if (!rv || !refcount_inc_not_zero (&rv->refcount)) + rv =NULL ; + +rcu_read_unlock (); + +return rv; +} +static int set_pkcs7_data (void *ctx,const void *data,size_t len,size_t asn1hdrlen) {
@@ -912,6 +938,7 @@ struct ipe_policy *ipe_new_policy(const char *text, size_t textlen,return ERR_PTR (-ENOMEM );refcount_set (&new->refcount,1 ); +INIT_LIST_HEAD (&new->next);if (!text) { new->pkcs7len = pkcs7len;
security/ipe/policy.h +4 -0
@@ -87,11 +87,15 @@ struct ipe_policy {struct ipe_parsed_policy *parsed;refcount_t refcount; + +struct list_head next;/* type: ipe_policy */ + struct ipe_context __rcu *ctx; };struct ipe_policy *ipe_new_policy (const char *text,size_t textlen,const char *pkcs7,size_t pkcs7len);void ipe_put_policy (struct ipe_policy *pol);bool ipe_is_op_alias (int op,const enum ipe_operation **map,size_t *size); +struct ipe_policy *ipe_get_policy_rcu (struct ipe_policy __rcu *p);#endif /* IPE_POLICY_H */
Signature · 1 line
2.25.1
RFC PATCH v8 4/17 ipe: add userspace interface
In reply to Deven BowersAs is typical with LSMs, IPE uses securityfs as its interface with userspace. for a complete list of the interfaces and the respective inputs/outputs, please see the documentation under admin-guide/LSM/ipe.rst
---
v2:
+ Split evaluation loop, access control hooks, and evaluation loop from policy parser and userspace interface to pass mailing list character limit
v3:
+ Move policy load and activation audit event to 03/12
+ Fix a potential panic when a policy failed to load.
+ use pr_warn for a failure to parse instead of an audit record
+ Remove comments from headers
+ Add lockdep assertions to ipe_update_active_policy and ipe_activate_policy
+ Fix up warnings with checkpatch --strict
+ Use file_ns_capable for CAP_MAC_ADMIN for securityfs nodes.
+ Use memdup_user instead of kzalloc+simple_write_to_buffer.
+ Remove strict_parse command line parameter, as it is added by the sysctl command line.
+ Prefix extern variables with ipe_
v4:
+ Remove securityfs to reverse-dependency
+ Add SHA1 reverse dependency.
+ Add versioning scheme for IPE properties, and associated interface to query the versioning scheme.
+ Cause a parser to always return an error on unknown syntax.
+ Remove strict_parse option
+ Change active_policy interface from sysctl, to securityfs, and change scheme.
v5:
+ Cause an error if a default action is not defined for each operaiton.
+ Minor function renames
v6:
+ No changes
v7:
+ Propogating changes to support the new ipe_context structure in the evaluation loop.
+ Further split the parser and userspace interface changes into separate commits.
+ "raw" was renamed to "pkcs7" and made read only
+ "raw"'s write functionality (update a policy) moved to "update"
+ introduced "version", "policy_name" nodes.
+ "content" renamed to "policy"
+ changes to allow the compiled-in policy to be treated identical to deployed-after-the-fact policies.
Introduced in v8:
+ Prevent securityfs initialization if the LSM is disabled
--- security/ipe/Makefile | 2 + security/ipe/ctx.c | 121 +++++++++ security/ipe/ctx.h | 6 + security/ipe/fs.c | 173 +++++++++++++ security/ipe/fs.h | 13 + security/ipe/ipe.c | 3 + security/ipe/ipe.h | 2 + security/ipe/policy.c | 41 ++++ security/ipe/policy.h | 4 + security/ipe/policyfs.c | 528 ++++++++++++++++++++++++++++++++++++++++ 10 files changed, 893 insertions(+) create mode 100644 security/ipe/fs.c create mode 100644 security/ipe/fs.h create mode 100644 security/ipe/policyfs.c
security/ipe/Makefile +2 -0
@@ -10,9 +10,11 @@ ccflags-y := -I$(srctree)/security/ipe/modules obj-$(CONFIG_SECURITY_IPE) += \ ctx.o \ eval.o \ + fs.o \ hooks.o \ ipe.o \ modules.o \ parsers/ \ parsers.o \ policy.o \ + policyfs.o \
security/ipe/ctx.c +121 -0
146 lines not on this page · raw message
security/ipe/ctx.h +6 -0
@@ -7,6 +7,7 @@#include <linux/sched.h> #include <linux/types.h> +#include <linux/dcache.h> #include <linux/refcount.h> #include <linux/spinlock.h> #include <linux/workqueue.h>
@@ -20,6 +21,8 @@ struct ipe_context {struct list_head policies;/* type: ipe_policy */ +struct dentry *policy_root; +struct work_struct free_work; };
@@ -30,5 +33,8 @@ struct ipe_context *ipe_get_ctx_rcu(struct ipe_context __rcu *ctx);void ipe_put_ctx (struct ipe_context *ctx);void ipe_add_policy (struct ipe_context *ctx,struct ipe_policy *p);void ipe_remove_policy (struct ipe_policy *p); +int ipe_replace_policy (struct ipe_policy *old,struct ipe_policy *new); +int ipe_set_active_pol (const struct ipe_policy *p); +bool ipe_is_policy_active (const struct ipe_policy *p);#endif /* IPE_CONTEXT_H */
security/ipe/fs.c new file +173 -0
173 lines not on this page · raw message
security/ipe/fs.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) Microsoft Corporation. All rights reserved. +*/ + +#ifndef IPE_FS_H +#define IPE_FS_H + +void ipe_soft_del_policyfs (struct ipe_policy *p); +int ipe_new_policyfs_node (struct ipe_context *ctx,struct ipe_policy *p); +void ipe_del_policyfs_node (struct ipe_policy *p); + +#endif /* IPE_FS_H */
security/ipe/ipe.c +3 -0
@@ -18,6 +18,8 @@#include <linux/rcupdate.h> #include <linux/lsm_hooks.h> +bool ipe_enabled; + static struct lsm_blob_sizes ipe_blobs __lsm_ro_after_init = { .lbs_task =sizeof (struct ipe_context __rcu *), };
@@ -123,6 +125,7 @@ static int __init ipe_init(void)return rc;security_add_hooks (ipe_hooks,ARRAY_SIZE (ipe_hooks),"ipe" ); + ipe_enabled = true;return rc; }
security/ipe/ipe.h +2 -0
@@ -16,6 +16,8 @@#include <linux/sched.h> #include <linux/lsm_hooks.h> +extern bool ipe_enabled; +extern struct ipe_parser __start_ipe_parsers[], __end_ipe_parsers[];extern struct ipe_module __start_ipe_modules[], __end_ipe_modules[];
security/ipe/policy.c +41 -0
59 lines not on this page · raw message
security/ipe/policy.h +4 -0
@@ -88,12 +88,16 @@ struct ipe_policy {refcount_t refcount; +struct dentry *policyfs;struct list_head next;/* type: ipe_policy */ struct ipe_context __rcu *ctx; };struct ipe_policy *ipe_new_policy (const char *text,size_t textlen,const char *pkcs7,size_t pkcs7len); +struct ipe_policy *ipe_update_policy (struct ipe_policy *old,const char *text, +size_t textlen,const char *pkcs7, +size_t pkcs7len);void ipe_put_policy (struct ipe_policy *pol);bool ipe_is_op_alias (int op,const enum ipe_operation **map,size_t *size);struct ipe_policy *ipe_get_policy_rcu (struct ipe_policy __rcu *p);
security/ipe/policyfs.c new file +528 -0
528 lines not on this page · raw message
Signature · 1 line
2.25.1
RFC PATCH v8 5/17 ipe: add LSM hooks on execution and kernel read
In reply to Deven BowersIPE's initial goal is to control both execution and the loading of kernel modules based on the system's definition of trust. It accomplishes this by plugging into the security hooks for bprm_check_security, file_mprotect, mmap_file, kernel_load_data, and kernel_read_data.
---
v2:
+ Split evaluation loop, access control hooks, and evaluation loop from policy parser and userspace interface to pass mailing list character limit
v3:
+ Move ipe_load_properties to patch 04.
+ Remove useless 0-initializations
+ Prefix extern variables with ipe_
+ Remove kernel module parameters, as these are exposed through sysctls.
+ Add more prose to the IPE base config option help text.
+ Use GFP_KERNEL for audit_log_start.
+ Remove unnecessary caching system.
+ Remove comments from headers
+ Use rcu_access_pointer for rcu-pointer null check
+ Remove usage of reqprot; use prot only.
+ Move policy load and activation audit event to 03/12
v4:
+ Remove sysctls in favor of securityfs nodes
+ Re-add kernel module parameters, as these are now exposed through securityfs.
+ Refactor property audit loop to a separate function.
v5:
+ fix minor grammatical errors
+ do not group rule by curly-brace in audit record, reconstruct the exact rule.
v6:
+ No changes
v7:
+ Further split lsm creation, the audit system, the evaluation loop and access control hooks into separate commits.
v8:
+ Rename hook functions to follow the lsmname_hook_name convention
+ Remove ipe_hook enumeration, can be derived from correlation with syscall audit record.
--- security/ipe/hooks.c | 150 ++++++++++++++++++++++++++++++++++++++++++ security/ipe/hooks.h | 16 +++++ security/ipe/ipe.c | 5 ++ security/ipe/policy.c | 23 +++++++ security/ipe/policy.h | 12 +++- 5 files changed, 204 insertions(+), 2 deletions(-)
security/ipe/hooks.c +150 -0
@@ -6,11 +6,15 @@#include "ipe.h" #include "ctx.h" #include "hooks.h" +#include "eval.h" +#include <linux/fs.h> #include <linux/sched.h> #include <linux/types.h> #include <linux/refcount.h> #include <linux/rcupdate.h> +#include <linux/binfmts.h> +#include <linux/mman.h> /** * ipe_task_alloc: Assign a new context for an associated task structure.
@@ -52,3 +56,149 @@ void ipe_task_free(struct task_struct *task)ipe_put_ctx (ctx);rcu_read_unlock (); } + +/** +* ipe_bprm_check_security: LSM hook called when a process is loaded through the exec +* family of system calls. +* @bprm: Supplies a pointer to a linux_binprm structure to source the file +* being evaluated. +* +* Return: +* 0 - OK +* !0 - Error +*/ +int ipe_bprm_check_security (struct linux_binprm *bprm) +{ +return ipe_process_event (bprm->file, ipe_operation_exec); +} + +/** +* ipe_mmap_file: LSM hook called when a file is loaded through the mmap +* family of system calls. +* @f: File being mmap'd. Can be NULL in the case of anonymous memory. +* @reqprot: The requested protection on the mmap, passed from usermode. +* @prot: The effective protection on the mmap, resolved from reqprot and +* system configuration. +* @flags: Unused. +* +* Return: +* 0 - OK +* !0 - Error +*/ +int ipe_mmap_file (struct file *f,unsigned long reqprot,unsigned long prot, +unsigned long flags) +{ +if (prot &PROT_EXEC || reqprot &PROT_EXEC ) +return ipe_process_event (f, ipe_operation_exec); + +return 0 ; +} + +/** +* ipe_file_mprotect: LSM hook called when a mmap'd region of memory is changing +* its protections via mprotect. +* @vma: Existing virtual memory area created by mmap or similar +* @reqprot: The requested protection on the mmap, passed from usermode. +* @prot: The effective protection on the mmap, resolved from reqprot and +* system configuration. +* +* Return: +* 0 - OK +* !0 - Error +*/ +int ipe_file_mprotect (struct vm_area_struct *vma,unsigned long reqprot, +unsigned long prot) +{ +/* Already Executable */ +if (vma->vm_flags &VM_EXEC ) +return 0 ; + +if (prot &PROT_EXEC ) +return ipe_process_event (vma->vm_file, ipe_operation_exec); + +return 0 ; +} + +/** +* ipe_kernel_read_file: LSM hook called when a file is being read in from +* disk. +* @file: Supplies a pointer to the file structure being read in from disk +* @id: Supplies the enumeration identifying the purpose of the read. +* @contents: Unused. +* +* Return: +* 0 - OK +* !0 - Error +*/ +int ipe_kernel_read_file (struct file *file,enum kernel_read_file_id id, +bool contents) +{ +enum ipe_operation op; + +switch (id) { +case READING_FIRMWARE : + op = ipe_operation_firmware; +break ; +case READING_MODULE : + op = ipe_operation_kernel_module; +break ; +case READING_KEXEC_INITRAMFS : + op = ipe_operation_kexec_initramfs; +break ; +case READING_KEXEC_IMAGE : + op = ipe_operation_kexec_image; +break ; +case READING_POLICY : + op = ipe_operation_ima_policy; +break ; +case READING_X509_CERTIFICATE : + op = ipe_operation_ima_x509; +break ; +default : + op = ipe_operation_max; + } + +WARN (op == ipe_operation_max,"no rule setup for enum %d" , id); +return ipe_process_event (file, op); +} + +/** +* ipe_kernel_load_data: LSM hook called when a buffer is being read in from +* disk. +* @id: Supplies the enumeration identifying the purpose of the read. +* @contents: Unused. +* +* Return: +* 0 - OK +* !0 - Error +*/ +int ipe_kernel_load_data (enum kernel_load_data_id id,bool contents) +{ +enum ipe_operation op; + +switch (id) { +case LOADING_FIRMWARE : + op = ipe_operation_firmware; +break ; +case LOADING_MODULE : + op = ipe_operation_kernel_module; +break ; +case LOADING_KEXEC_INITRAMFS : + op = ipe_operation_kexec_initramfs; +break ; +case LOADING_KEXEC_IMAGE : + op = ipe_operation_kexec_image; +break ; +case LOADING_POLICY : + op = ipe_operation_ima_policy; +break ; +case LOADING_X509_CERTIFICATE : + op = ipe_operation_ima_x509; +break ; +default : + op = ipe_operation_max; + } + +WARN (op == ipe_operation_max,"no rule setup for enum %d" , id); +return ipe_process_event (NULL , op); +}
security/ipe/hooks.h +16 -0
@@ -5,12 +5,28 @@#ifndef IPE_HOOKS_H #define IPE_HOOKS_H +#include <linux/fs.h> #include <linux/types.h> #include <linux/sched.h> +#include <linux/binfmts.h> +#include <linux/security.h> int ipe_task_alloc (struct task_struct *task,unsigned long clone_flags);void ipe_task_free (struct task_struct *task); +int ipe_bprm_check_security (struct linux_binprm *bprm); + +int ipe_mmap_file (struct file *f,unsigned long reqprot,unsigned long prot, +unsigned long flags); + +int ipe_file_mprotect (struct vm_area_struct *vma,unsigned long reqprot, +unsigned long prot); + +int ipe_kernel_read_file (struct file *file,enum kernel_read_file_id id, +bool contents); + +int ipe_kernel_load_data (enum kernel_load_data_id id,bool contents); +#endif /* IPE_HOOKS_H */
security/ipe/ipe.c +5 -0
@@ -27,6 +27,11 @@ static struct lsm_blob_sizes ipe_blobs __lsm_ro_after_init = { static struct security_hook_list ipe_hooks[] __lsm_ro_after_init = {LSM_HOOK_INIT (task_alloc, ipe_task_alloc),LSM_HOOK_INIT (task_free, ipe_task_free), +LSM_HOOK_INIT (bprm_check_security, ipe_bprm_check_security), +LSM_HOOK_INIT (mmap_file, ipe_mmap_file), +LSM_HOOK_INIT (file_mprotect, ipe_file_mprotect), +LSM_HOOK_INIT (kernel_read_file, ipe_kernel_read_file), +LSM_HOOK_INIT (kernel_load_data, ipe_kernel_load_data), };/**
security/ipe/policy.c +23 -0
@@ -483,6 +483,14 @@ int ipe_parse_op(const struct ipe_policy_token *tok, {substring_t match[MAX_OPT_ARGS ] = {0 };const match_table_t ops = { + { ipe_operation_exec,"EXECUTE" }, + { ipe_operation_firmware,"FIRMWARE" }, + { ipe_operation_kernel_module,"KMODULE" }, + { ipe_operation_kexec_image,"KEXEC_IMAGE" }, + { ipe_operation_kexec_initramfs,"KEXEC_INITRAMFS" }, + { ipe_operation_ima_policy,"IMA_POLICY" }, + { ipe_operation_ima_x509,"IMA_X509_CERT" }, + { ipe_op_alias_kernel_read,"KERNEL_READ" }, { ipe_op_alias_max,NULL }, };
@@ -838,6 +846,15 @@ static int parse_policy(struct ipe_policy *p)return rc; } +static const enum ipe_operation alias_kread[] = { + ipe_operation_firmware, + ipe_operation_kernel_module, + ipe_operation_ima_policy, + ipe_operation_ima_x509, + ipe_operation_kexec_image, + ipe_operation_kexec_initramfs, +}; +/** * ipe_is_op_alias: Determine if @op is an alias for one or more operations * @op: Supplies the operation to check. Should be either ipe_operation or
@@ -852,9 +869,15 @@ static int parse_policy(struct ipe_policy *p)bool ipe_is_op_alias (int op,const enum ipe_operation **map,size_t *size) {switch (op) { +case ipe_op_alias_kernel_read: + *map = alias_kread; + *size =ARRAY_SIZE (alias_kread); +break ;default :return false; } + +return true; }/**
security/ipe/policy.h +10 -2
@@ -26,7 +26,14 @@ struct ipe_policy_line {struct ipe_module ;enum ipe_operation { - ipe_operation_max =0 , + ipe_operation_exec =0 , + ipe_operation_firmware, + ipe_operation_kernel_module, + ipe_operation_kexec_image, + ipe_operation_kexec_initramfs, + ipe_operation_ima_policy, + ipe_operation_ima_x509, + ipe_operation_max };/*
@@ -34,7 +41,8 @@ enum ipe_operation {* that are just one or more operations under the hood */ enum ipe_op_alias { - ipe_op_alias_max = ipe_operation_max, + ipe_op_alias_kernel_read = ipe_operation_max, + ipe_op_alias_max, };enum ipe_action {
Signature · 1 line
2.25.1
RFC PATCH v8 6/17 uapi|audit: add ipe audit message definitions
In reply to Deven BowersIntroduce new definitions to audit.h centered around trust decisions and policy loading and activation, as an extension of the mandatory access control fields.
---
v2:
+ Split evaluation loop, access control hooks, and evaluation loop from policy parser and userspace interface to pass mailing list character limit
v3:
+ Move ipe_load_properties to patch 04.
+ Remove useless 0-initializations
+ Prefix extern variables with ipe_
+ Remove kernel module parameters, as these are exposed through sysctls.
+ Add more prose to the IPE base config option help text.
+ Use GFP_KERNEL for audit_log_start.
+ Remove unnecessary caching system.
+ Remove comments from headers
+ Use rcu_access_pointer for rcu-pointer null check
+ Remove usage of reqprot; use prot only.
+ Move policy load and activation audit event to 03/12
v4:
+ Remove sysctls in favor of securityfs nodes
+ Re-add kernel module parameters, as these are now exposed through securityfs.
+ Refactor property audit loop to a separate function.
v5:
+ fix minor grammatical errors
+ do not group rule by curly-brace in audit record, reconstruct the exact rule.
v6:
+ No changes
v7:
+ Further split audit system patch into two separate patches; one for include/uapi, and the usage of the new defines.
+ Change audit records to MAC region (14XX) from
Integrity region (18XX), as IPE is an effectively a MAC system around authenticity versus an extension to the integrity subsystem.
+ Generalize the #defines to support the class of trust-based access-control LSMs.
v8:
+ Change audit type:
+ AUDIT_TRUST_RESULT -> AUDIT_IPE_ACCESS
+ Remove audit types (replaced by existing types):
+ AUDIT_TRUST_POLICY_LOAD
+ AUDIT_TRUST_POLICY_ACTIVATE
+ AUDIT_TRUST_STATUS
--- include/uapi/linux/audit.h | 1 + 1 file changed, 1 insertion(+)
include/uapi/linux/audit.h +1 -0
@@ -143,6 +143,7 @@#define AUDIT_MAC_UNLBL_STCDEL 1417/* NetLabel: del a static label */ #define AUDIT_MAC_CALIPSO_ADD 1418/* NetLabel: add CALIPSO DOI entry */ #define AUDIT_MAC_CALIPSO_DEL 1419/* NetLabel: del CALIPSO DOI entry */ +#define AUDIT_IPE_ACCESS 1420/* IPE Denial or Grant */ #define AUDIT_FIRST_KERN_ANOM_MSG 1700#define AUDIT_LAST_KERN_ANOM_MSG 1799
Signature · 1 line
2.25.1
RFC PATCH v8 7/17 ipe: add auditing support
In reply to Deven BowersUsers of IPE require a way to identify when and why an operation fails, allowing them to both respond to violations of policy and be notified of potentially malicious actions on their systens with respect to IPE itself.
The new 1420 audit, AUDIT_IPE_ACCESS indicates the result of a policy evaulation of a resource. The other two events, AUDIT_MAC_POLICY_LOAD, and AUDIT_MAC_CONFIG_CHANGE represent a new policy was loaded into the kernel and the currently active policy changed, respectively.
This patch also adds support for success auditing, allowing users to identify how a resource passed policy. It is recommended to use this option with caution, as it is quite noisy.
---
This patch adds the following audit records:
type=1420 audit(1653364735.161:64):
rule="DEFAULT op=EXECUTE action=DENY"
type=1420 audit(1653364370.067:61): path="/root/fs/rw/plain/execve"
dev="vdc1" ino=16 rule="DEFAULT op=EXECUTE action=DENY"
type=1405 audit(1653425583.136:54): policy_name="dmverity_roothash"
policy_version=0.0.0 sha256=A9C5803309F80D2B84D7C047534BE8B60EF121C8E1F351F2A8EFFA617B7F0686
type=1403 audit(1653425529.927:53): policy_name="dmverity_roothash"
policy_version=0.0.0 sha256=A9C5803309F80D2B84D7C047534BE8B60EF121C8E1F351F2A8EFFA617B7F0686
This results in the following events (the audit records are always prior to a SYSCALL record):
type=1420 audit(1653364735.161:64):
rule="DEFAULT op=EXECUTE action=DENY"
type=1300 audit(1653364735.161:64): arch=c000003e syscall=9
success=no exit=-13 a0=0 a1=1000 a2=4 a3=20 items=0 ppid=455 pid=774
auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0
tty=ttyS0 ses=3 comm="mmap" exe="/root/host/mmap" subj=kernel
key=(null)
audit: type=1327 audit(1653364735.161:64):
proctitle=686F73742F6D6D617000410058 type=1420 audit(1653364370.067:61): path="/root/fs/rw/plain/execve"
dev="vdc1" ino=16 rule="DEFAULT op=EXECUTE action=DENY"
type=1300 audit(1653364370.067:61): arch=c000003e syscall=10
success=no exit=-13 a0=7f0bf0644000 a1=4f80 a2=5 a3=7f0bf043d300 items=0 ppid=455 pid=737 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=ttyS0 ses=3 comm="mprotect" exe="/root/host/mprotect" subj=kernel key=(null)
type=1327 audit(1653364370.067:61):
proctitle=686F73742F6D70726F7465637400534800527C5700527C5800706C61696E2F657865637665
type=1403 audit(1653425529.927:53): policy_name="dmverity_roothash"
policy_version=0.0.0 sha256=A9C5803309F80D2B84D7C047534BE8B60EF121C8E1F351F2A8EFFA617B7F0686
type=1300 audit(1653425529.927:53): arch=c000003e syscall=1
success=yes exit=6215 a0=1 a1=7f07adfe4000 a2=1847 a3=22 items=0
ppid=441 pid=445 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=)
type=1327 audit(1653425529.927:53):
proctitle=63617400706F6C69636965732F646D7665726974795F726F6F74686173682E706F6C2E703762type=1405 audit(1653425583.136:54): policy_name="dmverity_roothash"
policy_version=0.0.0 sha256=A9C5803309F80D2B84D7C047534BE8B60EF121C8E1F351F2A8EFFA617B7F0686
type=1300 audit(1653425583.136:54): arch=c000003e syscall=1 success=yes
exit=2 a0=1 a1=55c1065e5c60 a2=2 a3=7fe683990020 items=0 ppid=405
pid=441 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 e)type=1327 audit(1653425583.136:54): proctitle="-bash"
---
v2:
+ Split evaluation loop, access control hooks, and evaluation loop from policy parser and userspace interface to pass mailing list character limit
v3:
+ Move ipe_load_properties to patch 04.
+ Remove useless 0-initializations
+ Prefix extern variables with ipe_
+ Remove kernel module parameters, as these are exposed through sysctls.
+ Add more prose to the IPE base config option help text.
+ Use GFP_KERNEL for audit_log_start.
+ Remove unnecessary caching system.
+ Remove comments from headers
+ Use rcu_access_pointer for rcu-pointer null check
+ Remove usage of reqprot; use prot only.
+ Move policy load and activation audit event to 03/12
v4:
+ Remove sysctls in favor of securityfs nodes
+ Re-add kernel module parameters, as these are now exposed through securityfs.
+ Refactor property audit loop to a separate function.
v5:
+ fix minor grammatical errors
+ do not group rule by curly-brace in audit record, reconstruct the exact rule.
v6:
+ No changes
v7:
+ Further split lsm creation, the audit system, the evaluation loop, and access control hooks into separate patches.
+ Further split audit system patch into two separate patches; one for include/uapi, and the usage of the new defines.
+ Split out the permissive functionality into another separate patch, for easier review.
+ Correct misuse of audit_log_n_untrusted string to audit_log_format
+ Use get_task_comm instead of comm directly.
+ Quote certain audit values
+ Remove unnecessary help text on choice options - these were previously idented at the wrong level
+ Correct a stale string constant (ctx_ns_enforce to ctx_enforce)
v8:
+ Change dependency for CONFIG_AUDIT to CONFIG_AUDITSYSCALL
+ Drop ctx_* prefix
+ Reuse, where appropriate, the audit fields from the field
dictionary. This transforms:
ctx_pathname -> path
ctx_ino -> ino
ctx_dev -> dev + Add audit records and event examples to commit description.
+ Remove new_audit_ctx, replace with audit_log_start. All data that would provided by new_audit_ctx is already present in the syscall audit record, that is always emitted on these actions. The audit records should be correlated as such.
+ Change audit types:
+ AUDIT_TRUST_RESULT -> AUDIT_IPE_ACCESS
+ This prevents overloading of the AVC type.
+ AUDIT_TRUST_POLICY_ACTIVATE -> AUDIT_MAC_CONFIG_CHANGE
+ AUDIT_TRUST_POLICY_LOAD -> AUDIT_MAC_POLICY_LOAD
+ There were no significant difference in meaning between these types.
+ Remove enforcing parameter passed from the context structure for AUDIT_IPE_ACCESS.
+ This field can be inferred from the SYSCALL audit event, based on the success field.
+ Remove all fields already captured in the syscall record. "hook", an IPE specific field, can be determined via the syscall field in the syscall record itself, so it has been removed.
+ ino, path, and dev in IPE's record refer to the subject of the syscall, while the syscall record refers to the calling process.
+ remove IPE prefix from policy load/policy activation events
+ fix a bug wherein a policy change audit record was not fired when updating a policy
--- security/ipe/Kconfig | 55 +++++++++ security/ipe/Makefile | 2 + security/ipe/audit.c | 184 ++++++++++++++++++++++++++++++ security/ipe/audit.h | 34 ++++++ security/ipe/ctx.c | 21 ++++ security/ipe/ctx.h | 2 + security/ipe/eval.c | 9 ++ security/ipe/eval.h | 7 ++ security/ipe/fs.c | 79 +++++++++++++ security/ipe/modules/ipe_module.h | 2 + 10 files changed, 395 insertions(+) create mode 100644 security/ipe/audit.c create mode 100644 security/ipe/audit.h
security/ipe/Kconfig +55 -0
@@ -15,3 +15,58 @@ menuconfig SECURITY_IPE admins to reconfigure trust requirements on the fly. If unsure, answer N. + +if SECURITY_IPE + +config IPE_AUDIT + bool "Enable IPE's audit events" + depends on AUDIT && AUDITSYSCALL + help + This option causes IPE to emit audit records on certain key + events during IPE's normal operation. Examples include: + when an action is denied by IPE policy, when a new policy is + loaded, and when a new policy is active. This allows system + admins to analyze what is happening on their systems, and + validate through audit records that IPE is responsible for + certain behaviors. + + if unsure, answer Y. + +choice + prompt "Hash algorithm used in auditing policies" + default IPE_AUDIT_HASH_SHA1 + depends on IPE_AUDIT + help + Specify the hash algorithm used when auditing policies. + The hash is used to uniquely identify a policy from other + policies on the system. + + If unsure, leave default. + + config IPE_AUDIT_HASH_SHA1 + bool "sha1" + select CRYPTO_SHA1 + + config IPE_AUDIT_HASH_SHA256 + bool "sha256" + select CRYPTO_SHA256 + + config IPE_AUDIT_HASH_SHA384 + bool "sha384" + select CRYPTO_SHA512 + + config IPE_AUDIT_HASH_SHA512 + bool "sha512" + select CRYPTO_SHA512 + +endchoice + +config IPE_AUDIT_HASH_ALG + string + depends on IPE_AUDIT + default "sha1" if IPE_AUDIT_HASH_SHA1 + default "sha256" if IPE_AUDIT_HASH_SHA256 + default "sha384" if IPE_AUDIT_HASH_SHA384 + default "sha512" if IPE_AUDIT_HASH_SHA512 + +endif
security/ipe/Makefile +2 -0
@@ -18,3 +18,5 @@ obj-$(CONFIG_SECURITY_IPE) += \ parsers.o \ policy.o \ policyfs.o \ + +obj-$(CONFIG_IPE_AUDIT) += audit.o
security/ipe/audit.c new file +184 -0
184 lines not on this page · raw message
security/ipe/audit.h new file +34 -0
@@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) Microsoft Corporation. All rights reserved. +*/ + +#ifndef IPE_AUDIT_H +#define IPE_AUDIT_H + +#include "ipe.h" +#include "eval.h" + +#ifdef CONFIG_IPE_AUDIT +void ipe_audit_match (const struct ipe_eval_ctx *const ctx, +enum ipe_match match_type, +enum ipe_action act,const struct ipe_rule *const r); +void ipe_audit_policy_load (const struct ipe_policy *const p); +void ipe_audit_policy_activation (const struct ipe_policy *const p); +#else +static inline void ipe_audit_match (const struct ipe_eval_ctx *const ctx, +enum ipe_match match_type, +enum ipe_action act,const struct ipe_rule *const r) +{ +} + +static inline void ipe_audit_policy_load (const struct ipe_policy *const p) +{ +} + +static inline void ipe_audit_policy_activation (const struct ipe_policy *const p) +{ +} +#endif /* CONFIG_IPE_AUDIT */ + +#endif /* IPE_AUDIT_H */
security/ipe/ctx.c +21 -0
@@ -6,12 +6,16 @@#include "ipe.h" #include "ctx.h" #include "policy.h" +#include "audit.h" #include <linux/slab.h> #include <linux/types.h> #include <linux/parser.h> #include <linux/refcount.h> #include <linux/spinlock.h> +#include <linux/moduleparam.h> + +static bool success_audit;/** * ver_to_u64: convert an internal ipe_policy_version to a u64
@@ -217,6 +221,9 @@ int ipe_replace_policy(struct ipe_policy *old, struct ipe_policy *new)spin_unlock (&ctx->lock);synchronize_rcu (); +if (!rc) +ipe_audit_policy_load (new); +ipe_put_policy (p);ipe_put_ctx (ctx);return rc;
@@ -249,6 +256,7 @@ int ipe_set_active_pol(const struct ipe_policy *p)spin_unlock (&ctx->lock);synchronize_rcu (); +ipe_audit_policy_activation (p); out:ipe_put_policy (ap);ipe_put_ctx (ctx);
@@ -314,6 +322,10 @@ int __init ipe_init_ctx(void) goto err; } +spin_lock (&lns->lock); +WRITE_ONCE (lns->success_audit, success_audit); +spin_unlock (&lns->lock); +rcu_assign_pointer (*ipe_tsk_ctx (current), lns);return 0 ;
@@ -321,3 +333,12 @@ int __init ipe_init_ctx(void)ipe_put_ctx (lns);return rc; } + +/* Set the right module name */ +#ifdef KBUILD_MODNAME +#undef KBUILD_MODNAME +#define KBUILD_MODNAME "ipe" +#endif + +module_param (success_audit, bool,0400 ); +MODULE_PARM_DESC (success_audit,"Start IPE with success auditing enabled" );
security/ipe/ctx.h +2 -0
@@ -15,6 +15,8 @@struct ipe_context {struct ipe_policy __rcu *active_policy; +bool __rcu success_audit; +refcount_t refcount;/* Protects concurrent writers */ spinlock_t lock;
security/ipe/eval.c +9 -0
@@ -9,6 +9,7 @@#include "hooks.h" #include "policy.h" #include "modules/ipe_module.h" +#include "audit.h" #include <linux/slab.h> #include <linux/file.h>
@@ -71,7 +72,9 @@ static int evaluate(const struct ipe_eval_ctx *const ctx) {int rc =0 ;bool match = false; +bool enforcing = true;enum ipe_action action; +enum ipe_match match_type;struct ipe_policy *pol =NULL ;const struct ipe_rule *rule =NULL ;const struct ipe_policy_mod *module =NULL ;
@@ -83,6 +86,7 @@ static int evaluate(const struct ipe_eval_ctx *const ctx)if (ctx->op == ipe_operation_max) { action = pol->parsed->global_default; + match_type = ipe_match_global; goto eval; }
@@ -100,13 +104,18 @@ static int evaluate(const struct ipe_eval_ctx *const ctx)if (match) { action = rule->action; + match_type = ipe_match_rule; }else if (rules->default_action != ipe_action_max) { action = rules->default_action; + match_type = ipe_match_table; }else { action = pol->parsed->global_default; + match_type = ipe_match_global; } eval: +ipe_audit_match (ctx, match_type, action, rule); +if (action == ipe_action_deny) rc = -EACCES ;
security/ipe/eval.h +7 -0
@@ -19,6 +19,13 @@ struct ipe_eval_ctx { struct ipe_context *ci_ctx; }; +enum ipe_match { + ipe_match_rule =0 , + ipe_match_table, + ipe_match_global, + ipe_match_max +}; +int ipe_process_event (const struct file *file,enum ipe_operation op);#endif /* IPE_EVAL_H */
security/ipe/fs.c +79 -0
115 lines not on this page · raw message
security/ipe/modules/ipe_module.h +2 -0
@@ -6,6 +6,7 @@#define IPE_MODULE_H #include <linux/types.h> +#include <linux/audit.h> #include "../eval.h" /**
@@ -26,6 +27,7 @@ struct ipe_module {void (*free)(void **value);/* optional */ bool (*eval)(const struct ipe_eval_ctx *ctx,/* required */ const void *val); +void (*audit)(struct audit_buffer *ab,const void *val);/* required */ };#define IPE_MODULE (parser) \
Signature · 1 line
2.25.1
Paul Moore
maintainerRe: [RFC PATCH v8 07/17] ipe: add auditing support
Quoted 11 lines · Deven Bowers
Users of IPE require a way to identify when and why an operation fails, allowing them to both respond to violations of policy and be notified of potentially malicious actions on their systens with respect to IPE itself.
The new 1420 audit,
AUDIT_IPE_ACCESSindicates the result of a policy evaulation of a resource. The other two events,AUDIT_MAC_POLICY_LOAD, andAUDIT_MAC_CONFIG_CHANGErepresent a new policy was loaded into the kernel and the currently active policy changed, respectively.
Quoted 6 lines
This patch also adds support for success auditing, allowing users to identify how a resource passed policy. It is recommended to use this option with caution, as it is quite noisy.
Signed-off-by Deven Bowers <[email protected]>---
One quick comment: I would suggest squashing patch 6/17 together with this one (7/17), as there is no real need for the AUDIT_IPE_ACCESS definition to be in its own patch.
... and now the hard questions: why are the audit record examples not included in the commit description? :)
Quoted 4 lines
This patch adds the following audit records:
type=1420 audit(1653364735.161:64):
rule="DEFAULT op=EXECUTE action=DENY"
I suspect I'll have more comments on this when I get to the relevant chunk in this patch, but if the "rule" string is coming directly from userspace we should make sure it is recorded as an untrusted string. Given the extensible nature of IPE, it might be a good idea to make it untrusted regardless just so we don't run into problems in the future.
What does this record actually indicate? With it being type 1420, I'm assuming it is the result of an IPE access control decision, but for what?
Quoted 2 lines
type=1420 audit(1653364370.067:61): path="/root/fs/rw/plain/execve"
dev="vdc1" ino=16 rule="DEFAULT op=EXECUTE action=DENY"
Why are we repeating the rule in the record which reports on the access control verdict? There is always a concern around the size of heavily configured audit streams, this is not going to help.
Quoted 2 lines
type=1405 audit(1653425583.136:54): policy_name="dmverity_roothash"
policy_version=0.0.0 sha256=A9C5803309F80D2B84D7C047534BE8B60EF121C8E1F351F2A8EFFA617B7F0686
What changed? How is this record useful?
Quoted 2 lines
type=1403 audit(1653425529.927:53): policy_name="dmverity_roothash"
policy_version=0.0.0 sha256=A9C5803309F80D2B84D7C047534BE8B60EF121C8E1F351F2A8EFFA617B7F0686
The policy loads should probably attempt to mimic some of the existing LSMs, for example:
type=MAC_POLICY_LOAD msg=audit(06/15/2022 17:31:54.281:878) : \
auid=root ses=4 lsm=selinux res=yesQuoted 153 lines
This results in the following events (the audit records are always prior to a SYSCALL record):
type=1420 audit(1653364735.161:64):
rule="DEFAULT op=EXECUTE action=DENY"
type=1300 audit(1653364735.161:64): arch=c000003e syscall=9success=no exit=-13 a0=0 a1=1000 a2=4 a3=20 items=0 ppid=455 pid=774 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=ttyS0 ses=3 comm="mmap" exe="/root/host/mmap" subj=kernel key=(null) audit: type=1327 audit(1653364735.161:64): proctitle=686F73742F6D6D617000410058type=1420 audit(1653364370.067:61): path="/root/fs/rw/plain/execve"
dev="vdc1" ino=16 rule="DEFAULT op=EXECUTE action=DENY"
type=1300 audit(1653364370.067:61): arch=c000003e syscall=10
success=no exit=-13 a0=7f0bf0644000 a1=4f80 a2=5 a3=7f0bf043d300 items=0 ppid=455 pid=737 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=ttyS0 ses=3 comm="mprotect" exe="/root/host/mprotect" subj=kernel key=(null)
type=1327 audit(1653364370.067:61):proctitle=686F73742F6D70726F7465637400534800527C5700527C5800706C61696E2F657865637665type=1403 audit(1653425529.927:53): policy_name="dmverity_roothash"
policy_version=0.0.0 sha256=A9C5803309F80D2B84D7C047534BE8B60EF121C8E1F351F2A8EFFA617B7F0686 type=1300 audit(1653425529.927:53): arch=c000003e syscall=1 success=yes exit=6215 a0=1 a1=7f07adfe4000 a2=1847 a3=22 items=0 ppid=441 pid=445 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=) type=1327 audit(1653425529.927:53): proctitle=63617400706F6C69636965732F646D7665726974795F726F6F74686173682E706F6C2E703762type=1405 audit(1653425583.136:54): policy_name="dmverity_roothash"
policy_version=0.0.0 sha256=A9C5803309F80D2B84D7C047534BE8B60EF121C8E1F351F2A8EFFA617B7F0686 type=1300 audit(1653425583.136:54): arch=c000003e syscall=1 success=yes exit=2 a0=1 a1=55c1065e5c60 a2=2 a3=7fe683990020 items=0 ppid=405 pid=441 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 e)type=1327 audit(1653425583.136:54): proctitle="-bash"
---
v2:
+ Split evaluation loop, access control hooks, and evaluation loop from policy parser and userspace interface to pass mailing list character limitv3:
+ Moveipe_load_propertiesto patch 04.
+ Remove useless 0-initializations
+ Prefix extern variables withipe_
+ Remove kernel module parameters, as these are exposed through sysctls.
+ Add more prose to the IPE base config option help text.
+ UseGFP_KERNELforaudit_log_start.
+ Remove unnecessary caching system.
+ Remove comments from headers
+ Usercu_access_pointerfor rcu-pointer null check
+ Remove usage of reqprot; use prot only.
+ Move policy load and activation audit event to 03/12v4:
+ Remove sysctls in favor of securityfs nodes
+ Re-add kernel module parameters, as these are now exposed through securityfs.
+ Refactor property audit loop to a separate function.v5:
+ fix minor grammatical errors
+ do not group rule by curly-brace in audit record, reconstruct the exact rule.v6:
+ No changesv7:
+ Further split lsm creation, the audit system, the evaluation loop, and access control hooks into separate patches.
+ Further split audit system patch into two separate patches; one forinclude/uapi, and the usage of the new defines.
+ Split out the permissive functionality into another separate patch, for easier review.
+ Correct misuse ofaudit_log_n_untrustedstring toaudit_log_format
+ Useget_task_comminstead of comm directly.
+ Quote certain audit values
+ Remove unnecessary help text on choice options - these were previously idented at the wrong level
+ Correct a stale string constant (ctx_ns_enforcetoctx_enforce)v8:
+ Change dependency for
CONFIG_AUDITtoCONFIG_AUDITSYSCALL
+ Drop ctx_* prefix
+ Reuse, where appropriate, the audit fields from the fielddictionary. This transforms: ctx_pathname -> path ctx_ino -> ino ctx_dev -> dev+ Add audit records and event examples to commit description.
+ Removenew_audit_ctx, replace withaudit_log_start. All data that would provided bynew_audit_ctxis already present in the syscall audit record, that is always emitted on these actions. The audit records should be correlated as such.
+ Change audit types:
+AUDIT_TRUST_RESULT->AUDIT_IPE_ACCESS
+ This prevents overloading of the AVC type.
+AUDIT_TRUST_POLICY_ACTIVATE->AUDIT_MAC_CONFIG_CHANGE
+AUDIT_TRUST_POLICY_LOAD->AUDIT_MAC_POLICY_LOAD
+ There were no significant difference in meaning between these types.+ Remove enforcing parameter passed from the context structure for
AUDIT_IPE_ACCESS.
+ This field can be inferred from the SYSCALL audit event, based on the success field.+ Remove all fields already captured in the syscall record. "hook", an IPE specific field, can be determined via the syscall field in the syscall record itself, so it has been removed.
+ ino, path, and dev in IPE's record refer to the subject of the syscall, while the syscall record refers to the calling process.+ remove IPE prefix from policy load/policy activation events
+ fix a bug wherein a policy change audit record was not fired when updating a policy--- security/ipe/Kconfig | 55 +++++++++ security/ipe/Makefile | 2 + security/ipe/audit.c | 184 ++++++++++++++++++++++++++++++ security/ipe/audit.h | 34 ++++++ security/ipe/ctx.c | 21 ++++ security/ipe/ctx.h | 2 + security/ipe/eval.c | 9 ++ security/ipe/eval.h | 7 ++ security/ipe/fs.c | 79 +++++++++++++ security/ipe/modules/ipe_module.h | 2 + 10 files changed, 395 insertions(+) create mode 100644 security/ipe/audit.c create mode 100644 security/ipe/audit.hsecurity/ipe/Kconfig +6
-0@@ -15,3 +15,58 @@ menuconfig SECURITY_IPE admins to reconfigure trust requirements on the fly. If unsure, answer N. + +if SECURITY_IPE + +config IPE_AUDIT + bool "Enable IPE's audit events" + depends on AUDIT && AUDITSYSCALL
security/ipe/Kconfig menuconfig SECURITY_IPE · line 33
Quoted 10 lines
security/ipe/Kconfig +10
-0+ help + This option causes IPE to emit audit records on certain key + events during IPE's normal operation. Examples include: + when an action is denied by IPE policy, when a new policy is + loaded, and when a new policy is active. This allows system + admins to analyze what is happening on their systems, and + validate through audit records that IPE is responsible for + certain behaviors. + + if unsure, answer Y.
Do you ever envision someone using IPE without auditing built into the kernel?
Quoted 38 lines
security/ipe/Kconfig +38
-0+choice + prompt "Hash algorithm used in auditing policies" + default IPE_AUDIT_HASH_SHA1 + depends on IPE_AUDIT + help + Specify the hash algorithm used when auditing policies. + The hash is used to uniquely identify a policy from other + policies on the system. + + If unsure, leave default. + + config IPE_AUDIT_HASH_SHA1 + bool "sha1" + select CRYPTO_SHA1 + + config IPE_AUDIT_HASH_SHA256 + bool "sha256" + select CRYPTO_SHA256 + + config IPE_AUDIT_HASH_SHA384 + bool "sha384" + select CRYPTO_SHA512 + + config IPE_AUDIT_HASH_SHA512 + bool "sha512" + select CRYPTO_SHA512 + +endchoice + +config IPE_AUDIT_HASH_ALG + string + depends on IPE_AUDIT + default "sha1" if IPE_AUDIT_HASH_SHA1 + default "sha256" if IPE_AUDIT_HASH_SHA256 + default "sha384" if IPE_AUDIT_HASH_SHA384 + default "sha512" if IPE_AUDIT_HASH_SHA512 + +endif
...
Quoted 44 lines
security/ipe/audit.c new file +38
-0@@ -0,0 +1,184 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) Microsoft Corporation. All rights reserved. +*/ + +#include "ipe.h" +#include "eval.h" +#include "hooks.h" +#include "policy.h" +#include "audit.h" +#include "modules/ipe_module.h" + +#include <linux/slab.h> +#include <linux/audit.h> +#include <linux/types.h> +#include <crypto/hash.h> + +#define ACTSTR (x) ((x) == ipe_action_allow ? "ALLOW" : "DENY") + +#define POLICY_LOAD_FMT "policy_name=\"%s\" policy_version=%hu.%hu.%hu "\ + CONFIG_IPE_AUDIT_HASH_ALG "=" + +static const char *const audit_op_names[ipe_operation_max] = { +"EXECUTE" , +"FIRMWARE" , +"KMODULE" , +"KEXEC_IMAGE" , +"KEXEC_INITRAMFS" , +"IMA_POLICY" , +"IMA_X509_CERT" , +}; + +/** +* audit_rule: audit an IPE policy rule approximation. +* @ab: Supplies a poniter to the audit_buffer to append to. +* @r: Supplies a pointer to the ipe_rule to approximate a string form for. +* +* This is an approximation because aliases like "KERNEL_READ" will be
security/ipe/audit.c line 48
Quoted 10 lines
security/ipe/audit.c new file +10
-0+* emitted in their expanded form. +*/ +static void audit_rule (struct audit_buffer *ab,const struct ipe_rule *r) +{ +const struct ipe_policy_mod *ptr; + +audit_log_format (ab,"rule=\"op=%s " , audit_op_names[r->op]); + +list_for_each_entry (ptr, &r->modules, next) { +audit_log_format (ab,"%s=" , ptr->mod->name);
The module names must always be alphanumeric, yes?
security/ipe/audit.c line 50
Quoted 1 line
security/ipe/audit.c new file +1
-0+ ptr->mod->audit (ab, ptr->mod_value);
Regardless of the module names, I suspect the module specific audit value is going to push this to being an untrusted string ... which is a bit interesting as I think the only way to do that would be to build up the rule string first and do something like this:
audit_log_format(ab, "rule="); audit_log_untrustedstring(ab, rule_string);
Quoted 35 lines
security/ipe/audit.c new file +35
-0+audit_log_format (ab," " ); + } + +audit_log_format (ab,"action=%s\"" ,ACTSTR (r->action)); +} + +/** +* ipe_audit_match: audit a match for IPE policy. +* @ctx: Supplies a poniter to the evaluation context that was used in the +* evaluation. +* @match_type: Supplies the scope of the match: rule, operation default, +* global default. +* @act: Supplies the IPE's evaluation decision, deny or allow. +* @r: Supplies a pointer to the rule that was matched, if possible. +* @enforce: Supplies the enforcement/permissive state at the point +* the enforcement decision was made. +*/ +void ipe_audit_match (const struct ipe_eval_ctx *const ctx, +enum ipe_match match_type, +enum ipe_action act,const struct ipe_rule *const r) +{ +bool success_audit; +struct inode *inode; +struct audit_buffer *ab; +const char *op = audit_op_names[ctx->op]; + +rcu_read_lock (); + success_audit =READ_ONCE (ctx->ci_ctx->success_audit); +rcu_read_unlock (); + +if (act != ipe_action_deny && !success_audit) +return ; + + ab =audit_log_start (audit_context (),GFP_KERNEL ,AUDIT_IPE_ACCESS ); +if (!ab)
security/ipe/audit.c line 96
Quoted 10 lines
security/ipe/audit.c new file +10
-0+return ; + +if (ctx->file) { +audit_log_d_path (ab,"path=" , &ctx->file->f_path); + inode =file_inode (ctx->file); +if (inode) { +audit_log_format (ab," dev=" ); +audit_log_untrustedstring (ab, inode->i_sb->s_id); +audit_log_format (ab," ino=%lu " , inode->i_ino); + }
I noticed in the execve/mprotect example above that your "path" (and presumably the "dev"/"inode" too) field doesn't match the "comm" field in the syscall record. Granted, the "comm" field can be manipulated, but I'm guessing that isn't the case here and instead you just wrote a script that calls a "/root/host/mprotect" helper, is that correct?
If yes, the IPE "path" field seems a little misleading, is that intentional? What happens in the case of a proper application binary?
Perhaps we need to use a different field name than "path"?
Quoted 6 lines
security/ipe/audit.c new file +6
-0+ } + +if (match_type == ipe_match_rule) +audit_rule (ab, r); +else if (match_type == ipe_match_table) + audit_log_format(ab, "rule=\"DEFAULT op=%s action=%s\"", op,
security/ipe/audit.c line 112
Quoted 10 lines
security/ipe/audit.c new file +10
-0+ ACTSTR(act)); + else + audit_log_format(ab, "rule=\"DEFAULT action=%s\"", + ACTSTR(act)); + +audit_log_end (ab); +} + +/** +* audit_policy: Audit a policy's name, version and thumprint to @ab
Thum*b*print :)
Quoted 28 lines
security/ipe/audit.c new file +28
-0+* @ab: Supplies a pointer to the audit buffer to append to. +* @p: Supplies a pointer to the policy to audit +*/ +static void audit_policy (struct audit_buffer *ab, +const struct ipe_policy *const p) +{ +u8 *digest =NULL ; +struct crypto_shash *tfm; +SHASH_DESC_ON_STACK (desc, tfm); + + tfm =crypto_alloc_shash (CONFIG_IPE_AUDIT_HASH_ALG ,0 ,0 ); +if (IS_ERR (tfm)) +return ; + + desc->tfm = tfm; + + digest =kzalloc (crypto_shash_digestsize (tfm),GFP_KERNEL ); +if (!digest) + goto out; + +if (crypto_shash_init (desc)) + goto out; + +if (crypto_shash_update (desc, p->pkcs7, p->pkcs7len)) + goto out; + +if (crypto_shash_final (desc, digest)) + goto out;
security/ipe/audit.c line 150
Quoted 10 lines
security/ipe/audit.c new file +10
-0+ +audit_log_format (ab,POLICY_LOAD_FMT , p->parsed->name, + p->parsed->version.major, p->parsed->version.minor, + p->parsed->version.rev); +audit_log_n_hex (ab, digest,crypto_shash_digestsize (tfm)); + +out: +kfree (digest); +crypto_free_shash (tfm); +}
--
paul-moore.com
Re: [RFC PATCH v8 07/17] ipe: add auditing support
In reply to Deven BowersQuoted 15 lines · Deven Bowers
security/ipe/fs.c +15
-0+/** +* getaudit: Read handler for the securityfs node, "ipe/success_audit" +* @f: Supplies a file structure representing the securityfs node. +* @data: Supplies a buffer passed to the read syscall +* @len: Supplies the length of @data +* @offset: unused. +* +* Return: +* >0 - Success, Length of buffer written +* <0 - Error +*/ +static ssize_t getaudit (struct file *f,char __user *data, +size_t len,loff_t *offset) +{ +const char *result;
security/ipe/fs.c line 78
Quoted 10 lines
security/ipe/fs.c +10
-0+struct ipe_context *ctx; + + ctx =ipe_current_ctx (); + +rcu_read_lock (); + result = ((READ_ONCE (ctx->success_audit)) ?"1" :"0" ); +rcu_read_unlock (); + +ipe_put_ctx (ctx); +return simple_read_from_buffer (data, len, offset, result,2 );
While doing some internal testing, I noticed that some of the IPE files in securityfs (ipe/audit, ipe/enforce, and ipe/policies/*/active) are including the NULL terminator (size of 2) in the securityfs file contents. This is not common to do and this busybox build that my test machine is using even has some trouble when displaying those files with cat. I see all three instances of this pattern with this command:
$ git grep simple_read_from_buffer\(.*,\ 2\) security/ipe
I think going to a length of 1 would be best.
Tyler
RFC PATCH v8 8/17 ipe: add permissive toggle
In reply to Deven BowersIPE, like SELinux, supports a permissive mode. This mode allows policy authors to test and evaluate IPE policy without it effecting their programs. When the mode is changed, a 1423 AUDIT_TRUST_STATUS will be reported.
---
This patch adds the following audit records:
type=1404 audit(1653425689.008:55): permissive=1 type=1404 audit(1653425689.008:55): permissive=0
These records are emitted within the following events:
type=1404 audit(1653425689.008:55): permissive=1 type=1300 audit(1653425689.008:55): arch=c000003e syscall=1
success=yes exit=2 a0=1 a1=55c1065e5c60 a2=2 a3=0 items=0 ppid=405
pid=441 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=)type=1327 audit(1653425689.008:55): proctitle="-bash"
---
v2:
+ Split evaluation loop, access control hooks, and evaluation loop from policy parser and userspace interface to pass mailing list character limit
v3:
+ Move ipe_load_properties to patch 04.
+ Remove useless 0-initializations
+ Prefix extern variables with ipe_
+ Remove kernel module parameters, as these are exposed through sysctls.
+ Add more prose to the IPE base config option help text.
+ Use GFP_KERNEL for audit_log_start.
+ Remove unnecessary caching system.
+ Remove comments from headers
+ Use rcu_access_pointer for rcu-pointer null check
+ Remove usage of reqprot; use prot only.
+ Move policy load and activation audit event to 03/12
v4:
+ Remove sysctls in favor of securityfs nodes
+ Re-add kernel module parameters, as these are now exposed through securityfs.
+ Refactor property audit loop to a separate function.
v5:
+ fix minor grammatical errors
+ do not group rule by curly-brace in audit record, reconstruct the exact rule.
v6:
+ No changes
v7:
+ Further split lsm creation into a separate commit from the evaluation loop and audit system, for easier review.
+ Propogating changes to support the new ipe_context structure in the evaluation loop.
+ Split out permissive functionality into a separate patch for easier review.
+ Remove permissive switch compile-time configuration option - this is trivial to add later.
v8:
+ Remove "IPE" prefix from permissive audit record
+ align fields to the linux-audit field dictionary. This causes the following fields to change:
enforce -> permissive
+ Remove duplicated information correlated with syscall record, that will always be present in the audit event.
+ Change audit types:
+ AUDIT_TRUST_STATUS -> AUDIT_MAC_STATUS
+ There is no significant difference in meaning between these types.
--- security/ipe/audit.c | 43 ++++++++++++++++++++++++ security/ipe/audit.h | 5 +++ security/ipe/ctx.c | 6 ++++ security/ipe/ctx.h | 1 + security/ipe/eval.c | 6 ++++ security/ipe/fs.c | 78 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 139 insertions(+)
security/ipe/audit.c +43 -0
@@ -182,3 +182,46 @@ void ipe_audit_policy_load(const struct ipe_policy *const p)audit_log_end (ab); } + +/** +* ipe_audit_enforce: Audit a change in IPE's enforcement state +* @ctx: Supplies a pointer to the contexts whose state changed. +*/ +void ipe_audit_enforce (const struct ipe_context *const ctx) +{ +struct audit_buffer *ab; +bool enforcing = false; + + ab =audit_log_start (audit_context (),GFP_KERNEL ,AUDIT_MAC_STATUS ); +if (!ab) +return ; + +rcu_read_lock (); + enforcing =READ_ONCE (ctx->enforce); +rcu_read_unlock (); + +audit_log_format (ab,"permissive=%d" , !enforcing); + +audit_log_end (ab); +} + +/** +* emit_enforcement: Emit the enforcement state of IPE started with. +* +* Return: +* 0 - Always +*/ +static int emit_enforcement (void ) +{ +struct ipe_context *ctx =NULL ; + +if (!ipe_enabled) +return -EOPNOTSUPP ; + + ctx =ipe_current_ctx (); +ipe_audit_enforce (ctx); +ipe_put_ctx (ctx); +return 0 ; +} + +late_initcall (emit_enforcement);
security/ipe/audit.h +5 -0
@@ -15,6 +15,7 @@ void ipe_audit_match(const struct ipe_eval_ctx *const ctx, enum ipe_action act, const struct ipe_rule *const r);void ipe_audit_policy_load (const struct ipe_policy *const p);void ipe_audit_policy_activation (const struct ipe_policy *const p); +void ipe_audit_enforce (const struct ipe_context *const ctx);#else static inline void ipe_audit_match(const struct ipe_eval_ctx *const ctx, enum ipe_match match_type,
@@ -29,6 +30,10 @@ static inline void ipe_audit_policy_load(const struct ipe_policy *const p)static inline void ipe_audit_policy_activation (const struct ipe_policy *const p) { } + +static inline void ipe_audit_enforce (const struct ipe_context *const ctx) +{ +}#endif /* CONFIG_IPE_AUDIT */ #endif /* IPE_AUDIT_H */
security/ipe/ctx.c +6 -0
@@ -16,6 +16,7 @@#include <linux/moduleparam.h> static bool success_audit; +static bool enforce = true;/** * ver_to_u64: convert an internal ipe_policy_version to a u64
@@ -135,6 +136,7 @@ static struct ipe_context *create_ctx(void)INIT_LIST_HEAD (&ctx->policies);refcount_set (&ctx->refcount,1 );spin_lock_init (&ctx->lock); +WRITE_ONCE (ctx->enforce, true);return ctx;
@@ -324,6 +326,7 @@ int __init ipe_init_ctx(void)spin_lock (&lns->lock);WRITE_ONCE (lns->success_audit, success_audit); +WRITE_ONCE (lns->enforce, enforce);spin_unlock (&lns->lock);rcu_assign_pointer (*ipe_tsk_ctx (current), lns);
@@ -342,3 +345,6 @@ int __init ipe_init_ctx(void)module_param (success_audit, bool,0400 );MODULE_PARM_DESC (success_audit,"Start IPE with success auditing enabled" ); + +module_param (enforce, bool,0400 ); +MODULE_PARM_DESC (enforce,"Start IPE in enforce or permissive mode" );
security/ipe/ctx.h +1 -0
@@ -14,6 +14,7 @@struct ipe_context {struct ipe_policy __rcu *active_policy; +bool __rcu enforce;bool __rcu success_audit;
security/ipe/eval.c +6 -0
@@ -84,6 +84,10 @@ static int evaluate(const struct ipe_eval_ctx *const ctx)if (!pol) goto out; +rcu_read_lock (); + enforcing =READ_ONCE (ctx->ci_ctx->enforce); +rcu_read_unlock (); +if (ctx->op == ipe_operation_max) { action = pol->parsed->global_default; match_type = ipe_match_global;
@@ -119,6 +123,8 @@ static int evaluate(const struct ipe_eval_ctx *const ctx)if (action == ipe_action_deny) rc = -EACCES ; +if (!enforcing) + rc =0 ; out:ipe_put_policy (pol);return rc;
security/ipe/fs.c +78 -0
104 lines not on this page · raw message
Signature · 1 line
2.25.1
RFC PATCH v8 9/17 ipe: introduce 'boot_verified' as a trust provider
In reply to Deven BowersIPE is designed to provide system level trust guarantees, this usually implies that trust starts from bootup with a hardware root of trust, which validates the bootloader. After this, the bootloader verifies the kernel and the initramfs.
As there's no currently supported integrity method for initramfs, and it's typically already verified by the bootloader, introduce a property that causes the first superblock to have an execution to be "pinned", which is typically initramfs.
---
v2:
+ No Changes
v3:
+ Remove useless caching system
+ Move ipe_load_properties to this match
+ Minor changes from checkpatch --strict warnings
v4:
+ Remove comments from headers that was missed previously.
+ Grammatical corrections.
v5:
+ No significant changes
v6:
+ No changes
v7:
+ Reword and refactor patch 04/12 to [09/16],
based on changes in the underlying system.
+ Add common audit function for boolean values
+ Use common audit function as implementation.
v8:
+ No changes
--- security/ipe/Kconfig | 2 + security/ipe/Makefile | 1 + security/ipe/eval.c | 71 ++++++++++++++++++++++++++++ security/ipe/eval.h | 5 ++ security/ipe/hooks.c | 14 ++++++ security/ipe/hooks.h | 2 + security/ipe/ipe.c | 1 + security/ipe/modules.c | 30 ++++++++++++ security/ipe/modules/Kconfig | 20 ++++++++ security/ipe/modules/Makefile | 8 ++++ security/ipe/modules/boot_verified.c | 26 ++++++++++ security/ipe/modules/ipe_module.h | 3 ++ 12 files changed, 183 insertions(+) create mode 100644 security/ipe/modules/Kconfig create mode 100644 security/ipe/modules/Makefile create mode 100644 security/ipe/modules/boot_verified.c
security/ipe/Kconfig +2 -0
@@ -69,4 +69,6 @@ config IPE_AUDIT_HASH_ALG default "sha384" if IPE_AUDIT_HASH_SHA384 default "sha512" if IPE_AUDIT_HASH_SHA512 +source "security/ipe/modules/Kconfig" + endif
security/ipe/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_SECURITY_IPE) += \ fs.o \ hooks.o \ ipe.o \ + modules/ \ modules.o \ parsers/ \ parsers.o \
security/ipe/eval.c +71 -0
96 lines not on this page · raw message
security/ipe/eval.h +5 -0
@@ -7,6 +7,7 @@#define IPE_EVAL_H #include <linux/file.h> +#include <linux/types.h> #include "ctx.h" #include "hooks.h"
@@ -17,6 +18,8 @@ struct ipe_eval_ctx {const struct file *file;struct ipe_context *ci_ctx; + +bool from_init_sb; };enum ipe_match {
@@ -28,4 +31,6 @@ enum ipe_match {int ipe_process_event (const struct file *file,enum ipe_operation op); +void ipe_invalidate_pinned_sb (const struct super_block *mnt_sb); +#endif /* IPE_EVAL_H */
security/ipe/hooks.c +14 -0
@@ -202,3 +202,17 @@ int ipe_kernel_load_data(enum kernel_load_data_id id, bool contents)WARN (op == ipe_operation_max,"no rule setup for enum %d" , id);return ipe_process_event (NULL , op); } + +/** +* ipe_bdev_free_security: free nested structures within IPE's LSM blob +* in super_blocks +* @mnt_sb: Supplies a pointer to a super_block that contains the structure +* to free. +* +* IPE does not have any structures with mnt_sb, but uses this hook to +* invalidate a pinned super_block. +*/ +void ipe_sb_free_security (struct super_block *mnt_sb) +{ +ipe_invalidate_pinned_sb (mnt_sb); +}
security/ipe/hooks.h +2 -0
@@ -29,4 +29,6 @@ int ipe_kernel_read_file(struct file *file, enum kernel_read_file_id id,int ipe_kernel_load_data (enum kernel_load_data_id id,bool contents); +void ipe_sb_free_security (struct super_block *mnt_sb); +#endif /* IPE_HOOKS_H */
security/ipe/ipe.c +1 -0
@@ -32,6 +32,7 @@ static struct security_hook_list ipe_hooks[] __lsm_ro_after_init = {LSM_HOOK_INIT (file_mprotect, ipe_file_mprotect),LSM_HOOK_INIT (kernel_read_file, ipe_kernel_read_file),LSM_HOOK_INIT (kernel_load_data, ipe_kernel_load_data), + LSM_HOOK_INIT(sb_free_security, ipe_sb_free_security), };/**
security/ipe/modules.c +30 -0
@@ -107,3 +107,33 @@ int ipe_register_module(struct ipe_module *m)return 0 ; } + +/** +* ipe_bool_parse: parse a boolean in IPE's policy and associate +* it as @value in IPE's policy. +* @valstr: Supplies the string parsed from the policy +* @value: Supplies a pointer to be populated with the result. +* +* Modules can use this function for simple true/false values +* instead of defining their own. +* +* Return: +* 0 - OK +* !0 - Error +*/ +int ipe_bool_parse (const char *valstr,void **value) +{ +if (!strcmp (valstr,"TRUE" )) + *value = (void *)true; +else if (!strcmp (valstr,"FALSE" )) + *value = (void *)false; +else +return -EBADMSG ; + +return 0 ; +} + +void ipe_bool_audit (struct audit_buffer *ab,const void *val) +{ +audit_log_format (ab,"%s" , ((bool )val) ?"TRUE" :"FALSE" ); +}
security/ipe/modules/Kconfig new file +20 -0
@@ -0,0 +1,20 @@ + +menu "IPE Trust Providers" + +config IPE_PROP_BOOT_VERIFIED + bool "Enable trust for initramfs" + depends on SECURITY_IPE + default N + help + This option enables the property 'boot_verified' in IPE policy. + This property 'pins' the initial superblock when something + is evaluated as an execution. This property will evaluate + to true when the file being evaluated originates from this + superblock. + + This property is useful to authorize a signed initramfs. + + If unsure, answer N. + + +endmenu
security/ipe/modules/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# +# Makefile for building the IPE module as part of the kernel tree. +# + +obj-$(CONFIG_IPE_PROP_BOOT_VERIFIED) += boot_verified.o
security/ipe/modules/boot_verified.c new file +26 -0
@@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) Microsoft Corporation. All rights reserved. +*/ + +#include "ipe_module.h" + +#include <linux/fs.h> +#include <linux/types.h> +#include <linux/audit.h> + +static bool bv_eval (const struct ipe_eval_ctx *ctx,const void *val) +{ +bool expect = (bool )val; + +return expect == ctx->from_init_sb; +} + +IPE_MODULE (bv) = { + .name ="boot_verified" , + .version =1 , + .parse = ipe_bool_parse, + .free =NULL , + .eval = bv_eval, + .audit = ipe_bool_audit, +};
security/ipe/modules/ipe_module.h +3 -0
@@ -9,6 +9,9 @@#include <linux/audit.h> #include "../eval.h" +int ipe_bool_parse (const char *valstr,void **value); +void ipe_bool_audit (struct audit_buffer *ab,const void *val); +/** * ipe_module: definition of an extensible module for IPE properties. * These structures are used to implement 'key=value' pairs
Signature · 1 line
2.25.1
RFC PATCH v8 10/17 block|security: add LSM blob to block_device
In reply to Deven Bowersblock_device structures can have valuable security properties, based on how they are created, and what subsystem manages them.
By adding LSM storage to this structure, this data can be accessed at the LSM layer.
---
v2:
+ No Changes
v3:
+ Minor style changes from checkpatch --strict
v4:
+ No Changes
v5:
+ Allow multiple callers to call security_bdev_setsecurity
v6:
+ Simplify security_bdev_setsecurity break condition
v7:
+ Squash all dm-verity related patches to two patches, the additions to dm-verity/fs, and the consumption of the additions.
v8:
+ Split dm-verity related patches squashed in v7 to 3 commits based on topic:
+ New LSM hook
+ Consumption of hook outside LSM
+ Consumption of hook inside LSM.
+ change return of security_bdev_alloc / security_bdev_setsecurity to LSM_RET_DEFAULT instead of 0.
+ Change return code to -EOPNOTSUPP, bring inline with other setsecurity hooks.
--- block/bdev.c | 7 ++++ include/linux/blk_types.h | 1 + include/linux/lsm_hook_defs.h | 5 +++ include/linux/lsm_hooks.h | 12 ++++++ include/linux/security.h | 22 +++++++++++ security/security.c | 70 +++++++++++++++++++++++++++++++++++ 6 files changed, 117 insertions(+)
block/bdev.c +7 -0
@@ -24,6 +24,7 @@#include <linux/pseudo_fs.h> #include <linux/uio.h> #include <linux/namei.h> +#include <linux/security.h> #include <linux/part_stat.h> #include <linux/uaccess.h> #include "../fs/internal.h"
@@ -397,6 +398,11 @@ static struct inode *bdev_alloc_inode(struct super_block *sb)if (!ei)return NULL ;memset (&ei->bdev,0 ,sizeof (ei->bdev)); + +if (unlikely (security_bdev_alloc (&ei->bdev))) { +kmem_cache_free (bdev_cachep, ei); +return NULL ; + }return &ei->vfs_inode; }
@@ -406,6 +412,7 @@ static void bdev_free_inode(struct inode *inode)free_percpu (bdev->bd_stats);kfree (bdev->bd_meta_info); +security_bdev_free (bdev);if (!bdev_is_partition (bdev)) {if (bdev->bd_disk && bdev->bd_disk->bdi)
include/linux/blk_types.h +1 -0
@@ -68,6 +68,7 @@ struct block_device {#ifdef CONFIG_FAIL_MAKE_REQUEST bool bd_make_it_fail;#endif +void *security; } __randomize_layout;#define bdev_whole (_bdev) \
include/linux/lsm_hook_defs.h +5 -0
@@ -407,3 +407,8 @@ LSM_HOOK(int, 0, perf_event_write, struct perf_event *event) LSM_HOOK(int, 0, uring_override_creds, const struct cred *new) LSM_HOOK(int, 0, uring_sqpoll, void)#endif /* CONFIG_IO_URING */ + +LSM_HOOK(int, 0, bdev_alloc_security, struct block_device *bdev) +LSM_HOOK(void, LSM_RET_VOID, bdev_free_security, struct block_device *bdev) +LSM_HOOK(int, 0, bdev_setsecurity, struct block_device *bdev, const char *name, + const void *value, size_t size)
include/linux/lsm_hooks.h +12 -0
@@ -1550,6 +1550,17 @@* * @what: kernel feature being accessed * +* @bdev_alloc_security: +* Initialize the security field inside a block_device structure. +* +* @bdev_free_security: +* Cleanup the security information stored inside a block_device structure. +* +* @bdev_setsecurity: +* Set a security property associated with @name for @bdev with +* value @value. @size indicates the size of @value in bytes. +* If a @name is not implemented, return -EOPNOTSUPP. +* * Security hooks for perf events * * @perf_event_open:
@@ -1610,6 +1621,7 @@ struct lsm_blob_sizes {int lbs_ipc;int lbs_msg_msg;int lbs_task; +int lbs_bdev; };/*
include/linux/security.h +22 -0
@@ -473,6 +473,11 @@ int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen);int security_inode_setsecctx (struct dentry *dentry,void *ctx,u32 ctxlen);int security_inode_getsecctx (struct inode *inode,void **ctx,u32 *ctxlen);int security_locked_down (enum lockdown_reason what); +int security_bdev_alloc (struct block_device *bdev); +void security_bdev_free (struct block_device *bdev); +int security_bdev_setsecurity (struct block_device *bdev, +const char *name,const void *value, +size_t size);#else /* CONFIG_SECURITY */ static inline int call_blocking_lsm_notifier (enum lsm_event event,void *data)
@@ -1349,6 +1354,23 @@ static inline int security_locked_down(enum lockdown_reason what) {return 0 ; } + +static inline int security_bdev_alloc (struct block_device *bdev) +{ +return 0 ; +} + +static inline void security_bdev_free (struct block_device *bdev) +{ +} + +static inline int security_bdev_setsecurity (struct block_device *bdev, +const char *name, +const void *value,size_t size) +{ +return 0 ; +} +#endif /* CONFIG_SECURITY */ #if defined(CONFIG_SECURITY ) && defined(CONFIG_WATCH_QUEUE )
security/security.c +70 -0
100 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [RFC PATCH v8 10/17] block|security: add LSM blob to block_device
Quoted 7 lines · Deven Bowers
block_devicestructures can have valuable security properties, based on how they are created, and what subsystem manages them.By adding LSM storage to this structure, this data can be accessed at the LSM layer.
Signed-off-by Deven Bowers <[email protected]>
Not everyone is going to appreciate the infrastructure allocation of the block_device security blob, but I do.
Quoted 279 lines
---
v2:
+ No Changesv3:
+ Minor style changes from checkpatch --strictv4:
+ No Changesv5:
+ Allow multiple callers to callsecurity_bdev_setsecurityv6:
+ Simplifysecurity_bdev_setsecuritybreak conditionv7:
+ Squash all dm-verity related patches to two patches, the additions to dm-verity/fs, and the consumption of the additions.v8:
+ Split dm-verity related patches squashed in v7 to 3 commits based on topic:
+ New LSM hook
+ Consumption of hook outside LSM
+ Consumption of hook inside LSM.+ change return of
security_bdev_alloc/security_bdev_setsecuritytoLSM_RET_DEFAULTinstead of 0.+ Change return code to
-EOPNOTSUPP, bring inline with other setsecurity hooks.--- block/bdev.c | 7 ++++ include/linux/blk_types.h | 1 + include/linux/lsm_hook_defs.h | 5 +++ include/linux/lsm_hooks.h | 12 ++++++ include/linux/security.h | 22 +++++++++++ security/security.c | 70 +++++++++++++++++++++++++++++++++++ 6 files changed, 117 insertions(+)block/bdev.c +7
-0@@ -24,6 +24,7 @@#include <linux/pseudo_fs.h> #include <linux/uio.h> #include <linux/namei.h> +#include <linux/security.h> #include <linux/part_stat.h> #include <linux/uaccess.h> #include "../fs/internal.h" @@ -397,6 +398,11 @@ static struct inode *bdev_alloc_inode(struct super_block *sb)if (!ei)return NULL ;memset (&ei->bdev,0 ,sizeof (ei->bdev)); + +if (unlikely (security_bdev_alloc (&ei->bdev))) { +kmem_cache_free (bdev_cachep, ei); +return NULL ; + }return &ei->vfs_inode; }@@ -406,6 +412,7 @@ static void bdev_free_inode(struct inode *inode)free_percpu (bdev->bd_stats);kfree (bdev->bd_meta_info); +security_bdev_free (bdev);if (!bdev_is_partition (bdev)) {if (bdev->bd_disk && bdev->bd_disk->bdi)include/linux/blk_types.h +1
-0@@ -68,6 +68,7 @@ struct block_device {#ifdef CONFIG_FAIL_MAKE_REQUEST bool bd_make_it_fail;#endif +void *security; } __randomize_layout;#define bdev_whole (_bdev) \include/linux/lsm_hook_defs.h +5
-0@@ -407,3 +407,8 @@ LSM_HOOK(int, 0, perf_event_write, struct perf_event *event) LSM_HOOK(int, 0, uring_override_creds, const struct cred *new) LSM_HOOK(int, 0, uring_sqpoll, void)#endif /* CONFIG_IO_URING */ + +LSM_HOOK(int, 0, bdev_alloc_security, struct block_device *bdev) +LSM_HOOK(void, LSM_RET_VOID, bdev_free_security, struct block_device *bdev) +LSM_HOOK(int, 0, bdev_setsecurity, struct block_device *bdev, const char *name, + const void *value, size_t size)include/linux/lsm_hooks.h +12
-0@@ -1550,6 +1550,17 @@* * @what: kernel feature being accessed * +* @bdev_alloc_security: +* Initialize the security field inside a block_device structure. +* +* @bdev_free_security: +* Cleanup the security information stored inside a block_device structure. +* +* @bdev_setsecurity: +* Set a security property associated with @name for @bdev with +* value @value. @size indicates the size of @value in bytes. +* If a @name is not implemented, return -EOPNOTSUPP. +* * Security hooks for perf events * * @perf_event_open: @@ -1610,6 +1621,7 @@ struct lsm_blob_sizes {int lbs_ipc;int lbs_msg_msg;int lbs_task; +int lbs_bdev; };/* include/linux/security.h +22
-0@@ -473,6 +473,11 @@ int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen);int security_inode_setsecctx (struct dentry *dentry,void *ctx,u32 ctxlen);int security_inode_getsecctx (struct inode *inode,void **ctx,u32 *ctxlen);int security_locked_down (enum lockdown_reason what); +int security_bdev_alloc (struct block_device *bdev); +void security_bdev_free (struct block_device *bdev); +int security_bdev_setsecurity (struct block_device *bdev, +const char *name,const void *value, +size_t size);#else /* CONFIG_SECURITY */ static inline int call_blocking_lsm_notifier (enum lsm_event event,void *data)@@ -1349,6 +1354,23 @@ static inline int security_locked_down(enum lockdown_reason what) {return 0 ; } + +static inline int security_bdev_alloc (struct block_device *bdev) +{ +return 0 ; +} + +static inline void security_bdev_free (struct block_device *bdev) +{ +} + +static inline int security_bdev_setsecurity (struct block_device *bdev, +const char *name, +const void *value,size_t size) +{ +return 0 ; +} +#endif /* CONFIG_SECURITY */ #if defined(CONFIG_SECURITY ) && defined(CONFIG_WATCH_QUEUE )security/security.c +70
-0@@ -29,6 +29,7 @@#include <linux/string.h> #include <linux/msg.h> #include <net/flow.h> +#include <linux/fs.h> #define MAX_LSM_EVM_XATTR 2@@ -208,6 +209,7 @@ static void __init lsm_set_blob_sizes(struct lsm_blob_sizes *needed)lsm_set_blob_size (&needed->lbs_msg_msg, &blob_sizes.lbs_msg_msg);lsm_set_blob_size (&needed->lbs_superblock, &blob_sizes.lbs_superblock);lsm_set_blob_size (&needed->lbs_task, &blob_sizes.lbs_task); +lsm_set_blob_size (&needed->lbs_bdev, &blob_sizes.lbs_bdev); }/* Prepare LSM for initialization. */ @@ -344,6 +346,7 @@ static void __init ordered_lsm_init(void)init_debug ("msg_msg blob size = %d\n" , blob_sizes.lbs_msg_msg);init_debug ("superblock blob size = %d\n" , blob_sizes.lbs_superblock);init_debug ("task blob size = %d\n" , blob_sizes.lbs_task); +init_debug ("bdev blob size = %d\n" , blob_sizes.lbs_bdev);/* * Create any kmem_caches needed for blobs @@ -660,6 +663,28 @@ static int lsm_msg_msg_alloc(struct msg_msg *mp)return 0 ; } +/** +* lsm_bdev_alloc - allocate a composite block_device blob +* @bdev: the block_device that needs a blob +* +* Allocate the block_device blob for all the modules +* +* Returns 0, or -ENOMEM if memory can't be allocated. +*/ +static int lsm_bdev_alloc (struct block_device *bdev) +{ +if (blob_sizes.lbs_bdev ==0 ) { + bdev->security =NULL ; +return 0 ; + } + + bdev->security =kzalloc (blob_sizes.lbs_bdev,GFP_KERNEL ); +if (!bdev->security) +return -ENOMEM ; + +return 0 ; +} +/** * lsm_early_task - during initialization allocate a composite task blob * @task: the task that needs a blob @@ -2617,6 +2642,51 @@ int security_locked_down(enum lockdown_reason what) }EXPORT_SYMBOL (security_locked_down); +int security_bdev_alloc (struct block_device *bdev) +{ +int rc =0 ; + + rc =lsm_bdev_alloc (bdev); +if (unlikely (rc)) +return rc; + + rc =call_int_hook (bdev_alloc_security,0 , bdev); +if (unlikely (rc)) +security_bdev_free (bdev); + +return LSM_RET_DEFAULT (bdev_alloc_security); +} +EXPORT_SYMBOL (security_bdev_alloc); + +void security_bdev_free (struct block_device *bdev) +{ +if (!bdev->security) +return ; + +call_void_hook (bdev_free_security, bdev); + +kfree (bdev->security); + bdev->security =NULL ; +} +EXPORT_SYMBOL (security_bdev_free); + +int security_bdev_setsecurity (struct block_device *bdev, +const char *name,const void *value, +size_t size) +{ +int rc =0 ; +struct security_hook_list *p; + +hlist_for_each_entry (p, &security_hook_heads.bdev_setsecurity, list) { + rc = p->hook.bdev_setsecurity (bdev, name, value, size); +if (rc && rc != -EOPNOTSUPP ) +return rc; + } + +return LSM_RET_DEFAULT (bdev_setsecurity); +} +EXPORT_SYMBOL (security_bdev_setsecurity); +#ifdef CONFIG_PERF_EVENTS int security_perf_event_open (struct perf_event_attr *attr,int type) {
Re: [RFC PATCH v8 10/17] block|security: add LSM blob to block_device
Quoted 7 lines · Casey Schaufler
Quoted 6 lines · Deven Bowers
block_devicestructures can have valuable security properties, based on how they are created, and what subsystem manages them.By adding LSM storage to this structure, this data can be accessed at the LSM layer.
Quoted 6 lines
Quoted 1 line
Signed-off-by Deven Bowers <[email protected]>Reviewed-by Casey Schaufler <[email protected]>Not everyone is going to appreciate the infrastructure allocation of the
block_devicesecurity blob, but I do.
Thanks Casey.
RFC PATCH v8 11/17 dm-verity: consume root hash digest and signature data via LSM hook
In reply to Deven Bowersdm-verity provides a strong guarantee of a block device's integrity. As a generic way to check the integrity of a block device, it provides those integrity guarantees to its lower layers, including the filesystem level.
An LSM that control access to a resource on the system based on the available integrity claims can use this transitive property of dm-verity, by querying the underlying block_device of a particular file.
The digest and signature information need to be stored in the block device to fulfill the next requirement of authorization via LSM policy. This will enable the LSM being able to perform revocation of devices that are still mounted, prohibiting execution of files that are no longer authorized by the LSM in question.
---
v2:
+ No Changes
v3:
+ No changes
v4:
+ No changes
v5:
+ No changes
v6:
+ Fix an improper cleanup that can result in
a leak
v7:
+ Squash patch 08/12, 10/12 to [11/16]
+ Use part0 for block_device, to retrieve the block_device, when calling security_bdev_setsecurity
v8:
+ Undo squash of 08/12, 10/12 - separating drivers/md/ from security/ & block/
+ Use common-audit function for dmverity_signature.
+ Change implementation for storing the dm-verity digest to use the newly introduced dm_verity_digest structure introduced in patch 14/20.
+ Create new structure, dm_verity_digest, containing digest algorithm, size, and digest itself to pass to the LSM layer. V7 was missing the algorithm.
+ Create an associated public header containing this new structure and the key values for the LSM hook, specific to dm-verity.
+ Additional information added to commit, discussing the layering of the changes and how the information passed will be used.
--- drivers/md/dm-verity-target.c | 25 +++++++++++++++++++++++-- drivers/md/dm-verity-verify-sig.c | 16 +++++++++++++--- drivers/md/dm-verity-verify-sig.h | 10 ++++++---- include/linux/dm-verity.h | 19 +++++++++++++++++++ 4 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 include/linux/dm-verity.h
drivers/md/dm-verity-target.c +23 -2
@@ -13,12 +13,16 @@* access behavior. */ +#include "dm-core.h" #include "dm-verity.h" #include "dm-verity-fec.h" #include "dm-verity-verify-sig.h" #include <linux/module.h> #include <linux/reboot.h> #include <linux/scatterlist.h> +#include <linux/security.h> +#include <linux/dm-verity.h> +#include <crypto/hash_info.h> #define DM_MSG_PREFIX "verity"
@@ -1060,6 +1064,8 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv)sector_t hash_position;char dummy;char *root_hash_digest_to_validate; +struct block_device *bdev; +struct dm_verity_digest root_digest; v =kzalloc (sizeof (struct dm_verity ),GFP_KERNEL );if (!v) {
@@ -1093,6 +1099,13 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv) } v->version = num; + bdev =dm_table_get_md (ti->table)->disk->part0; +if (!bdev) { + ti->error ="Mapped device lookup failed" ; + r = -ENOMEM ; + goto bad; + } + r =dm_get_device (ti, argv[1 ],FMODE_READ , &v->data_dev);if (r) { ti->error ="Data device lookup failed" ;
@@ -1225,7 +1238,7 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv) }/* Root hash signature is a optional parameter*/ - r =verity_verify_root_hash (root_hash_digest_to_validate, + r =verity_verify_root_hash (bdev, root_hash_digest_to_validate,strlen (root_hash_digest_to_validate), verify_args.sig, verify_args.sig_size);
@@ -1298,12 +1311,20 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv) ti->per_io_data_size =roundup (ti->per_io_data_size, __alignof__(struct dm_verity_io )); + root_digest.digest = v->root_digest; + root_digest.digest_len = v->digest_size; + root_digest.algo = v->alg_name; + + r =security_bdev_setsecurity (bdev,DM_VERITY_ROOTHASH_SEC_NAME , &root_digest, +sizeof (root_digest)); +if (r) + goto bad; +verity_verify_sig_opts_cleanup (&verify_args);return 0 ; bad: -verity_verify_sig_opts_cleanup (&verify_args);verity_dtr (ti);
drivers/md/dm-verity-verify-sig.c +13 -3
@@ -9,6 +9,9 @@#include <linux/verification.h> #include <keys/user-type.h> #include <linux/module.h> +#include <linux/security.h> +#include <linux/dm-verity.h> +#include "dm-core.h" #include "dm-verity.h" #include "dm-verity-verify-sig.h"
@@ -97,14 +100,17 @@ int verity_verify_sig_parse_opt_args(struct dm_arg_set *as,* verify_verify_roothash - Verify the root hash of the verity hash device * using builtin trusted keys. * +* @bdev: block_device representing the device-mapper created block device. +* Used by the security hook, to set information about the block_device. * @root_hash: For verity, the roothash/data to be verified. * @root_hash_len: Size of the roothash/data to be verified. * @sig_data: The trusted signature that verifies the roothash/data. * @sig_len: Size of the signature. * */ -int verity_verify_root_hash (const void *root_hash,size_t root_hash_len, -const void *sig_data,size_t sig_len) +int verity_verify_root_hash (struct block_device *bdev,const void *root_hash, +size_t root_hash_len,const void *sig_data, +size_t sig_len) {int ret;
@@ -126,8 +132,12 @@ int verity_verify_root_hash(const void *root_hash, size_t root_hash_len,NULL , #endif VERIFYING_UNSPECIFIED_SIGNATURE, NULL, NULL); +if (ret) +return ret; - return ret; +return security_bdev_setsecurity (bdev, +DM_VERITY_SIGNATURE_SEC_NAME , + sig_data, sig_len); }void verity_verify_sig_opts_cleanup (struct dm_verity_sig_opts *sig_opts)
drivers/md/dm-verity-verify-sig.h +6 -4
@@ -20,8 +20,9 @@ struct dm_verity_sig_opts {#define DM_VERITY_ROOT_HASH_VERIFICATION_OPTS 2 -int verity_verify_root_hash (const void *data,size_t data_len, -const void *sig_data,size_t sig_len); +int verity_verify_root_hash (struct block_device *bdev,const void *data, +size_t data_len,const void *sig_data, +size_t sig_len);bool verity_verify_is_sig_opt_arg (const char *arg_name); int verity_verify_sig_parse_opt_args(struct dm_arg_set *as, struct dm_verity *v,
@@ -34,8 +35,9 @@ void verity_verify_sig_opts_cleanup(struct dm_verity_sig_opts *sig_opts);#define DM_VERITY_ROOT_HASH_VERIFICATION_OPTS 0 -static inline int verity_verify_root_hash (const void *data,size_t data_len, -const void *sig_data,size_t sig_len) +int verity_verify_root_hash (struct block_device *bdev,const void *data, +size_t data_len,const void *sig_data, +size_t sig_len) {return 0 ; }
include/linux/dm-verity.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _LINUX_DM_VERITY_H +#define _LINUX_DM_VERITY_H + +#include <linux/types.h> +#include <crypto/hash_info.h> +#include <linux/device-mapper.h> + +struct dm_verity_digest { +const char *algo; +const u8 *digest; +size_t digest_len; +}; + +#define DM_VERITY_SIGNATURE_SEC_NAME DM_NAME ".verity-signature" +#define DM_VERITY_ROOTHASH_SEC_NAME DM_NAME ".verity-roothash" + +#endif /* _LINUX_DM_VERITY_H */
Signature · 1 line
2.25.1
RFC PATCH v8 12/17 ipe: add support for dm-verity as a trust provider
In reply to Deven BowersAllows author of IPE policy to indicate trust for a singular dm-verity volume, identified by roothash, through "dmverity_roothash" and all signed dm-verity volumes, through "dmverity_signature".
---
v2:
+ No Changes
v3:
+ No changes
v4:
+ No changes
v5:
+ No changes
v6:
+ Fix an improper cleanup that can result in
a leak
v7:
+ Squash patch 08/12, 10/12 to [11/16]
v8:
+ Undo squash of 08/12, 10/12 - separating drivers/md/ from security/ & block/
+ Use common-audit function for dmverity_signature.
+ Change implementation for storing the dm-verity digest to use the newly introduced dm_verity_digest structure introduced in patch 14/20.
--- security/ipe/eval.c | 5 + security/ipe/eval.h | 11 ++ security/ipe/hooks.c | 51 +++++++++ security/ipe/hooks.h | 6 + security/ipe/ipe.c | 9 ++ security/ipe/ipe.h | 3 + security/ipe/modules.c | 133 ++++++++++++++++++++++ security/ipe/modules/Kconfig | 23 ++++ security/ipe/modules/Makefile | 2 + security/ipe/modules/dmverity_roothash.c | 31 +++++ security/ipe/modules/dmverity_signature.c | 26 +++++ security/ipe/modules/ipe_module.h | 5 + 12 files changed, 305 insertions(+) create mode 100644 security/ipe/modules/dmverity_roothash.c create mode 100644 security/ipe/modules/dmverity_signature.c
security/ipe/eval.c +5 -0
@@ -23,6 +23,7 @@ static struct super_block *pinned_sb;static DEFINE_SPINLOCK (pin_lock);#define FILE_SUPERBLOCK (f) ((f)->f_path.mnt->mnt_sb) +#define FILE_BLOCK_DEV (f) (FILE_SUPERBLOCK(f)->s_bdev)/** * pin_sb: pin the underlying superblock of @f, marking it as trusted
@@ -93,6 +94,10 @@ static struct ipe_eval_ctx *build_ctx(const struct file *file, ctx->op = op; ctx->ci_ctx =ipe_current_ctx (); ctx->from_init_sb =from_pinned (file); +if (file) { +if (FILE_BLOCK_DEV (file)) + ctx->ipe_bdev =ipe_bdev (FILE_BLOCK_DEV (file)); + }return ctx; }
security/ipe/eval.h +11 -0
@@ -8,17 +8,28 @@#include <linux/file.h> #include <linux/types.h> +#include <crypto/hash_info.h> #include "ctx.h" #include "hooks.h" #include "policy.h" +struct ipe_bdev { +bool dm_verity_signed; + +const u8 *digest; +size_t digest_len; +const char *digest_algo; +}; +struct ipe_eval_ctx {enum ipe_operation op;const struct file *file;struct ipe_context *ci_ctx; +const struct ipe_bdev *ipe_bdev; +bool from_init_sb; };
security/ipe/hooks.c +51 -0
62 lines not on this page · raw message
security/ipe/hooks.h +6 -0
@@ -10,6 +10,7 @@#include <linux/sched.h> #include <linux/binfmts.h> #include <linux/security.h> +#include <linux/device-mapper.h> int ipe_task_alloc (struct task_struct *task,unsigned long clone_flags);
@@ -31,4 +32,9 @@ int ipe_kernel_load_data(enum kernel_load_data_id id, bool contents);void ipe_sb_free_security (struct super_block *mnt_sb); +void ipe_bdev_free_security (struct block_device *bdev); + +int ipe_bdev_setsecurity (struct block_device *bdev,const char *key, +const void *value,size_t len); +#endif /* IPE_HOOKS_H */
security/ipe/ipe.c +9 -0
@@ -9,6 +9,7 @@#include "ipe_parser.h" #include "modules/ipe_module.h" #include "modules.h" +#include "eval.h" #include <linux/fs.h> #include <linux/sched.h>
@@ -22,8 +23,14 @@ bool ipe_enabled; static struct lsm_blob_sizes ipe_blobs __lsm_ro_after_init = { .lbs_task =sizeof (struct ipe_context __rcu *), + .lbs_bdev =sizeof (struct ipe_bdev ), }; +struct ipe_bdev *ipe_bdev (struct block_device *b) +{ +return b->security + ipe_blobs.lbs_bdev; +} + static struct security_hook_list ipe_hooks[] __lsm_ro_after_init = {LSM_HOOK_INIT (task_alloc, ipe_task_alloc),LSM_HOOK_INIT (task_free, ipe_task_free),
@@ -33,6 +40,8 @@ static struct security_hook_list ipe_hooks[] __lsm_ro_after_init = {LSM_HOOK_INIT (kernel_read_file, ipe_kernel_read_file),LSM_HOOK_INIT (kernel_load_data, ipe_kernel_load_data),LSM_HOOK_INIT (sb_free_security, ipe_sb_free_security), +LSM_HOOK_INIT (bdev_free_security, ipe_bdev_free_security), + LSM_HOOK_INIT(bdev_setsecurity, ipe_bdev_setsecurity), };/**
security/ipe/ipe.h +3 -0
@@ -14,6 +14,7 @@#include <linux/types.h> #include <linux/sched.h> +#include <linux/blk_types.h> #include <linux/lsm_hooks.h> extern bool ipe_enabled;
@@ -21,4 +22,6 @@ extern bool ipe_enabled;extern struct ipe_parser __start_ipe_parsers[], __end_ipe_parsers[];extern struct ipe_module __start_ipe_modules[], __end_ipe_modules[]; +struct ipe_bdev *ipe_bdev (struct block_device *b); +#endif /* IPE_H */
security/ipe/modules.c +133 -0
148 lines not on this page · raw message
security/ipe/modules/Kconfig +23 -0
@@ -16,5 +16,28 @@ config IPE_PROP_BOOT_VERIFIED If unsure, answer N. +config IPE_PROP_DM_VERITY_SIGNATURE + bool "Enable support for signed dm-verity volumes" + depends on DM_VERITY_VERIFY_ROOTHASH_SIG + default Y + help + This option enables the property 'dmverity_signature' in + IPE policy. This property evaluates to TRUE when a file + is evaluated against a dm-verity volume that was mounted + with a signed root-hash. + + If unsure, answer Y. + +config IPE_PROP_DM_VERITY_ROOTHASH + bool "Enable support for dm-verity volumes" + depends on DM_VERITY + default Y + help + This option enables the property 'dmverity_roothash' in + IPE policy. This property evaluates to TRUE when a file + is evaluated against a dm-verity volume whose root hash + matches the supplied value. + + If unsure, answer Y. endmenu
security/ipe/modules/Makefile +2 -0
@@ -6,3 +6,5 @@ # obj-$(CONFIG_IPE_PROP_BOOT_VERIFIED) += boot_verified.o +obj-$(CONFIG_IPE_PROP_DM_VERITY_SIGNATURE) += dmverity_signature.o +obj-$(CONFIG_IPE_PROP_DM_VERITY_ROOTHASH) += dmverity_roothash.o
security/ipe/modules/dmverity_roothash.c new file +31 -0
@@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) Microsoft Corporation. All rights reserved. +*/ + +#include "ipe_module.h" + +#include <linux/fs.h> +#include <linux/types.h> +#include <linux/string.h> +#include <crypto/hash_info.h> + +static bool dvrh_eval (const struct ipe_eval_ctx *ctx,const void *val) +{ +const struct ipe_bdev *bdev; + +if (!ctx->ipe_bdev) +return false; + + bdev = ctx->ipe_bdev; +return ipe_digest_eval (val, bdev->digest, bdev->digest_len, bdev->digest_algo); +} + +IPE_MODULE (dvrh) = { + .name ="dmverity_roothash" , + .version =1 , + .parse = ipe_digest_parse, + .free = ipe_digest_free, + .eval = dvrh_eval, + .audit = ipe_digest_audit, +};
security/ipe/modules/dmverity_signature.c new file +26 -0
@@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) Microsoft Corporation. All rights reserved. +*/ + +#include "ipe_module.h" + +#include <linux/fs.h> +#include <linux/types.h> + +static bool dvv_eval (const struct ipe_eval_ctx *ctx,const void *val) +{ +bool expect = (bool )val; +bool eval = ctx->ipe_bdev && (!!ctx->ipe_bdev->dm_verity_signed); + +return expect == eval; +} + +IPE_MODULE (dvv) = { + .name ="dmverity_signature" , + .version =1 , + .parse = ipe_bool_parse, + .free =NULL , + .eval = dvv_eval, + .audit = ipe_bool_audit, +};
security/ipe/modules/ipe_module.h +5 -0
@@ -11,6 +11,11 @@int ipe_bool_parse (const char *valstr,void **value);void ipe_bool_audit (struct audit_buffer *ab,const void *val); +int ipe_digest_parse (const char *valstr,void **value); +void ipe_digest_audit (struct audit_buffer *ab,const void *val); +bool ipe_digest_eval (const void *expect,const u8 *digest,size_t digest_len, +const char *algo); +void ipe_digest_free (void **value);/** * ipe_module: definition of an extensible module for IPE properties.
Signature · 1 line
2.25.1
RFC PATCH v8 13/17 fsverity: consume builtin signature via LSM hook
In reply to Deven BowersFrom: Fan Wu <[email protected]>
fsverity represents a mechanism to support both integrity and authenticity protection of a file, supporting both signed and unsigned digests.
An LSM which controls access to a resource based on authenticity and integrity of said resource, can then use this data to make an informed decision on the authorization (provided by the LSM's policy) of said claim.
This effectively allows the extension of a policy enforcement layer in LSM for fsverity, allowing for more granular control of how a particular authenticity claim can be used. For example, "all (built-in) signed fsverity files should be allowed to execute, but only these hashes are allowed to be loaded as kernel modules".
This enforcement must be done in kernel space, as a userspace only solution would fail a simple litmus test: Download a self-contained malicious binary that never touches the userspace stack. This binary would still be able to execute.
---
v1-v6:
+ Not present
v7:
Introduced
v8:
+ Split fs/verity/ changes and security/ changes into separate patches
+ Change signature of fsverity_create_info to accept non-const inode
+ Change signature of fsverity_verify_signature to accept non-const inode
+ Don't cast-away const from inode.
+ Digest functionality dropped in favor of:
("fs-verity: define a function to return the integrity protected
file digest")
+ Reworded commit description and title to match changes.
+ Fix a bug wherein no LSM implements the particular fsverity @name (or LSM is disabled), and returns -EOPNOTSUPP, causing errors.
--- fs/verity/fsverity_private.h | 2 +- fs/verity/open.c | 13 ++++++++++++- fs/verity/signature.c | 1 + include/linux/fsverity.h | 2 ++ 4 files changed, 16 insertions(+), 2 deletions(-)
fs/verity/fsverity_private.h +1 -1
@@ -114,7 +114,7 @@ int fsverity_init_merkle_tree_params(struct merkle_tree_params *params,unsigned int log_blocksize, const u8 *salt, size_t salt_size); -struct fsverity_info *fsverity_create_info (const struct inode *inode, +struct fsverity_info *fsverity_create_info (struct inode *inode,struct fsverity_descriptor *desc);void fsverity_set_info (struct inode *inode,struct fsverity_info *vi);
fs/verity/open.c +12 -1
@@ -7,7 +7,9 @@#include "fsverity_private.h" +#include <linux/security.h> #include <linux/slab.h> +#include <crypto/public_key.h> static struct kmem_cache *fsverity_info_cachep;
@@ -146,7 +148,7 @@ static int compute_file_digest(struct fsverity_hash_alg *hash_alg,* appended signature), and check the signature if present. The * fsverity_descriptor must have already undergone basic validation. */ -struct fsverity_info *fsverity_create_info (const struct inode *inode, +struct fsverity_info *fsverity_create_info (struct inode *inode,struct fsverity_descriptor *desc) {struct fsverity_info *vi;
@@ -182,6 +184,15 @@ struct fsverity_info *fsverity_create_info(const struct inode *inode, err =fsverity_verify_signature (vi, desc->signature,le32_to_cpu (desc->sig_size)); +if (err) { +fsverity_err (inode,"Error %d verifying signature" , err); + goto out; + } + + err =security_inode_setsecurity (inode,FS_VERITY_INODE_SEC_NAME , desc->signature, +le32_to_cpu (desc->sig_size),0 ); +if (err == -EOPNOTSUPP ) + err =0 ; out:if (err) {fsverity_free_info (vi);
fs/verity/signature.c +1 -0
@@ -9,6 +9,7 @@#include <linux/cred.h> #include <linux/key.h> +#include <linux/security.h> #include <linux/slab.h> #include <linux/verification.h>
include/linux/fsverity.h +2 -0
@@ -251,4 +251,6 @@ static inline bool fsverity_active(const struct inode *inode) return fsverity_get_info(inode) != NULL; } +#define FS_VERITY_INODE_SEC_NAME "fsverity.inode-info" +#endif /* _LINUX_FSVERITY_H */
Signature · 1 line
2.25.1
Eric Biggers
maintainerRe: [RFC PATCH v8 13/17] fsverity: consume builtin signature via LSM hook
Quoted 17 lines · Deven Bowers
From: Fan Wu <[email protected]>
fsverity represents a mechanism to support both integrity and authenticity protection of a file, supporting both signed and unsigned digests.
An LSM which controls access to a resource based on authenticity and integrity of said resource, can then use this data to make an informed decision on the authorization (provided by the LSM's policy) of said claim.
This effectively allows the extension of a policy enforcement layer in LSM for fsverity, allowing for more granular control of how a particular authenticity claim can be used. For example, "all (built-in) signed fsverity files should be allowed to execute, but only these hashes are allowed to be loaded as kernel modules".
Quoted 7 lines
This enforcement must be done in kernel space, as a userspace only solution would fail a simple litmus test: Download a self-contained malicious binary that never touches the userspace stack. This binary would still be able to execute.
Signed-off-by Fan Wu <[email protected]>Signed-off-by Deven Bowers <[email protected]>
The IMA support for fs-verity, which is now upstream, already does this (except that IMA isn't an LSM). It also doesn't rely on the fs-verity builtin signatures, which shouldn't really be used. Can you elaborate on how what you're doing is better?
- Eric
RFC PATCH v8 14/17 ipe: enable support for fs-verity as a trust provider
In reply to Deven BowersFrom: Fan Wu <[email protected]>
Enable IPE policy authors to indicate trust for a singular fsverity file, identified by the digest information, through "fsverity_digest" and all files using fsverity's builtin signatures via "fsverity_signature".
This enables file-level integrity claims to be expressed in IPE, allowing individual files to be authorized, giving some flexibility for policy authors. Such file-level claims are important to be expressed for enforcing the integrity of packages, as well as address some of the scalability issues in a sole dm-verity based solution (# of loop back devices, etc).
This solution cannot be done in userspace as the minimum threat that IPE should mitigate is an attacker downloads malicious payload with all required dependencies. These dependencies can lack the userspace check, bypassing the protection entirely. A similar attack succeeds if the userspace component is replaced with a version that does not perform the check. As a result, this can only be done in the common entry point - the kernel.
---
v1-v6:
+ Not present
v7:
Introduced
v8:
* Undo squash of 08/12, 10/12 - separating drivers/md/ from security/
* Use common-audit function for fsverity_signature.
+ Change fsverity implementation to use fsverity_get_digest
+ prevent unnecessary copy of fs-verity signature data, instead just check for presence of signature data.
+ Remove free_inode_security hook, as the digest is now acquired at runtime instead of via LSM blob.
--- security/ipe/eval.c | 1 + security/ipe/eval.h | 5 +++ security/ipe/hooks.c | 29 +++++++++++++++++ security/ipe/hooks.h | 5 +++ security/ipe/ipe.c | 7 ++++ security/ipe/ipe.h | 1 + security/ipe/modules/Kconfig | 23 +++++++++++++ security/ipe/modules/Makefile | 2 ++ security/ipe/modules/fsverity_digest.c | 39 +++++++++++++++++++++++ security/ipe/modules/fsverity_signature.c | 34 ++++++++++++++++++++ 10 files changed, 146 insertions(+) create mode 100644 security/ipe/modules/fsverity_digest.c create mode 100644 security/ipe/modules/fsverity_signature.c
security/ipe/eval.c +1 -0
@@ -95,6 +95,7 @@ static struct ipe_eval_ctx *build_ctx(const struct file *file, ctx->ci_ctx =ipe_current_ctx (); ctx->from_init_sb =from_pinned (file);if (file) { + ctx->ipe_inode =ipe_inode (file->f_inode);if (FILE_BLOCK_DEV (file)) ctx->ipe_bdev =ipe_bdev (FILE_BLOCK_DEV (file)); }
security/ipe/eval.h +5 -0
@@ -22,6 +22,10 @@ struct ipe_bdev {const char *digest_algo; }; +struct ipe_inode { +bool fs_verity_signed; +}; +struct ipe_eval_ctx {enum ipe_operation op;
@@ -29,6 +33,7 @@ struct ipe_eval_ctx {struct ipe_context *ci_ctx;const struct ipe_bdev *ipe_bdev; +const struct ipe_inode *ipe_inode;bool from_init_sb; };
security/ipe/hooks.c +29 -0
@@ -267,3 +267,32 @@ int ipe_bdev_setsecurity(struct block_device *bdev, const char *key,return -EOPNOTSUPP ; } + +/** +* ipe_inode_setsecurity: Sets the a certain field of a inode security +* blob, based on @key. +* @inode: The inode to source the security blob from. +* @name: The name representing the information to be stored. +* @value: The value to be stored. +* @size: The size of @value. +* @flags: unused +* +* Saves fsverity signature & digest into inode security blob +* +* Return: +* 0 - OK +* !0 - Error +*/ +int ipe_inode_setsecurity (struct inode *inode,const char *name, +const void *value,size_t size, +int flags) +{ +struct ipe_inode *inode_sec =ipe_inode (inode); + +if (!strcmp (name,FS_VERITY_INODE_SEC_NAME )) { + inode_sec->fs_verity_signed = size >0 && value; +return 0 ; + } + +return -EOPNOTSUPP ; +}
security/ipe/hooks.h +5 -0
@@ -10,6 +10,7 @@#include <linux/sched.h> #include <linux/binfmts.h> #include <linux/security.h> +#include <linux/fsverity.h> #include <linux/device-mapper.h> int ipe_task_alloc(struct task_struct *task,
@@ -37,4 +38,8 @@ void ipe_bdev_free_security(struct block_device *bdev);int ipe_bdev_setsecurity (struct block_device *bdev,const char *key,const void *value,size_t len); +int ipe_inode_setsecurity (struct inode *inode,const char *name, +const void *value,size_t size, +int flags); +#endif /* IPE_HOOKS_H */
security/ipe/ipe.c +7 -0
@@ -24,6 +24,7 @@ bool ipe_enabled; static struct lsm_blob_sizes ipe_blobs __lsm_ro_after_init = { .lbs_task =sizeof (struct ipe_context __rcu *), .lbs_bdev =sizeof (struct ipe_bdev ), + .lbs_inode =sizeof (struct ipe_inode ), };struct ipe_bdev *ipe_bdev (struct block_device *b)
@@ -31,6 +32,11 @@ struct ipe_bdev *ipe_bdev(struct block_device *b)return b->security + ipe_blobs.lbs_bdev; } +struct ipe_inode *ipe_inode (const struct inode *inode) +{ +return inode->i_security + ipe_blobs.lbs_inode; +} + static struct security_hook_list ipe_hooks[] __lsm_ro_after_init = {LSM_HOOK_INIT (task_alloc, ipe_task_alloc),LSM_HOOK_INIT (task_free, ipe_task_free),
@@ -42,6 +48,7 @@ static struct security_hook_list ipe_hooks[] __lsm_ro_after_init = {LSM_HOOK_INIT (sb_free_security, ipe_sb_free_security),LSM_HOOK_INIT (bdev_free_security, ipe_bdev_free_security),LSM_HOOK_INIT (bdev_setsecurity, ipe_bdev_setsecurity), + LSM_HOOK_INIT(inode_setsecurity, ipe_inode_setsecurity), };/**
security/ipe/ipe.h +1 -0
@@ -23,5 +23,6 @@ extern struct ipe_parser __start_ipe_parsers[], __end_ipe_parsers[];extern struct ipe_module __start_ipe_modules[], __end_ipe_modules[];struct ipe_bdev *ipe_bdev (struct block_device *b); +struct ipe_inode *ipe_inode (const struct inode *inode);#endif /* IPE_H */
security/ipe/modules/Kconfig +23 -0
@@ -40,4 +40,27 @@ config IPE_PROP_DM_VERITY_ROOTHASH If unsure, answer Y. +config IPE_PROP_FS_VERITY_SIGNATURE + bool "Enable property for signed fs-verity files" + depends on FS_VERITY_BUILTIN_SIGNATURES + help + This option enables IPE's integration with FSVerity's + signed hashes. This enables the usage of the property, + "fsverity_signature" in IPE's policy. + + if unsure, answer Y. + +config IPE_PROP_FS_VERITY_DIGEST + bool "Enable property for authorizing fs-verity files via digest" + depends on FS_VERITY + help + This option enables IPE's integration with FSVerity. + This enables the usage of the property "fsverity_digest" in IPE's + policy. This property allows authorization or revocation via a + a hex-string representing the digest of a fsverity file. + + if unsure, answer Y. + + + endmenu
security/ipe/modules/Makefile +2 -0
@@ -8,3 +8,5 @@ obj-$(CONFIG_IPE_PROP_BOOT_VERIFIED) += boot_verified.o obj-$(CONFIG_IPE_PROP_DM_VERITY_SIGNATURE) += dmverity_signature.o obj-$(CONFIG_IPE_PROP_DM_VERITY_ROOTHASH) += dmverity_roothash.o +obj-$(CONFIG_IPE_PROP_FS_VERITY_SIGNATURE) += fsverity_signature.o +obj-$(CONFIG_IPE_PROP_FS_VERITY_DIGEST) += fsverity_digest.o
security/ipe/modules/fsverity_digest.c new file +39 -0
@@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) Microsoft Corporation. All rights reserved. +*/ + +#include "ipe_module.h" + +#include <linux/fs.h> +#include <linux/types.h> +#include <linux/fsverity.h> +#include <crypto/hash_info.h> + +static bool evaluate (const struct ipe_eval_ctx *ctx,const void *val) +{ +enum hash_algo alg; +u8 digest[FS_VERITY_MAX_DIGEST_SIZE ]; +struct inode *ino; + +if (!ctx->file) +return false; + + ino =file_inode (ctx->file); +if (!ino) +return false; + +if (fsverity_get_digest (ino, digest, &alg)) +return false; + +return ipe_digest_eval (val, digest, hash_digest_size[alg], hash_algo_name[alg]); +} + +IPE_MODULE (fsv_digest) = { + .name ="fsverity_digest" , + .version =1 , + .parse = ipe_digest_parse, + .free = ipe_digest_free, + .eval = evaluate, + .audit = ipe_digest_audit, +};
security/ipe/modules/fsverity_signature.c new file +34 -0
@@ -0,0 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) Microsoft Corporation. All rights reserved. +*/ + +#include "ipe_module.h" + +#include <linux/fs.h> +#include <linux/types.h> +#include <linux/slab.h> +#include <linux/audit.h> +#include <linux/mount.h> + +static bool evaluate (const struct ipe_eval_ctx *ctx,const void *value) +{ +bool expect = (bool )value; + +if (!ctx->file || !IS_VERITY (ctx->file->f_inode)) +return false; + +if (!ctx->ipe_inode) +return false; + +return (!!ctx->ipe_inode->fs_verity_signed) == expect; +} + +IPE_MODULE (fsvs) = { + .name ="fsverity_signature" , + .version =1 , + .parse = ipe_bool_parse, + .free =NULL , + .eval = evaluate, + .audit = ipe_bool_audit, +};
Signature · 1 line
2.25.1
RFC PATCH v8 15/17 scripts: add boot policy generation program
In reply to Deven BowersEnables an IPE policy to be enforced from kernel start, enabling access control based on trust from kernel startup. This is accomplished by transforming an IPE policy indicated by CONFIG_IPE_BOOT_POLICY into a c-string literal that is parsed at kernel startup as an unsigned policy.
---
v2:
+ No Changes
v3:
+ No Changes
v4:
+ No Changes
v5:
+ No Changes
v6:
+ No Changes
v7:
+ Move from 01/11 to 14/16
+ Don't return errno directly.
+ Make output of script more user-friendly
+ Add escaping for tab and '?'
+ Mark argv pointer const
+ Invert return code check in the boot policy parsing code path.
v8:
+ No signfiicant chances.
--- MAINTAINERS | 1 + scripts/Makefile | 1 + scripts/ipe/Makefile | 2 + scripts/ipe/polgen/.gitignore | 1 + scripts/ipe/polgen/Makefile | 6 ++ scripts/ipe/polgen/polgen.c | 145 ++++++++++++++++++++++++++++++++++ security/ipe/.gitignore | 1 + security/ipe/Kconfig | 10 +++ security/ipe/Makefile | 11 +++ security/ipe/ctx.c | 18 +++++ security/ipe/fs.c | 10 +++ 11 files changed, 206 insertions(+) create mode 100644 scripts/ipe/Makefile create mode 100644 scripts/ipe/polgen/.gitignore create mode 100644 scripts/ipe/polgen/Makefile create mode 100644 scripts/ipe/polgen/polgen.c create mode 100644 security/ipe/.gitignore
MAINTAINERS +1 -0
@@ -9797,6 +9797,7 @@ INTEGRITY POLICY ENFORCEMENT (IPE) M: Deven Bowers <[email protected]> M: Fan Wu <[email protected]> S: Supported +F: scripts/ipe/ F: security/ipe/ INTEL 810/815 FRAMEBUFFER DRIVER
scripts/Makefile +1 -0
@@ -38,6 +38,7 @@ targets += module.lds subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins subdir-$(CONFIG_MODVERSIONS) += genksyms subdir-$(CONFIG_SECURITY_SELINUX) += selinux +subdir-$(CONFIG_SECURITY_IPE) += ipe # Let clean descend into subdirs subdir- += basic dtc gdb kconfig mod
scripts/ipe/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +subdir-y := polgen
scripts/ipe/polgen/.gitignore new file +1 -0
@@ -0,0 +1 @@ +polgen
scripts/ipe/polgen/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0 +hostprogs-always-y := polgen +HOST_EXTRACFLAGS += \ + -I$(srctree)/include \ + -I$(srctree)/include/uapi \ +
scripts/ipe/polgen/polgen.c new file +145 -0
145 lines not on this page · raw message
security/ipe/.gitignore new file +1 -0
@@ -0,0 +1 @@ +boot-policy.c
security/ipe/Kconfig +10 -0
@@ -18,6 +18,16 @@ menuconfig SECURITY_IPE if SECURITY_IPE +config IPE_BOOT_POLICY + string "Integrity policy to apply on system startup" + help + This option specifies a filepath to a IPE policy that is compiled + into the kernel. This policy will be enforced until a policy update + is deployed via the $securityfs/ipe/policies/$policy_name/active + interface. + + If unsure, leave blank. + config IPE_AUDIT bool "Enable IPE's audit events" depends on AUDIT && AUDITSYSCALL
security/ipe/Makefile +11 -0
@@ -7,7 +7,16 @@ ccflags-y := -I$(srctree)/security/ipe/modules +quiet_cmd_polgen = IPE_POL $(2) + cmd_polgen = scripts/ipe/polgen/polgen security/ipe/boot-policy.c $(2) + +targets += boot-policy.c + +$(obj)/boot-policy.c: scripts/ipe/polgen/polgen $(CONFIG_IPE_BOOT_POLICY) FORCE + $(call if_changed,polgen,$(CONFIG_IPE_BOOT_POLICY)) + obj-$(CONFIG_SECURITY_IPE) += \ + boot-policy.o \ ctx.o \ eval.o \ fs.o \
@@ -21,3 +30,5 @@ obj-$(CONFIG_SECURITY_IPE) += \ policyfs.o \ obj-$(CONFIG_IPE_AUDIT) += audit.o + +clean-files := boot-policy.c \
security/ipe/ctx.c +18 -0
@@ -15,6 +15,7 @@#include <linux/spinlock.h> #include <linux/moduleparam.h> +extern const char *const ipe_boot_policy;static bool success_audit;static bool enforce = true;
@@ -316,6 +317,7 @@ void ipe_put_ctx(struct ipe_context *ctx)int __init ipe_init_ctx (void ) {int rc =0 ; +struct ipe_policy *p =NULL ;struct ipe_context *lns =NULL ; lns =create_ctx ();
@@ -329,10 +331,26 @@ int __init ipe_init_ctx(void)WRITE_ONCE (lns->enforce, enforce);spin_unlock (&lns->lock); +if (ipe_boot_policy) { + p =ipe_new_policy (ipe_boot_policy,strlen (ipe_boot_policy), +NULL ,0 ); +if (IS_ERR (p)) { + rc =PTR_ERR (p); + goto err; + } + +ipe_add_policy (lns, p); + rc =ipe_set_active_pol (p); +if (rc) + goto err; + } +rcu_assign_pointer (*ipe_tsk_ctx (current), lns); +ipe_put_policy (p);return 0 ; err: +ipe_put_policy (p);ipe_put_ctx (lns);return rc; }
security/ipe/fs.c +10 -0
@@ -270,6 +270,7 @@ static const struct file_operations audit_fops = {static int __init ipe_init_securityfs (void ) {int rc =0 ; +struct ipe_policy *p =NULL ;struct ipe_context *ctx =NULL ;if (!ipe_enabled)
@@ -316,8 +317,17 @@ static int __init ipe_init_securityfs(void) goto err; } + p =ipe_get_policy_rcu (ctx->active_policy); +if (p) { + rc =ipe_new_policyfs_node (ctx, p); +if (rc) + goto err; + } + +ipe_put_policy (p);return 0 ; err: +ipe_put_policy (p);securityfs_remove (np);securityfs_remove (root);securityfs_remove (config);
Signature · 1 line
2.25.1
RFC PATCH v8 16/17 ipe: kunit tests
In reply to Deven BowersAdd various happy/unhappy unit tests for both IPE's parser and evaluation loop, testing the core of IPE. The missing test gap remains the interface with userspace.
---
v1-v6:
+ Not present
v7:
Introduced
v8:
+ Remove the kunit tests with respect to the fsverity digest, as these require significant changes to work with the new method of acquiring the digest at runtime.
--- security/ipe/Kconfig | 17 + security/ipe/Makefile | 3 + security/ipe/ctx_test.c | 718 +++++++++++++++++++++++++++++ security/ipe/eval.c | 4 + security/ipe/policy_parser_tests.c | 313 +++++++++++++ 5 files changed, 1055 insertions(+) create mode 100644 security/ipe/ctx_test.c create mode 100644 security/ipe/policy_parser_tests.c
security/ipe/Kconfig +17 -0
@@ -81,4 +81,21 @@ config IPE_AUDIT_HASH_ALG source "security/ipe/modules/Kconfig" +config SECURITY_IPE_KUNIT_TEST + bool "Build KUnit tests for IPE" if !KUNIT_ALL_TESTS + depends on KUNIT=y + default KUNIT_ALL_TESTS + help + This builds the IPE KUnit tests. + + KUnit tests run during boot and output the results to the debug log + in TAP format (https://testanything.org/). Only useful for kernel devs + running KUnit test harness and are not for inclusion into a + production build. + + For more information on KUnit and unit tests in general please refer + to the KUnit documentation in Documentation/dev-tools/kunit/. + + If unsure, say N. + endif
security/ipe/Makefile +3 -0
@@ -31,4 +31,7 @@ obj-$(CONFIG_SECURITY_IPE) += \ obj-$(CONFIG_IPE_AUDIT) += audit.o +obj-$(CONFIG_SECURITY_IPE_KUNIT_TEST) += \ + policy_parser_tests.o \ + clean-files := boot-policy.c \
security/ipe/ctx_test.c new file +718 -0
718 lines not on this page · raw message
security/ipe/eval.c +4 -0
@@ -234,3 +234,7 @@ void ipe_invalidate_pinned_sb(const struct super_block *mnt_sb)spin_unlock (&pin_lock); } + +#ifdef CONFIG_SECURITY_IPE_KUNIT_TEST +#include "ctx_test.c" +#endif /* CONFIG_SECURITY_IPE_KUNIT_TEST */
security/ipe/policy_parser_tests.c new file +313 -0
313 lines not on this page · raw message
Signature · 1 line
2.25.1
RFC PATCH v8 17/17 documentation: add ipe documentation
In reply to Deven BowersAdd IPE's admin and developer documentation to the kernel tree.
---
v2:
+ No Changes
v3:
+ Add Acked-by
+ Fixup code block syntax
+ Fix a minor grammatical issue.
v4:
+ Update documentation with the results of other code changes.
v5:
+ No changes
v6:
+ No changes
v7:
+ Add additional developer-level documentation
+ Update admin-guide docs to reflect changes.
+ Drop Acked-by due to significant changes
+ Added section about audit events in admin-guide
v8:
+ Correct terminology from "audit event" to "audit record"
+ Add associated documentation with the correct "audit event" terminology.
+ Add some context to the historical motivation for IPE and design philosophy.
+ Add some content about the securityfs layout in the policies directory.
+ Various spelling and grammatical corrections.
--- Documentation/admin-guide/LSM/index.rst | 1 + Documentation/admin-guide/LSM/ipe.rst | 739 ++++++++++++++++++ .../admin-guide/kernel-parameters.txt | 12 + Documentation/security/index.rst | 1 + Documentation/security/ipe.rst | 559 +++++++++++++ MAINTAINERS | 2 + 6 files changed, 1314 insertions(+) create mode 100644 Documentation/admin-guide/LSM/ipe.rst create mode 100644 Documentation/security/ipe.rst
Documentation/admin-guide/LSM/index.rst +1 -0
@@ -47,3 +47,4 @@ subdirectories. tomoyo Yama SafeSetID + ipe
Documentation/admin-guide/LSM/ipe.rst new file +739 -0
739 lines not on this page · raw message
Documentation/admin-guide/kernel-parameters.txt +12 -0
@@ -2164,6 +2164,18 @@ ipcmni_extend [KNL] Extend the maximum number of unique System V IPC identifiers from 32,768 to 16,777,216. + ipe.enforce= [IPE] + Format: <bool> + Determine whether IPE starts in permissive (0) or + enforce (1) mode. The default is enforce. + + ipe.success_audit= + [IPE] + Format: <bool> + Start IPE with success auditing enabled, emitting + an audit event when a binary is allowed. The default + is 0. + irqaffinity= [SMP] Set the default irq affinity mask The argument is a cpu list, as described above.
Documentation/security/index.rst +1 -0
@@ -18,3 +18,4 @@ Security Documentation digsig landlock secrets/index + ipe
Documentation/security/ipe.rst new file +559 -0
559 lines not on this page · raw message
MAINTAINERS +2 -0
@@ -9797,6 +9797,8 @@ INTEGRITY POLICY ENFORCEMENT (IPE) M: Deven Bowers <[email protected]> M: Fan Wu <[email protected]> S: Supported +F: Documentation/admin-guide/LSM/ipe.rst +F: Documentation/security/ipe.rst F: scripts/ipe/ F: security/ipe/
Signature · 1 line
2.25.1
Quoted 1 line · Deven Bowers
IPE is a Linux Security Module which takes a complimentary approach to
Hello, IPE. You're looking exceptionally attractive today. Have you been working out?
(maybe you meant "complementary"? ;-)
Quoted 5 lines · Matthew Wilcox
Quoted 1 line · Deven Bowers
IPE is a Linux Security Module which takes a complimentary approach to
Hello, IPE. You're looking exceptionally attractive today. Have you been working out?
Not nearly as often as I'd like to :)
Quoted 2 lines
(maybe you meant "complementary"? ;-)
Yes, thanks. Sorry for the misspelling.