mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
Merge tag 'lsm-pr-20240911' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm
Pull lsm updates from Paul Moore: - Move the LSM framework to static calls This transitions the vast majority of the LSM callbacks into static calls. Those callbacks which haven't been converted were left as-is due to the general ugliness of the changes required to support the static call conversion; we can revisit those callbacks at a future date. - Add the Integrity Policy Enforcement (IPE) LSM This adds a new LSM, Integrity Policy Enforcement (IPE). There is plenty of documentation about IPE in this patches, so I'll refrain from going into too much detail here, but the basic motivation behind IPE is to provide a mechanism such that administrators can restrict execution to only those binaries which come from integrity protected storage, e.g. a dm-verity protected filesystem. You will notice that IPE requires additional LSM hooks in the initramfs, dm-verity, and fs-verity code, with the associated patches carrying ACK/review tags from the associated maintainers. We couldn't find an obvious maintainer for the initramfs code, but the IPE patchset has been widely posted over several years. Both Deven Bowers and Fan Wu have contributed to IPE's development over the past several years, with Fan Wu agreeing to serve as the IPE maintainer moving forward. Once IPE is accepted into your tree, I'll start working with Fan to ensure he has the necessary accounts, keys, etc. so that he can start submitting IPE pull requests to you directly during the next merge window. - Move the lifecycle management of the LSM blobs to the LSM framework Management of the LSM blobs (the LSM state buffers attached to various kernel structs, typically via a void pointer named "security" or similar) has been mixed, some blobs were allocated/managed by individual LSMs, others were managed by the LSM framework itself. Starting with this pull we move management of all the LSM blobs, minus the XFRM blob, into the framework itself, improving consistency across LSMs, and reducing the amount of duplicated code across LSMs. Due to some additional work required to migrate the XFRM blob, it has been left as a todo item for a later date; from a practical standpoint this omission should have little impact as only SELinux provides a XFRM LSM implementation. - Fix problems with the LSM's handling of F_SETOWN The LSM hook for the fcntl(F_SETOWN) operation had a couple of problems: it was racy with itself, and it was disconnected from the associated DAC related logic in such a way that the LSM state could be updated in cases where the DAC state would not. We fix both of these problems by moving the security_file_set_fowner() hook into the same section of code where the DAC attributes are updated. Not only does this resolve the DAC/LSM synchronization issue, but as that code block is protected by a lock, it also resolve the race condition. - Fix potential problems with the security_inode_free() LSM hook Due to use of RCU to protect inodes and the placement of the LSM hook associated with freeing the inode, there is a bit of a challenge when it comes to managing any LSM state associated with an inode. The VFS folks are not open to relocating the LSM hook so we have to get creative when it comes to releasing an inode's LSM state. Traditionally we have used a single LSM callback within the hook that is triggered when the inode is "marked for death", but not actually released due to RCU. Unfortunately, this causes problems for LSMs which want to take an action when the inode's associated LSM state is actually released; so we add an additional LSM callback, inode_free_security_rcu(), that is called when the inode's LSM state is released in the RCU free callback. - Refactor two LSM hooks to better fit the LSM return value patterns The vast majority of the LSM hooks follow the "return 0 on success, negative values on failure" pattern, however, there are a small handful that have unique return value behaviors which has caused confusion in the past and makes it difficult for the BPF verifier to properly vet BPF LSM programs. This includes patches to convert two of these"special" LSM hooks to the common 0/-ERRNO pattern. - Various cleanups and improvements A handful of patches to remove redundant code, better leverage the IS_ERR_OR_NULL() helper, add missing "static" markings, and do some minor style fixups. * tag 'lsm-pr-20240911' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm: (40 commits) security: Update file_set_fowner documentation fs: Fix file_set_fowner LSM hook inconsistencies lsm: Use IS_ERR_OR_NULL() helper function lsm: remove LSM_COUNT and LSM_CONFIG_COUNT ipe: Remove duplicated include in ipe.c lsm: replace indirect LSM hook calls with static calls lsm: count the LSMs enabled at compile time kernel: Add helper macros for loop unrolling init/main.c: Initialize early LSMs after arch code, static keys and calls. MAINTAINERS: add IPE entry with Fan Wu as maintainer documentation: add IPE documentation ipe: kunit test for parser scripts: add boot policy generation program ipe: enable support for fs-verity as a trust provider fsverity: expose verified fsverity built-in signatures to LSMs lsm: add security_inode_setintegrity() hook ipe: add support for dm-verity as a trust provider dm-verity: expose root hash digest and signature data to LSMs block,lsm: add LSM blob and new LSM hooks for block devices ipe: add permissive toggle ...
This commit is contained in:
@@ -47,3 +47,4 @@ subdirectories.
|
||||
tomoyo
|
||||
Yama
|
||||
SafeSetID
|
||||
ipe
|
||||
|
||||
790
Documentation/admin-guide/LSM/ipe.rst
Normal file
790
Documentation/admin-guide/LSM/ipe.rst
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2350,6 +2350,18 @@
|
||||
ipcmni_extend [KNL,EARLY] 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.
|
||||
|
||||
|
||||
@@ -86,6 +86,16 @@ authenticating fs-verity file hashes include:
|
||||
signature in their "security.ima" extended attribute, as controlled
|
||||
by the IMA policy. For more information, see the IMA documentation.
|
||||
|
||||
- Integrity Policy Enforcement (IPE). IPE supports enforcing access
|
||||
control decisions based on immutable security properties of files,
|
||||
including those protected by fs-verity's built-in signatures.
|
||||
"IPE policy" specifically allows for the authorization of fs-verity
|
||||
files using properties ``fsverity_digest`` for identifying
|
||||
files by their verity digest, and ``fsverity_signature`` to authorize
|
||||
files with a verified fs-verity's built-in signature. For
|
||||
details on configuring IPE policies and understanding its operational
|
||||
modes, please refer to :doc:`IPE admin guide </admin-guide/LSM/ipe>`.
|
||||
|
||||
- Trusted userspace code in combination with `Built-in signature
|
||||
verification`_. This approach should be used only with great care.
|
||||
|
||||
@@ -457,7 +467,11 @@ Enabling this option adds the following:
|
||||
On success, the ioctl persists the signature alongside the Merkle
|
||||
tree. Then, any time the file is opened, the kernel verifies the
|
||||
file's actual digest against this signature, using the certificates
|
||||
in the ".fs-verity" keyring.
|
||||
in the ".fs-verity" keyring. This verification happens as long as the
|
||||
file's signature exists, regardless of the state of the sysctl variable
|
||||
"fs.verity.require_signatures" described in the next item. The IPE LSM
|
||||
relies on this behavior to recognize and label fsverity files
|
||||
that contain a verified built-in fsverity signature.
|
||||
|
||||
3. A new sysctl "fs.verity.require_signatures" is made available.
|
||||
When set to 1, the kernel requires that all verity files have a
|
||||
@@ -481,7 +495,7 @@ be carefully considered before using them:
|
||||
|
||||
- Builtin signature verification does *not* make the kernel enforce
|
||||
that any files actually have fs-verity enabled. Thus, it is not a
|
||||
complete authentication policy. Currently, if it is used, the only
|
||||
complete authentication policy. Currently, if it is used, one
|
||||
way to complete the authentication policy is for trusted userspace
|
||||
code to explicitly check whether files have fs-verity enabled with a
|
||||
signature before they are accessed. (With
|
||||
@@ -490,6 +504,15 @@ be carefully considered before using them:
|
||||
could just store the signature alongside the file and verify it
|
||||
itself using a cryptographic library, instead of using this feature.
|
||||
|
||||
- Another approach is to utilize fs-verity builtin signature
|
||||
verification in conjunction with the IPE LSM, which supports defining
|
||||
a kernel-enforced, system-wide authentication policy that allows only
|
||||
files with a verified fs-verity builtin signature to perform certain
|
||||
operations, such as execution. Note that IPE doesn't require
|
||||
fs.verity.require_signatures=1.
|
||||
Please refer to :doc:`IPE admin guide </admin-guide/LSM/ipe>` for
|
||||
more details.
|
||||
|
||||
- A file's builtin signature can only be set at the same time that
|
||||
fs-verity is being enabled on the file. Changing or deleting the
|
||||
builtin signature later requires re-creating the file.
|
||||
|
||||
@@ -19,3 +19,4 @@ Security Documentation
|
||||
digsig
|
||||
landlock
|
||||
secrets/index
|
||||
ipe
|
||||
|
||||
446
Documentation/security/ipe.rst
Normal file
446
Documentation/security/ipe.rst
Normal file
@@ -0,0 +1,446 @@
|
||||
.. SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
Integrity Policy Enforcement (IPE) - Kernel Documentation
|
||||
=========================================================
|
||||
|
||||
.. NOTE::
|
||||
|
||||
This is documentation targeted at developers, instead of administrators.
|
||||
If you're looking for documentation on the usage of IPE, please see
|
||||
:doc:`IPE admin guide </admin-guide/LSM/ipe>`.
|
||||
|
||||
Historical Motivation
|
||||
---------------------
|
||||
|
||||
The original issue that prompted IPE's implementation was the creation
|
||||
of a locked-down system. This system would be born-secure, and have
|
||||
strong integrity guarantees over both the executable code, and specific
|
||||
*data files* on the system, that were critical to its function. These
|
||||
specific data files would not be readable unless they passed integrity
|
||||
policy. A mandatory access control system would be present, and
|
||||
as a result, xattrs would have to be protected. This lead to a selection
|
||||
of what would provide the integrity claims. At the time, there were two
|
||||
main mechanisms considered that could guarantee integrity for the system
|
||||
with these requirements:
|
||||
|
||||
1. IMA + EVM Signatures
|
||||
2. DM-Verity
|
||||
|
||||
Both options were carefully considered, however the choice to use DM-Verity
|
||||
over IMA+EVM as the *integrity mechanism* in the original use case of IPE
|
||||
was due to three main reasons:
|
||||
|
||||
1. Protection of additional attack vectors:
|
||||
|
||||
* With IMA+EVM, without an encryption solution, the system is vulnerable
|
||||
to offline attack against the aforementioned specific data files.
|
||||
|
||||
Unlike executables, read operations (like those on the protected data
|
||||
files), cannot be enforced to be globally integrity verified. This means
|
||||
there must be some form of selector to determine whether a read should
|
||||
enforce the integrity policy, or it should not.
|
||||
|
||||
At the time, this was done with mandatory access control labels. An IMA
|
||||
policy would indicate what labels required integrity verification, which
|
||||
presented an issue: EVM would protect the label, but if an attacker could
|
||||
modify filesystem offline, the attacker could wipe all the xattrs -
|
||||
including the SELinux labels that would be used to determine whether the
|
||||
file should be subject to integrity policy.
|
||||
|
||||
With DM-Verity, as the xattrs are saved as part of the Merkel tree, if
|
||||
offline mount occurs against the filesystem protected by dm-verity, the
|
||||
checksum no longer matches and the file fails to be read.
|
||||
|
||||
* As userspace binaries are paged in Linux, dm-verity also offers the
|
||||
additional protection against a hostile block device. In such an attack,
|
||||
the block device reports the appropriate content for the IMA hash
|
||||
initially, passing the required integrity check. Then, on the page fault
|
||||
that accesses the real data, will report the attacker's payload. Since
|
||||
dm-verity will check the data when the page fault occurs (and the disk
|
||||
access), this attack is mitigated.
|
||||
|
||||
2. Performance:
|
||||
|
||||
* dm-verity provides integrity verification on demand as blocks are
|
||||
read versus requiring the entire file being read into memory for
|
||||
validation.
|
||||
|
||||
3. Simplicity of signing:
|
||||
|
||||
* No need for two signatures (IMA, then EVM): one signature covers
|
||||
an entire block device.
|
||||
* Signatures can be stored externally to the filesystem metadata.
|
||||
* The signature supports an x.509-based signing infrastructure.
|
||||
|
||||
The next step was to choose a *policy* to enforce the integrity mechanism.
|
||||
The minimum requirements for the policy were:
|
||||
|
||||
1. The policy itself must be integrity verified (preventing trivial
|
||||
attack against it).
|
||||
2. The policy itself must be resistant to rollback attacks.
|
||||
3. The policy enforcement must have a permissive-like mode.
|
||||
4. The policy must be able to be updated, in its entirety, without
|
||||
a reboot.
|
||||
5. Policy updates must be atomic.
|
||||
6. The policy must support *revocations* of previously authored
|
||||
components.
|
||||
7. The policy must be auditable, at any point-of-time.
|
||||
|
||||
IMA, as the only integrity policy mechanism at the time, was
|
||||
considered against these list of requirements, and did not fulfill
|
||||
all of the minimum requirements. Extending IMA to cover these
|
||||
requirements was considered, but ultimately discarded for a
|
||||
two reasons:
|
||||
|
||||
1. Regression risk; many of these changes would result in
|
||||
dramatic code changes to IMA, which is already present in the
|
||||
kernel, and therefore might impact users.
|
||||
|
||||
2. IMA was used in the system for measurement and attestation;
|
||||
separation of measurement policy from local integrity policy
|
||||
enforcement was considered favorable.
|
||||
|
||||
Due to these reasons, it was decided that a new LSM should be created,
|
||||
whose responsibility would be only the local integrity policy enforcement.
|
||||
|
||||
Role and Scope
|
||||
--------------
|
||||
|
||||
IPE, as its name implies, is fundamentally an integrity policy enforcement
|
||||
solution; IPE does not mandate how integrity is provided, but instead
|
||||
leaves that decision to the system administrator to set the security bar,
|
||||
via the mechanisms that they select that suit their individual needs.
|
||||
There are several different integrity solutions that provide a different
|
||||
level of security guarantees; and IPE allows sysadmins to express policy for
|
||||
theoretically all of them.
|
||||
|
||||
IPE does not have an inherent mechanism to ensure integrity on its own.
|
||||
Instead, there are more effective layers available for building systems that
|
||||
can guarantee integrity. It's important to note that the mechanism for proving
|
||||
integrity is independent of the policy for enforcing that integrity claim.
|
||||
|
||||
Therefore, IPE was designed around:
|
||||
|
||||
1. Easy integrations with integrity providers.
|
||||
2. Ease of use for platform administrators/sysadmins.
|
||||
|
||||
Design Rationale:
|
||||
-----------------
|
||||
|
||||
IPE was designed after evaluating existing integrity policy solutions
|
||||
in other operating systems and environments. In this survey of other
|
||||
implementations, there were a few pitfalls identified:
|
||||
|
||||
1. Policies were not readable by humans, usually requiring a binary
|
||||
intermediary format.
|
||||
2. A single, non-customizable action was implicitly taken as a default.
|
||||
3. Debugging the policy required manual steps to determine what rule was violated.
|
||||
4. Authoring a policy required an in-depth knowledge of the larger system,
|
||||
or operating system.
|
||||
|
||||
IPE attempts to avoid all of these pitfalls.
|
||||
|
||||
Policy
|
||||
~~~~~~
|
||||
|
||||
Plain Text
|
||||
^^^^^^^^^^
|
||||
|
||||
IPE's policy is plain-text. This introduces slightly larger policy files than
|
||||
other LSMs, but solves two major problems that occurs with some integrity policy
|
||||
solutions on other platforms.
|
||||
|
||||
The first issue is one of code maintenance and duplication. To author policies,
|
||||
the policy has to be some form of string representation (be it structured,
|
||||
through XML, JSON, YAML, etcetera), to allow the policy author to understand
|
||||
what is being written. In a hypothetical binary policy design, a serializer
|
||||
is necessary to write the policy from the human readable form, to the binary
|
||||
form, and a deserializer is needed to interpret the binary form into a data
|
||||
structure in the kernel.
|
||||
|
||||
Eventually, another deserializer will be needed to transform the binary from
|
||||
back into the human-readable form with as much information preserved. This is because a
|
||||
user of this access control system will have to keep a lookup table of a checksum
|
||||
and the original file itself to try to understand what policies have been deployed
|
||||
on this system and what policies have not. For a single user, this may be alright,
|
||||
as old policies can be discarded almost immediately after the update takes hold.
|
||||
For users that manage computer fleets in the thousands, if not hundreds of thousands,
|
||||
with multiple different operating systems, and multiple different operational needs,
|
||||
this quickly becomes an issue, as stale policies from years ago may be present,
|
||||
quickly resulting in the need to recover the policy or fund extensive infrastructure
|
||||
to track what each policy contains.
|
||||
|
||||
With now three separate serializer/deserializers, maintenance becomes costly. If the
|
||||
policy avoids the binary format, there is only one required serializer: from the
|
||||
human-readable form to the data structure in kernel, saving on code maintenance,
|
||||
and retaining operability.
|
||||
|
||||
The second issue with a binary format is one of transparency. As IPE controls
|
||||
access based on the trust of the system's resources, it's policy must also be
|
||||
trusted to be changed. This is done through signatures, resulting in needing
|
||||
signing as a process. Signing, as a process, is typically done with a
|
||||
high security bar, as anything signed can be used to attack integrity
|
||||
enforcement systems. It is also important that, when signing something, that
|
||||
the signer is aware of what they are signing. A binary policy can cause
|
||||
obfuscation of that fact; what signers see is an opaque binary blob. A
|
||||
plain-text policy, on the other hand, the signers see the actual policy
|
||||
submitted for signing.
|
||||
|
||||
Boot Policy
|
||||
~~~~~~~~~~~
|
||||
|
||||
IPE, if configured appropriately, is able to enforce a policy as soon as a
|
||||
kernel is booted and usermode starts. That implies some level of storage
|
||||
of the policy to apply the minute usermode starts. Generally, that storage
|
||||
can be handled in one of three ways:
|
||||
|
||||
1. The policy file(s) live on disk and the kernel loads the policy prior
|
||||
to an code path that would result in an enforcement decision.
|
||||
2. The policy file(s) are passed by the bootloader to the kernel, who
|
||||
parses the policy.
|
||||
3. There is a policy file that is compiled into the kernel that is
|
||||
parsed and enforced on initialization.
|
||||
|
||||
The first option has problems: the kernel reading files from userspace
|
||||
is typically discouraged and very uncommon in the kernel.
|
||||
|
||||
The second option also has problems: Linux supports a variety of bootloaders
|
||||
across its entire ecosystem - every bootloader would have to support this
|
||||
new methodology or there must be an independent source. It would likely
|
||||
result in more drastic changes to the kernel startup than necessary.
|
||||
|
||||
The third option is the best but it's important to be aware that the policy
|
||||
will take disk space against the kernel it's compiled in. It's important to
|
||||
keep this policy generalized enough that userspace can load a new, more
|
||||
complicated policy, but restrictive enough that it will not overauthorize
|
||||
and cause security issues.
|
||||
|
||||
The initramfs provides a way that this bootup path can be established. The
|
||||
kernel starts with a minimal policy, that trusts the initramfs only. Inside
|
||||
the initramfs, when the real rootfs is mounted, but not yet transferred to,
|
||||
it deploys and activates a policy that trusts the new root filesystem.
|
||||
This prevents overauthorization at any step, and keeps the kernel policy
|
||||
to a minimal size.
|
||||
|
||||
Startup
|
||||
^^^^^^^
|
||||
|
||||
Not every system, however starts with an initramfs, so the startup policy
|
||||
compiled into the kernel will need some flexibility to express how trust
|
||||
is established for the next phase of the bootup. To this end, if we just
|
||||
make the compiled-in policy a full IPE policy, it allows system builders
|
||||
to express the first stage bootup requirements appropriately.
|
||||
|
||||
Updatable, Rebootless Policy
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
As requirements change over time (vulnerabilities are found in previously
|
||||
trusted applications, keys roll, etcetera). Updating a kernel to change the
|
||||
meet those security goals is not always a suitable option, as updates are not
|
||||
always risk-free, and blocking a security update leaves systems vulnerable.
|
||||
This means IPE requires a policy that can be completely updated (allowing
|
||||
revocations of existing policy) from a source external to the kernel (allowing
|
||||
policies to be updated without updating the kernel).
|
||||
|
||||
Additionally, since the kernel is stateless between invocations, and reading
|
||||
policy files off the disk from kernel space is a bad idea(tm), then the
|
||||
policy updates have to be done rebootlessly.
|
||||
|
||||
To allow an update from an external source, it could be potentially malicious,
|
||||
so this policy needs to have a way to be identified as trusted. This is
|
||||
done via a signature chained to a trust source in the kernel. Arbitrarily,
|
||||
this is the ``SYSTEM_TRUSTED_KEYRING``, a keyring that is initially
|
||||
populated at kernel compile-time, as this matches the expectation that the
|
||||
author of the compiled-in policy described above is the same entity that can
|
||||
deploy policy updates.
|
||||
|
||||
Anti-Rollback / Anti-Replay
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Over time, vulnerabilities are found and trusted resources may not be
|
||||
trusted anymore. IPE's policy has no exception to this. There can be
|
||||
instances where a mistaken policy author deploys an insecure policy,
|
||||
before correcting it with a secure policy.
|
||||
|
||||
Assuming that as soon as the insecure policy is signed, and an attacker
|
||||
acquires the insecure policy, IPE needs a way to prevent rollback
|
||||
from the secure policy update to the insecure policy update.
|
||||
|
||||
Initially, IPE's policy can have a policy_version that states the
|
||||
minimum required version across all policies that can be active on
|
||||
the system. This will prevent rollback while the system is live.
|
||||
|
||||
.. WARNING::
|
||||
|
||||
However, since the kernel is stateless across boots, this policy
|
||||
version will be reset to 0.0.0 on the next boot. System builders
|
||||
need to be aware of this, and ensure the new secure policies are
|
||||
deployed ASAP after a boot to ensure that the window of
|
||||
opportunity is minimal for an attacker to deploy the insecure policy.
|
||||
|
||||
Implicit Actions:
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
The issue of implicit actions only becomes visible when you consider
|
||||
a mixed level of security bars across multiple operations in a system.
|
||||
For example, consider a system that has strong integrity guarantees
|
||||
over both the executable code, and specific *data files* on the system,
|
||||
that were critical to its function. In this system, three types of policies
|
||||
are possible:
|
||||
|
||||
1. A policy in which failure to match any rules in the policy results
|
||||
in the action being denied.
|
||||
2. A policy in which failure to match any rules in the policy results
|
||||
in the action being allowed.
|
||||
3. A policy in which the action taken when no rules are matched is
|
||||
specified by the policy author.
|
||||
|
||||
The first option could make a policy like this::
|
||||
|
||||
op=EXECUTE integrity_verified=YES action=ALLOW
|
||||
|
||||
In the example system, this works well for the executables, as all
|
||||
executables should have integrity guarantees, without exception. The
|
||||
issue becomes with the second requirement about specific data files.
|
||||
This would result in a policy like this (assuming each line is
|
||||
evaluated in order)::
|
||||
|
||||
op=EXECUTE integrity_verified=YES action=ALLOW
|
||||
|
||||
op=READ integrity_verified=NO label=critical_t action=DENY
|
||||
op=READ action=ALLOW
|
||||
|
||||
This is somewhat clear if you read the docs, understand the policy
|
||||
is executed in order and that the default is a denial; however, the
|
||||
last line effectively changes that default to an ALLOW. This is
|
||||
required, because in a realistic system, there are some unverified
|
||||
reads (imagine appending to a log file).
|
||||
|
||||
The second option, matching no rules results in an allow, is clearer
|
||||
for the specific data files::
|
||||
|
||||
op=READ integrity_verified=NO label=critical_t action=DENY
|
||||
|
||||
And, like the first option, falls short with the execution scenario,
|
||||
effectively needing to override the default::
|
||||
|
||||
op=EXECUTE integrity_verified=YES action=ALLOW
|
||||
op=EXECUTE action=DENY
|
||||
|
||||
op=READ integrity_verified=NO label=critical_t action=DENY
|
||||
|
||||
This leaves the third option. Instead of making users be clever
|
||||
and override the default with an empty rule, force the end-user
|
||||
to consider what the appropriate default should be for their
|
||||
scenario and explicitly state it::
|
||||
|
||||
DEFAULT op=EXECUTE action=DENY
|
||||
op=EXECUTE integrity_verified=YES action=ALLOW
|
||||
|
||||
DEFAULT op=READ action=ALLOW
|
||||
op=READ integrity_verified=NO label=critical_t action=DENY
|
||||
|
||||
Policy Debugging:
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
When developing a policy, it is useful to know what line of the policy
|
||||
is being violated to reduce debugging costs; narrowing the scope of the
|
||||
investigation to the exact line that resulted in the action. Some integrity
|
||||
policy systems do not provide this information, instead providing the
|
||||
information that was used in the evaluation. This then requires a correlation
|
||||
with the policy to evaluate what went wrong.
|
||||
|
||||
Instead, IPE just emits the rule that was matched. This limits the scope
|
||||
of the investigation to the exact policy line (in the case of a specific
|
||||
rule), or the section (in the case of a DEFAULT). This decreases iteration
|
||||
and investigation times when policy failures are observed while evaluating
|
||||
policies.
|
||||
|
||||
IPE's policy engine is also designed in a way that it makes it obvious to
|
||||
a human of how to investigate a policy failure. Each line is evaluated in
|
||||
the sequence that is written, so the algorithm is very simple to follow
|
||||
for humans to recreate the steps and could have caused the failure. In other
|
||||
surveyed systems, optimizations occur (sorting rules, for instance) when loading
|
||||
the policy. In those systems, it requires multiple steps to debug, and the
|
||||
algorithm may not always be clear to the end-user without reading the code first.
|
||||
|
||||
Simplified Policy:
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Finally, IPE's policy is designed for sysadmins, not kernel developers. Instead
|
||||
of covering individual LSM hooks (or syscalls), IPE covers operations. This means
|
||||
instead of sysadmins needing to know that the syscalls ``mmap``, ``mprotect``,
|
||||
``execve``, and ``uselib`` must have rules protecting them, they must simple know
|
||||
that they want to restrict code execution. This limits the amount of bypasses that
|
||||
could occur due to a lack of knowledge of the underlying system; whereas the
|
||||
maintainers of IPE, being kernel developers can make the correct choice to determine
|
||||
whether something maps to these operations, and under what conditions.
|
||||
|
||||
Implementation Notes
|
||||
--------------------
|
||||
|
||||
Anonymous Memory
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
Anonymous memory isn't treated any differently from any other access in IPE.
|
||||
When anonymous memory is mapped with ``+X``, it still comes into the ``file_mmap``
|
||||
or ``file_mprotect`` hook, but with a ``NULL`` file object. This is submitted to
|
||||
the evaluation, like any other file. However, all current trust properties will
|
||||
evaluate to false, as they are all file-based and the operation is not
|
||||
associated with a file.
|
||||
|
||||
.. WARNING::
|
||||
|
||||
This also occurs with the ``kernel_load_data`` hook, when the kernel is
|
||||
loading data from a userspace buffer that is not backed by a file. In this
|
||||
scenario all current trust properties will also evaluate to false.
|
||||
|
||||
Securityfs Interface
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The per-policy securityfs tree is somewhat unique. For example, for
|
||||
a standard securityfs policy tree::
|
||||
|
||||
MyPolicy
|
||||
|- active
|
||||
|- delete
|
||||
|- name
|
||||
|- pkcs7
|
||||
|- policy
|
||||
|- update
|
||||
|- version
|
||||
|
||||
The policy is stored in the ``->i_private`` data of the MyPolicy inode.
|
||||
|
||||
Tests
|
||||
-----
|
||||
|
||||
IPE has KUnit Tests for the policy parser. 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_NET=y
|
||||
CONFIG_AUDIT=y
|
||||
CONFIG_AUDITSYSCALL=y
|
||||
CONFIG_BLK_DEV_INITRD=y
|
||||
|
||||
CONFIG_SECURITY_IPE=y
|
||||
CONFIG_IPE_PROP_DM_VERITY=y
|
||||
CONFIG_IPE_PROP_DM_VERITY_SIGNATURE=y
|
||||
CONFIG_IPE_PROP_FS_VERITY=y
|
||||
CONFIG_IPE_PROP_FS_VERITY_BUILTIN_SIG=y
|
||||
CONFIG_SECURITY_IPE_KUNIT_TEST=y
|
||||
|
||||
In addition, IPE has a python based integration
|
||||
`test suite <https://github.com/microsoft/ipe/tree/test-suite>`_ that
|
||||
can test both user interfaces and enforcement functionalities.
|
||||
10
MAINTAINERS
10
MAINTAINERS
@@ -11166,6 +11166,16 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git
|
||||
F: security/integrity/
|
||||
F: security/integrity/ima/
|
||||
|
||||
INTEGRITY POLICY ENFORCEMENT (IPE)
|
||||
M: Fan Wu <wufan@linux.microsoft.com>
|
||||
L: linux-security-module@vger.kernel.org
|
||||
S: Supported
|
||||
T: git https://github.com/microsoft/ipe.git
|
||||
F: Documentation/admin-guide/LSM/ipe.rst
|
||||
F: Documentation/security/ipe.rst
|
||||
F: scripts/ipe/
|
||||
F: security/ipe/
|
||||
|
||||
INTEL 810/815 FRAMEBUFFER DRIVER
|
||||
M: Antonino Daplas <adaplas@gmail.com>
|
||||
L: linux-fbdev@vger.kernel.org
|
||||
|
||||
@@ -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 <linux/stat.h>
|
||||
@@ -324,6 +325,11 @@ static struct inode *bdev_alloc_inode(struct super_block *sb)
|
||||
if (!ei)
|
||||
return NULL;
|
||||
memset(&ei->bdev, 0, sizeof(ei->bdev));
|
||||
|
||||
if (security_bdev_alloc(&ei->bdev)) {
|
||||
kmem_cache_free(bdev_cachep, ei);
|
||||
return NULL;
|
||||
}
|
||||
return &ei->vfs_inode;
|
||||
}
|
||||
|
||||
@@ -333,6 +339,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)
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/jump_label.h>
|
||||
#include <linux/security.h>
|
||||
|
||||
#define DM_MSG_PREFIX "verity"
|
||||
|
||||
@@ -930,6 +931,41 @@ static void verity_io_hints(struct dm_target *ti, struct queue_limits *limits)
|
||||
limits->dma_alignment = limits->logical_block_size - 1;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SECURITY
|
||||
|
||||
static int verity_init_sig(struct dm_verity *v, const void *sig,
|
||||
size_t sig_size)
|
||||
{
|
||||
v->sig_size = sig_size;
|
||||
|
||||
if (sig) {
|
||||
v->root_digest_sig = kmemdup(sig, v->sig_size, GFP_KERNEL);
|
||||
if (!v->root_digest_sig)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void verity_free_sig(struct dm_verity *v)
|
||||
{
|
||||
kfree(v->root_digest_sig);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline int verity_init_sig(struct dm_verity *v, const void *sig,
|
||||
size_t sig_size)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void verity_free_sig(struct dm_verity *v)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SECURITY */
|
||||
|
||||
static void verity_dtr(struct dm_target *ti)
|
||||
{
|
||||
struct dm_verity *v = ti->private;
|
||||
@@ -949,6 +985,7 @@ static void verity_dtr(struct dm_target *ti)
|
||||
kfree(v->initial_hashstate);
|
||||
kfree(v->root_digest);
|
||||
kfree(v->zero_digest);
|
||||
verity_free_sig(v);
|
||||
|
||||
if (v->ahash_tfm) {
|
||||
static_branch_dec(&ahash_enabled);
|
||||
@@ -1418,6 +1455,13 @@ static int verity_ctr(struct dm_target *ti, unsigned int argc, char **argv)
|
||||
ti->error = "Root hash verification failed";
|
||||
goto bad;
|
||||
}
|
||||
|
||||
r = verity_init_sig(v, verify_args.sig, verify_args.sig_size);
|
||||
if (r < 0) {
|
||||
ti->error = "Cannot allocate root digest signature";
|
||||
goto bad;
|
||||
}
|
||||
|
||||
v->hash_per_block_bits =
|
||||
__fls((1 << v->hash_dev_block_bits) / v->digest_size);
|
||||
|
||||
@@ -1559,8 +1603,79 @@ int dm_verity_get_root_digest(struct dm_target *ti, u8 **root_digest, unsigned i
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SECURITY
|
||||
|
||||
#ifdef CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG
|
||||
|
||||
static int verity_security_set_signature(struct block_device *bdev,
|
||||
struct dm_verity *v)
|
||||
{
|
||||
/*
|
||||
* if the dm-verity target is unsigned, v->root_digest_sig will
|
||||
* be NULL, and the hook call is still required to let LSMs mark
|
||||
* the device as unsigned. This information is crucial for LSMs to
|
||||
* block operations such as execution on unsigned files
|
||||
*/
|
||||
return security_bdev_setintegrity(bdev,
|
||||
LSM_INT_DMVERITY_SIG_VALID,
|
||||
v->root_digest_sig,
|
||||
v->sig_size);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline int verity_security_set_signature(struct block_device *bdev,
|
||||
struct dm_verity *v)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG */
|
||||
|
||||
/*
|
||||
* Expose verity target's root hash and signature data to LSMs before resume.
|
||||
*
|
||||
* Returns 0 on success, or -ENOMEM if the system is out of memory.
|
||||
*/
|
||||
static int verity_preresume(struct dm_target *ti)
|
||||
{
|
||||
struct block_device *bdev;
|
||||
struct dm_verity_digest root_digest;
|
||||
struct dm_verity *v;
|
||||
int r;
|
||||
|
||||
v = ti->private;
|
||||
bdev = dm_disk(dm_table_get_md(ti->table))->part0;
|
||||
root_digest.digest = v->root_digest;
|
||||
root_digest.digest_len = v->digest_size;
|
||||
if (static_branch_unlikely(&ahash_enabled) && !v->shash_tfm)
|
||||
root_digest.alg = crypto_ahash_alg_name(v->ahash_tfm);
|
||||
else
|
||||
root_digest.alg = crypto_shash_alg_name(v->shash_tfm);
|
||||
|
||||
r = security_bdev_setintegrity(bdev, LSM_INT_DMVERITY_ROOTHASH, &root_digest,
|
||||
sizeof(root_digest));
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
r = verity_security_set_signature(bdev, v);
|
||||
if (r)
|
||||
goto bad;
|
||||
|
||||
return 0;
|
||||
|
||||
bad:
|
||||
|
||||
security_bdev_setintegrity(bdev, LSM_INT_DMVERITY_ROOTHASH, NULL, 0);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SECURITY */
|
||||
|
||||
static struct target_type verity_target = {
|
||||
.name = "verity",
|
||||
/* Note: the LSMs depend on the singleton and immutable features */
|
||||
.features = DM_TARGET_SINGLETON | DM_TARGET_IMMUTABLE,
|
||||
.version = {1, 10, 0},
|
||||
.module = THIS_MODULE,
|
||||
@@ -1571,6 +1686,9 @@ static struct target_type verity_target = {
|
||||
.prepare_ioctl = verity_prepare_ioctl,
|
||||
.iterate_devices = verity_iterate_devices,
|
||||
.io_hints = verity_io_hints,
|
||||
#ifdef CONFIG_SECURITY
|
||||
.preresume = verity_preresume,
|
||||
#endif /* CONFIG_SECURITY */
|
||||
};
|
||||
module_dm(verity);
|
||||
|
||||
|
||||
@@ -45,6 +45,10 @@ struct dm_verity {
|
||||
u8 *salt; /* salt: its size is salt_size */
|
||||
u8 *initial_hashstate; /* salted initial state, if shash_tfm is set */
|
||||
u8 *zero_digest; /* digest for a zero block */
|
||||
#ifdef CONFIG_SECURITY
|
||||
u8 *root_digest_sig; /* signature of the root digest */
|
||||
unsigned int sig_size; /* root digest signature size */
|
||||
#endif /* CONFIG_SECURITY */
|
||||
unsigned int salt_size;
|
||||
sector_t data_start; /* data offset in 512-byte sectors */
|
||||
sector_t hash_start; /* hash start in blocks */
|
||||
|
||||
14
fs/fcntl.c
14
fs/fcntl.c
@@ -125,8 +125,8 @@ void file_f_owner_release(struct file *file)
|
||||
}
|
||||
}
|
||||
|
||||
static void f_modown(struct file *filp, struct pid *pid, enum pid_type type,
|
||||
int force)
|
||||
void __f_setown(struct file *filp, struct pid *pid, enum pid_type type,
|
||||
int force)
|
||||
{
|
||||
struct fown_struct *f_owner;
|
||||
|
||||
@@ -142,19 +142,13 @@ static void f_modown(struct file *filp, struct pid *pid, enum pid_type type,
|
||||
|
||||
if (pid) {
|
||||
const struct cred *cred = current_cred();
|
||||
security_file_set_fowner(filp);
|
||||
f_owner->uid = cred->uid;
|
||||
f_owner->euid = cred->euid;
|
||||
}
|
||||
}
|
||||
write_unlock_irq(&f_owner->lock);
|
||||
}
|
||||
|
||||
void __f_setown(struct file *filp, struct pid *pid, enum pid_type type,
|
||||
int force)
|
||||
{
|
||||
security_file_set_fowner(filp);
|
||||
f_modown(filp, pid, type, force);
|
||||
}
|
||||
EXPORT_SYMBOL(__f_setown);
|
||||
|
||||
int f_setown(struct file *filp, int who, int force)
|
||||
@@ -196,7 +190,7 @@ EXPORT_SYMBOL(f_setown);
|
||||
|
||||
void f_delown(struct file *filp)
|
||||
{
|
||||
f_modown(filp, NULL, PIDTYPE_TGID, 1);
|
||||
__f_setown(filp, NULL, PIDTYPE_TGID, 1);
|
||||
}
|
||||
|
||||
pid_t f_getown(struct file *filp)
|
||||
|
||||
@@ -115,12 +115,12 @@ int ovl_copy_xattr(struct super_block *sb, const struct path *oldpath, struct de
|
||||
continue;
|
||||
|
||||
error = security_inode_copy_up_xattr(old, name);
|
||||
if (error < 0 && error != -EOPNOTSUPP)
|
||||
break;
|
||||
if (error == 1) {
|
||||
if (error == -ECANCELED) {
|
||||
error = 0;
|
||||
continue; /* Discard */
|
||||
}
|
||||
if (error < 0 && error != -EOPNOTSUPP)
|
||||
break;
|
||||
|
||||
if (is_posix_acl_xattr(name)) {
|
||||
error = ovl_copy_acl(OVL_FS(sb), oldpath, new, name);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <linux/cred.h>
|
||||
#include <linux/key.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/verification.h>
|
||||
|
||||
@@ -41,7 +42,11 @@ static struct key *fsverity_keyring;
|
||||
* @sig_size: size of signature in bytes, or 0 if no signature
|
||||
*
|
||||
* If the file includes a signature of its fs-verity file digest, verify it
|
||||
* against the certificates in the fs-verity keyring.
|
||||
* against the certificates in the fs-verity keyring. Note that signatures
|
||||
* are verified regardless of the state of the 'fsverity_require_signatures'
|
||||
* variable and the LSM subsystem relies on this behavior to help enforce
|
||||
* file integrity policies. Please discuss changes with the LSM list
|
||||
* (thank you!).
|
||||
*
|
||||
* Return: 0 on success (signature valid or not required); -errno on failure
|
||||
*/
|
||||
@@ -106,6 +111,17 @@ int fsverity_verify_signature(const struct fsverity_info *vi,
|
||||
return err;
|
||||
}
|
||||
|
||||
err = security_inode_setintegrity(inode,
|
||||
LSM_INT_FSVERITY_BUILTINSIG_VALID,
|
||||
signature,
|
||||
sig_size);
|
||||
|
||||
if (err) {
|
||||
fsverity_err(inode, "Error %d exposing file signature to LSMs",
|
||||
err);
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
* that as _n.
|
||||
*/
|
||||
|
||||
/* This counts to 12. Any more, it will return 13th argument. */
|
||||
#define __COUNT_ARGS(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _n, X...) _n
|
||||
#define COUNT_ARGS(X...) __COUNT_ARGS(, ##X, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
|
||||
/* This counts to 15. Any more, it will return 16th argument. */
|
||||
#define __COUNT_ARGS(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _n, X...) _n
|
||||
#define COUNT_ARGS(X...) __COUNT_ARGS(, ##X, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
|
||||
|
||||
/* Concatenate two parameters, but allow them to be expanded beforehand. */
|
||||
#define __CONCAT(a, b) a ## b
|
||||
|
||||
@@ -71,6 +71,9 @@ struct block_device {
|
||||
|
||||
struct partition_meta_info *bd_meta_info;
|
||||
int bd_writers;
|
||||
#ifdef CONFIG_SECURITY
|
||||
void *bd_security;
|
||||
#endif
|
||||
/*
|
||||
* keep this out-of-line as it's both big and not needed in the fast
|
||||
* path
|
||||
|
||||
135
include/linux/lsm_count.h
Normal file
135
include/linux/lsm_count.h
Normal file
@@ -0,0 +1,135 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2023 Google LLC.
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_LSM_COUNT_H
|
||||
#define __LINUX_LSM_COUNT_H
|
||||
|
||||
#include <linux/args.h>
|
||||
|
||||
#ifdef CONFIG_SECURITY
|
||||
|
||||
/*
|
||||
* Macros to count the number of LSMs enabled in the kernel at compile time.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Capabilities is enabled when CONFIG_SECURITY is enabled.
|
||||
*/
|
||||
#if IS_ENABLED(CONFIG_SECURITY)
|
||||
#define CAPABILITIES_ENABLED 1,
|
||||
#else
|
||||
#define CAPABILITIES_ENABLED
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_SECURITY_SELINUX)
|
||||
#define SELINUX_ENABLED 1,
|
||||
#else
|
||||
#define SELINUX_ENABLED
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_SECURITY_SMACK)
|
||||
#define SMACK_ENABLED 1,
|
||||
#else
|
||||
#define SMACK_ENABLED
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_SECURITY_APPARMOR)
|
||||
#define APPARMOR_ENABLED 1,
|
||||
#else
|
||||
#define APPARMOR_ENABLED
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_SECURITY_TOMOYO)
|
||||
#define TOMOYO_ENABLED 1,
|
||||
#else
|
||||
#define TOMOYO_ENABLED
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_SECURITY_YAMA)
|
||||
#define YAMA_ENABLED 1,
|
||||
#else
|
||||
#define YAMA_ENABLED
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_SECURITY_LOADPIN)
|
||||
#define LOADPIN_ENABLED 1,
|
||||
#else
|
||||
#define LOADPIN_ENABLED
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_SECURITY_LOCKDOWN_LSM)
|
||||
#define LOCKDOWN_ENABLED 1,
|
||||
#else
|
||||
#define LOCKDOWN_ENABLED
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_SECURITY_SAFESETID)
|
||||
#define SAFESETID_ENABLED 1,
|
||||
#else
|
||||
#define SAFESETID_ENABLED
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_BPF_LSM)
|
||||
#define BPF_LSM_ENABLED 1,
|
||||
#else
|
||||
#define BPF_LSM_ENABLED
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_SECURITY_LANDLOCK)
|
||||
#define LANDLOCK_ENABLED 1,
|
||||
#else
|
||||
#define LANDLOCK_ENABLED
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_IMA)
|
||||
#define IMA_ENABLED 1,
|
||||
#else
|
||||
#define IMA_ENABLED
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_EVM)
|
||||
#define EVM_ENABLED 1,
|
||||
#else
|
||||
#define EVM_ENABLED
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_SECURITY_IPE)
|
||||
#define IPE_ENABLED 1,
|
||||
#else
|
||||
#define IPE_ENABLED
|
||||
#endif
|
||||
|
||||
/*
|
||||
* There is a trailing comma that we need to be accounted for. This is done by
|
||||
* using a skipped argument in __COUNT_LSMS
|
||||
*/
|
||||
#define __COUNT_LSMS(skipped_arg, args...) COUNT_ARGS(args...)
|
||||
#define COUNT_LSMS(args...) __COUNT_LSMS(args)
|
||||
|
||||
#define MAX_LSM_COUNT \
|
||||
COUNT_LSMS( \
|
||||
CAPABILITIES_ENABLED \
|
||||
SELINUX_ENABLED \
|
||||
SMACK_ENABLED \
|
||||
APPARMOR_ENABLED \
|
||||
TOMOYO_ENABLED \
|
||||
YAMA_ENABLED \
|
||||
LOADPIN_ENABLED \
|
||||
LOCKDOWN_ENABLED \
|
||||
SAFESETID_ENABLED \
|
||||
BPF_LSM_ENABLED \
|
||||
LANDLOCK_ENABLED \
|
||||
IMA_ENABLED \
|
||||
EVM_ENABLED \
|
||||
IPE_ENABLED)
|
||||
|
||||
#else
|
||||
|
||||
#define MAX_LSM_COUNT 0
|
||||
|
||||
#endif /* CONFIG_SECURITY */
|
||||
|
||||
#endif /* __LINUX_LSM_COUNT_H */
|
||||
@@ -48,7 +48,7 @@ LSM_HOOK(int, 0, quota_on, struct dentry *dentry)
|
||||
LSM_HOOK(int, 0, syslog, int type)
|
||||
LSM_HOOK(int, 0, settime, const struct timespec64 *ts,
|
||||
const struct timezone *tz)
|
||||
LSM_HOOK(int, 1, vm_enough_memory, struct mm_struct *mm, long pages)
|
||||
LSM_HOOK(int, 0, vm_enough_memory, struct mm_struct *mm, long pages)
|
||||
LSM_HOOK(int, 0, bprm_creds_for_exec, struct linux_binprm *bprm)
|
||||
LSM_HOOK(int, 0, bprm_creds_from_file, struct linux_binprm *bprm, const struct file *file)
|
||||
LSM_HOOK(int, 0, bprm_check_security, struct linux_binprm *bprm)
|
||||
@@ -114,6 +114,7 @@ LSM_HOOK(int, 0, path_notify, const struct path *path, u64 mask,
|
||||
unsigned int obj_type)
|
||||
LSM_HOOK(int, 0, inode_alloc_security, struct inode *inode)
|
||||
LSM_HOOK(void, LSM_RET_VOID, inode_free_security, struct inode *inode)
|
||||
LSM_HOOK(void, LSM_RET_VOID, inode_free_security_rcu, void *inode_security)
|
||||
LSM_HOOK(int, -EOPNOTSUPP, inode_init_security, struct inode *inode,
|
||||
struct inode *dir, const struct qstr *qstr, struct xattr *xattrs,
|
||||
int *xattr_count)
|
||||
@@ -179,6 +180,8 @@ LSM_HOOK(void, LSM_RET_VOID, inode_getsecid, struct inode *inode, u32 *secid)
|
||||
LSM_HOOK(int, 0, inode_copy_up, struct dentry *src, struct cred **new)
|
||||
LSM_HOOK(int, -EOPNOTSUPP, inode_copy_up_xattr, struct dentry *src,
|
||||
const char *name)
|
||||
LSM_HOOK(int, 0, inode_setintegrity, const struct inode *inode,
|
||||
enum lsm_integrity_type type, const void *value, size_t size)
|
||||
LSM_HOOK(int, 0, kernfs_init_security, struct kernfs_node *kn_dir,
|
||||
struct kernfs_node *kn)
|
||||
LSM_HOOK(int, 0, file_permission, struct file *file, int mask)
|
||||
@@ -353,8 +356,7 @@ LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_inc, void)
|
||||
LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_dec, void)
|
||||
LSM_HOOK(void, LSM_RET_VOID, req_classify_flow, const struct request_sock *req,
|
||||
struct flowi_common *flic)
|
||||
LSM_HOOK(int, 0, tun_dev_alloc_security, void **security)
|
||||
LSM_HOOK(void, LSM_RET_VOID, tun_dev_free_security, void *security)
|
||||
LSM_HOOK(int, 0, tun_dev_alloc_security, void *security)
|
||||
LSM_HOOK(int, 0, tun_dev_create, void)
|
||||
LSM_HOOK(int, 0, tun_dev_attach_queue, void *security)
|
||||
LSM_HOOK(int, 0, tun_dev_attach, struct sock *sk, void *security)
|
||||
@@ -374,8 +376,7 @@ LSM_HOOK(int, 0, mptcp_add_subflow, struct sock *sk, struct sock *ssk)
|
||||
LSM_HOOK(int, 0, ib_pkey_access, void *sec, u64 subnet_prefix, u16 pkey)
|
||||
LSM_HOOK(int, 0, ib_endport_manage_subnet, void *sec, const char *dev_name,
|
||||
u8 port_num)
|
||||
LSM_HOOK(int, 0, ib_alloc_security, void **sec)
|
||||
LSM_HOOK(void, LSM_RET_VOID, ib_free_security, void *sec)
|
||||
LSM_HOOK(int, 0, ib_alloc_security, void *sec)
|
||||
#endif /* CONFIG_SECURITY_INFINIBAND */
|
||||
|
||||
#ifdef CONFIG_SECURITY_NETWORK_XFRM
|
||||
@@ -403,7 +404,6 @@ LSM_HOOK(int, 0, xfrm_decode_session, struct sk_buff *skb, u32 *secid,
|
||||
#ifdef CONFIG_KEYS
|
||||
LSM_HOOK(int, 0, key_alloc, struct key *key, const struct cred *cred,
|
||||
unsigned long flags)
|
||||
LSM_HOOK(void, LSM_RET_VOID, key_free, struct key *key)
|
||||
LSM_HOOK(int, 0, key_permission, key_ref_t key_ref, const struct cred *cred,
|
||||
enum key_need_perm need_perm)
|
||||
LSM_HOOK(int, 0, key_getsecurity, struct key *key, char **buffer)
|
||||
@@ -442,7 +442,6 @@ LSM_HOOK(int, 0, locked_down, enum lockdown_reason what)
|
||||
#ifdef CONFIG_PERF_EVENTS
|
||||
LSM_HOOK(int, 0, perf_event_open, struct perf_event_attr *attr, int type)
|
||||
LSM_HOOK(int, 0, perf_event_alloc, struct perf_event *event)
|
||||
LSM_HOOK(void, LSM_RET_VOID, perf_event_free, struct perf_event *event)
|
||||
LSM_HOOK(int, 0, perf_event_read, struct perf_event *event)
|
||||
LSM_HOOK(int, 0, perf_event_write, struct perf_event *event)
|
||||
#endif /* CONFIG_PERF_EVENTS */
|
||||
@@ -452,3 +451,10 @@ LSM_HOOK(int, 0, uring_override_creds, const struct cred *new)
|
||||
LSM_HOOK(int, 0, uring_sqpoll, void)
|
||||
LSM_HOOK(int, 0, uring_cmd, struct io_uring_cmd *ioucmd)
|
||||
#endif /* CONFIG_IO_URING */
|
||||
|
||||
LSM_HOOK(void, LSM_RET_VOID, initramfs_populated, void)
|
||||
|
||||
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_setintegrity, struct block_device *bdev,
|
||||
enum lsm_integrity_type type, const void *value, size_t size)
|
||||
|
||||
@@ -30,19 +30,47 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/rculist.h>
|
||||
#include <linux/xattr.h>
|
||||
#include <linux/static_call.h>
|
||||
#include <linux/unroll.h>
|
||||
#include <linux/jump_label.h>
|
||||
#include <linux/lsm_count.h>
|
||||
|
||||
union security_list_options {
|
||||
#define LSM_HOOK(RET, DEFAULT, NAME, ...) RET (*NAME)(__VA_ARGS__);
|
||||
#include "lsm_hook_defs.h"
|
||||
#undef LSM_HOOK
|
||||
void *lsm_func_addr;
|
||||
};
|
||||
|
||||
struct security_hook_heads {
|
||||
#define LSM_HOOK(RET, DEFAULT, NAME, ...) struct hlist_head NAME;
|
||||
#include "lsm_hook_defs.h"
|
||||
#undef LSM_HOOK
|
||||
/*
|
||||
* @key: static call key as defined by STATIC_CALL_KEY
|
||||
* @trampoline: static call trampoline as defined by STATIC_CALL_TRAMP
|
||||
* @hl: The security_hook_list as initialized by the owning LSM.
|
||||
* @active: Enabled when the static call has an LSM hook associated.
|
||||
*/
|
||||
struct lsm_static_call {
|
||||
struct static_call_key *key;
|
||||
void *trampoline;
|
||||
struct security_hook_list *hl;
|
||||
/* this needs to be true or false based on what the key defaults to */
|
||||
struct static_key_false *active;
|
||||
} __randomize_layout;
|
||||
|
||||
/*
|
||||
* Table of the static calls for each LSM hook.
|
||||
* Once the LSMs are initialized, their callbacks will be copied to these
|
||||
* tables such that the calls are filled backwards (from last to first).
|
||||
* This way, we can jump directly to the first used static call, and execute
|
||||
* all of them after. This essentially makes the entry point
|
||||
* dynamic to adapt the number of static calls to the number of callbacks.
|
||||
*/
|
||||
struct lsm_static_calls_table {
|
||||
#define LSM_HOOK(RET, DEFAULT, NAME, ...) \
|
||||
struct lsm_static_call NAME[MAX_LSM_COUNT];
|
||||
#include <linux/lsm_hook_defs.h>
|
||||
#undef LSM_HOOK
|
||||
} __packed __randomize_layout;
|
||||
|
||||
/**
|
||||
* struct lsm_id - Identify a Linux Security Module.
|
||||
* @lsm: name of the LSM, must be approved by the LSM maintainers
|
||||
@@ -51,53 +79,45 @@ struct security_hook_heads {
|
||||
* Contains the information that identifies the LSM.
|
||||
*/
|
||||
struct lsm_id {
|
||||
const char *name;
|
||||
u64 id;
|
||||
const char *name;
|
||||
u64 id;
|
||||
};
|
||||
|
||||
/*
|
||||
* Security module hook list structure.
|
||||
* For use with generic list macros for common operations.
|
||||
*
|
||||
* struct security_hook_list - Contents of a cacheable, mappable object.
|
||||
* @scalls: The beginning of the array of static calls assigned to this hook.
|
||||
* @hook: The callback for the hook.
|
||||
* @lsm: The name of the lsm that owns this hook.
|
||||
*/
|
||||
struct security_hook_list {
|
||||
struct hlist_node list;
|
||||
struct hlist_head *head;
|
||||
union security_list_options hook;
|
||||
const struct lsm_id *lsmid;
|
||||
struct lsm_static_call *scalls;
|
||||
union security_list_options hook;
|
||||
const struct lsm_id *lsmid;
|
||||
} __randomize_layout;
|
||||
|
||||
/*
|
||||
* Security blob size or offset data.
|
||||
*/
|
||||
struct lsm_blob_sizes {
|
||||
int lbs_cred;
|
||||
int lbs_file;
|
||||
int lbs_inode;
|
||||
int lbs_superblock;
|
||||
int lbs_ipc;
|
||||
int lbs_msg_msg;
|
||||
int lbs_task;
|
||||
int lbs_xattr_count; /* number of xattr slots in new_xattrs array */
|
||||
int lbs_cred;
|
||||
int lbs_file;
|
||||
int lbs_ib;
|
||||
int lbs_inode;
|
||||
int lbs_sock;
|
||||
int lbs_superblock;
|
||||
int lbs_ipc;
|
||||
int lbs_key;
|
||||
int lbs_msg_msg;
|
||||
int lbs_perf_event;
|
||||
int lbs_task;
|
||||
int lbs_xattr_count; /* number of xattr slots in new_xattrs array */
|
||||
int lbs_tun_dev;
|
||||
int lbs_bdev;
|
||||
};
|
||||
|
||||
/**
|
||||
* lsm_get_xattr_slot - Return the next available slot and increment the index
|
||||
* @xattrs: array storing LSM-provided xattrs
|
||||
* @xattr_count: number of already stored xattrs (updated)
|
||||
*
|
||||
* Retrieve the first available slot in the @xattrs array to fill with an xattr,
|
||||
* and increment @xattr_count.
|
||||
*
|
||||
* Return: The slot to fill in @xattrs if non-NULL, NULL otherwise.
|
||||
*/
|
||||
static inline struct xattr *lsm_get_xattr_slot(struct xattr *xattrs,
|
||||
int *xattr_count)
|
||||
{
|
||||
if (unlikely(!xattrs))
|
||||
return NULL;
|
||||
return &xattrs[(*xattr_count)++];
|
||||
}
|
||||
|
||||
/*
|
||||
* LSM_RET_VOID is used as the default value in LSM_HOOK definitions for void
|
||||
* LSM hooks (in include/linux/lsm_hook_defs.h).
|
||||
@@ -110,11 +130,11 @@ static inline struct xattr *lsm_get_xattr_slot(struct xattr *xattrs,
|
||||
* care of the common case and reduces the amount of
|
||||
* text involved.
|
||||
*/
|
||||
#define LSM_HOOK_INIT(HEAD, HOOK) \
|
||||
{ .head = &security_hook_heads.HEAD, .hook = { .HEAD = HOOK } }
|
||||
|
||||
extern struct security_hook_heads security_hook_heads;
|
||||
extern char *lsm_names;
|
||||
#define LSM_HOOK_INIT(NAME, HOOK) \
|
||||
{ \
|
||||
.scalls = static_calls_table.NAME, \
|
||||
.hook = { .NAME = HOOK } \
|
||||
}
|
||||
|
||||
extern void security_add_hooks(struct security_hook_list *hooks, int count,
|
||||
const struct lsm_id *lsmid);
|
||||
@@ -137,9 +157,6 @@ struct lsm_info {
|
||||
struct lsm_blob_sizes *blobs; /* Optional: for blob sharing. */
|
||||
};
|
||||
|
||||
extern struct lsm_info __start_lsm_info[], __end_lsm_info[];
|
||||
extern struct lsm_info __start_early_lsm_info[], __end_early_lsm_info[];
|
||||
|
||||
#define DEFINE_LSM(lsm) \
|
||||
static struct lsm_info __lsm_##lsm \
|
||||
__used __section(".lsm_info.init") \
|
||||
@@ -150,6 +167,28 @@ extern struct lsm_info __start_early_lsm_info[], __end_early_lsm_info[];
|
||||
__used __section(".early_lsm_info.init") \
|
||||
__aligned(sizeof(unsigned long))
|
||||
|
||||
extern int lsm_inode_alloc(struct inode *inode);
|
||||
/* DO NOT tamper with these variables outside of the LSM framework */
|
||||
extern char *lsm_names;
|
||||
extern struct lsm_static_calls_table static_calls_table __ro_after_init;
|
||||
extern struct lsm_info __start_lsm_info[], __end_lsm_info[];
|
||||
extern struct lsm_info __start_early_lsm_info[], __end_early_lsm_info[];
|
||||
|
||||
/**
|
||||
* lsm_get_xattr_slot - Return the next available slot and increment the index
|
||||
* @xattrs: array storing LSM-provided xattrs
|
||||
* @xattr_count: number of already stored xattrs (updated)
|
||||
*
|
||||
* Retrieve the first available slot in the @xattrs array to fill with an xattr,
|
||||
* and increment @xattr_count.
|
||||
*
|
||||
* Return: The slot to fill in @xattrs if non-NULL, NULL otherwise.
|
||||
*/
|
||||
static inline struct xattr *lsm_get_xattr_slot(struct xattr *xattrs,
|
||||
int *xattr_count)
|
||||
{
|
||||
if (unlikely(!xattrs))
|
||||
return NULL;
|
||||
return &xattrs[(*xattr_count)++];
|
||||
}
|
||||
|
||||
#endif /* ! __LINUX_LSM_HOOKS_H */
|
||||
|
||||
@@ -83,6 +83,18 @@ enum lsm_event {
|
||||
LSM_POLICY_CHANGE,
|
||||
};
|
||||
|
||||
struct dm_verity_digest {
|
||||
const char *alg;
|
||||
const u8 *digest;
|
||||
size_t digest_len;
|
||||
};
|
||||
|
||||
enum lsm_integrity_type {
|
||||
LSM_INT_DMVERITY_SIG_VALID,
|
||||
LSM_INT_DMVERITY_ROOTHASH,
|
||||
LSM_INT_FSVERITY_BUILTINSIG_VALID,
|
||||
};
|
||||
|
||||
/*
|
||||
* These are reasons that can be passed to the security_locked_down()
|
||||
* LSM hook. Lockdown reasons that protect kernel integrity (ie, the
|
||||
@@ -399,6 +411,9 @@ int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer
|
||||
void security_inode_getsecid(struct inode *inode, u32 *secid);
|
||||
int security_inode_copy_up(struct dentry *src, struct cred **new);
|
||||
int security_inode_copy_up_xattr(struct dentry *src, const char *name);
|
||||
int security_inode_setintegrity(const struct inode *inode,
|
||||
enum lsm_integrity_type type, const void *value,
|
||||
size_t size);
|
||||
int security_kernfs_init_security(struct kernfs_node *kn_dir,
|
||||
struct kernfs_node *kn);
|
||||
int security_file_permission(struct file *file, int mask);
|
||||
@@ -509,6 +524,11 @@ int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen);
|
||||
int security_locked_down(enum lockdown_reason what);
|
||||
int lsm_fill_user_ctx(struct lsm_ctx __user *uctx, u32 *uctx_len,
|
||||
void *val, size_t val_len, u64 id, u64 flags);
|
||||
int security_bdev_alloc(struct block_device *bdev);
|
||||
void security_bdev_free(struct block_device *bdev);
|
||||
int security_bdev_setintegrity(struct block_device *bdev,
|
||||
enum lsm_integrity_type type, const void *value,
|
||||
size_t size);
|
||||
#else /* CONFIG_SECURITY */
|
||||
|
||||
static inline int call_blocking_lsm_notifier(enum lsm_event event, void *data)
|
||||
@@ -634,7 +654,7 @@ static inline int security_settime64(const struct timespec64 *ts,
|
||||
|
||||
static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
|
||||
{
|
||||
return __vm_enough_memory(mm, pages, cap_vm_enough_memory(mm, pages));
|
||||
return __vm_enough_memory(mm, pages, !cap_vm_enough_memory(mm, pages));
|
||||
}
|
||||
|
||||
static inline int security_bprm_creds_for_exec(struct linux_binprm *bprm)
|
||||
@@ -1010,6 +1030,13 @@ static inline int security_inode_copy_up(struct dentry *src, struct cred **new)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int security_inode_setintegrity(const struct inode *inode,
|
||||
enum lsm_integrity_type type,
|
||||
const void *value, size_t size)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int security_kernfs_init_security(struct kernfs_node *kn_dir,
|
||||
struct kernfs_node *kn)
|
||||
{
|
||||
@@ -1483,6 +1510,23 @@ static inline int lsm_fill_user_ctx(struct lsm_ctx __user *uctx,
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
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_setintegrity(struct block_device *bdev,
|
||||
enum lsm_integrity_type type,
|
||||
const void *value, size_t size)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SECURITY */
|
||||
|
||||
#if defined(CONFIG_SECURITY) && defined(CONFIG_WATCH_QUEUE)
|
||||
@@ -2090,6 +2134,7 @@ struct dentry *securityfs_create_symlink(const char *name,
|
||||
const char *target,
|
||||
const struct inode_operations *iops);
|
||||
extern void securityfs_remove(struct dentry *dentry);
|
||||
extern void securityfs_recursive_remove(struct dentry *dentry);
|
||||
|
||||
#else /* CONFIG_SECURITYFS */
|
||||
|
||||
@@ -2256,4 +2301,12 @@ static inline int security_uring_cmd(struct io_uring_cmd *ioucmd)
|
||||
#endif /* CONFIG_SECURITY */
|
||||
#endif /* CONFIG_IO_URING */
|
||||
|
||||
#ifdef CONFIG_SECURITY
|
||||
extern void security_initramfs_populated(void);
|
||||
#else
|
||||
static inline void security_initramfs_populated(void)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_SECURITY */
|
||||
|
||||
#endif /* ! __LINUX_SECURITY_H */
|
||||
|
||||
36
include/linux/unroll.h
Normal file
36
include/linux/unroll.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2023 Google LLC.
|
||||
*/
|
||||
|
||||
#ifndef __UNROLL_H
|
||||
#define __UNROLL_H
|
||||
|
||||
#include <linux/args.h>
|
||||
|
||||
#define UNROLL(N, MACRO, args...) CONCATENATE(__UNROLL_, N)(MACRO, args)
|
||||
|
||||
#define __UNROLL_0(MACRO, args...)
|
||||
#define __UNROLL_1(MACRO, args...) __UNROLL_0(MACRO, args) MACRO(0, args)
|
||||
#define __UNROLL_2(MACRO, args...) __UNROLL_1(MACRO, args) MACRO(1, args)
|
||||
#define __UNROLL_3(MACRO, args...) __UNROLL_2(MACRO, args) MACRO(2, args)
|
||||
#define __UNROLL_4(MACRO, args...) __UNROLL_3(MACRO, args) MACRO(3, args)
|
||||
#define __UNROLL_5(MACRO, args...) __UNROLL_4(MACRO, args) MACRO(4, args)
|
||||
#define __UNROLL_6(MACRO, args...) __UNROLL_5(MACRO, args) MACRO(5, args)
|
||||
#define __UNROLL_7(MACRO, args...) __UNROLL_6(MACRO, args) MACRO(6, args)
|
||||
#define __UNROLL_8(MACRO, args...) __UNROLL_7(MACRO, args) MACRO(7, args)
|
||||
#define __UNROLL_9(MACRO, args...) __UNROLL_8(MACRO, args) MACRO(8, args)
|
||||
#define __UNROLL_10(MACRO, args...) __UNROLL_9(MACRO, args) MACRO(9, args)
|
||||
#define __UNROLL_11(MACRO, args...) __UNROLL_10(MACRO, args) MACRO(10, args)
|
||||
#define __UNROLL_12(MACRO, args...) __UNROLL_11(MACRO, args) MACRO(11, args)
|
||||
#define __UNROLL_13(MACRO, args...) __UNROLL_12(MACRO, args) MACRO(12, args)
|
||||
#define __UNROLL_14(MACRO, args...) __UNROLL_13(MACRO, args) MACRO(13, args)
|
||||
#define __UNROLL_15(MACRO, args...) __UNROLL_14(MACRO, args) MACRO(14, args)
|
||||
#define __UNROLL_16(MACRO, args...) __UNROLL_15(MACRO, args) MACRO(15, args)
|
||||
#define __UNROLL_17(MACRO, args...) __UNROLL_16(MACRO, args) MACRO(16, args)
|
||||
#define __UNROLL_18(MACRO, args...) __UNROLL_17(MACRO, args) MACRO(17, args)
|
||||
#define __UNROLL_19(MACRO, args...) __UNROLL_18(MACRO, args) MACRO(18, args)
|
||||
#define __UNROLL_20(MACRO, args...) __UNROLL_19(MACRO, args) MACRO(19, args)
|
||||
|
||||
#endif /* __UNROLL_H */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user