[PATCH v4 0/3] audit: add support for openat2
by Richard Guy Briggs
The openat2(2) syscall was added in v5.6. Add support for openat2 to the
audit syscall classifier and for recording openat2 parameters that cannot
be captured in the syscall parameters of the SYSCALL record.
Supporting userspace code can be found in
https://github.com/rgbriggs/audit-userspace/tree/ghau-openat2
Supporting test case can be found in
https://github.com/linux-audit/audit-testsuite/pull/103
Changelog:
v4:
- change filename include/linux/auditscm.h to auditsc_classmacros.h to avoid socket association
v3:
- re-add commit descriptions that somehow got dropped
- add new file to MAINTAINERS
v2:
- add include/linux/auditscm.h for audit syscall class macros due to syscall redefinition warnings:
arch/x86/ia32/audit.c:3:
./include/linux/audit.h:12,
./include/linux/sched.h:22,
./include/linux/seccomp.h:21,
./arch/x86/include/asm/seccomp.h:5,
./arch/x86/include/asm/unistd.h:20,
./arch/x86/include/generated/uapi/asm/unistd_64.h:4: warning: "__NR_read" redefined #define __NR_read 0
...
./arch/x86/include/generated/uapi/asm/unistd_64.h:338: warning: "__NR_rseq" redefined #define __NR_rseq 334
previous:
arch/x86/ia32/audit.c:2:
./arch/x86/include/generated/uapi/asm/unistd_32.h:7: note: this is the location of the previous definition #define __NR_read 3
...
./arch/x86/include/generated/uapi/asm/unistd_32.h:386: note: this is the location of the previous definition #define __NR_rseq 386
Richard Guy Briggs (3):
audit: replace magic audit syscall class numbers with macros
audit: add support for the openat2 syscall
audit: add OPENAT2 record to list how
MAINTAINERS | 1 +
arch/alpha/kernel/audit.c | 10 ++++++----
arch/ia64/kernel/audit.c | 10 ++++++----
arch/parisc/kernel/audit.c | 10 ++++++----
arch/parisc/kernel/compat_audit.c | 11 ++++++----
arch/powerpc/kernel/audit.c | 12 ++++++-----
arch/powerpc/kernel/compat_audit.c | 13 +++++++-----
arch/s390/kernel/audit.c | 12 ++++++-----
arch/s390/kernel/compat_audit.c | 13 +++++++-----
arch/sparc/kernel/audit.c | 12 ++++++-----
arch/sparc/kernel/compat_audit.c | 13 +++++++-----
arch/x86/ia32/audit.c | 13 +++++++-----
arch/x86/kernel/audit_64.c | 10 ++++++----
fs/open.c | 2 ++
include/linux/audit.h | 11 ++++++++++
include/linux/auditsc_classmacros.h | 24 ++++++++++++++++++++++
include/uapi/linux/audit.h | 1 +
kernel/audit.h | 2 ++
kernel/auditsc.c | 31 +++++++++++++++++++++++------
lib/audit.c | 14 ++++++++-----
lib/compat_audit.c | 15 +++++++++-----
21 files changed, 169 insertions(+), 71 deletions(-)
create mode 100644 include/linux/auditsc_classmacros.h
--
2.27.0
2 years, 10 months
[RFC PATCH v1] audit: log AUDIT_TIME_* records only from rules
by Richard Guy Briggs
AUDIT_TIME_* events are generated when there are syscall rules present that are
not related to time keeping. This will produce noisy log entries that could
flood the logs and hide events we really care about.
Rather than immediately produce the AUDIT_TIME_* records, store the data and
log it at syscall exit time respecting the filter rules.
Please see https://bugzilla.redhat.com/show_bug.cgi?id=1991919
Signed-off-by: Richard Guy Briggs <rgb(a)redhat.com>
---
Note: This is a quick and dirty proof-of-concept. If this approach of
storing the values in the audit_context for later filtering is
acceptable I'll clean up the patch (re-name functions) and re-submit.
kernel/audit.h | 6 ++++++
kernel/auditsc.c | 29 +++++++++++++++++++++++++----
2 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/kernel/audit.h b/kernel/audit.h
index 3b64a97f6091..25d63731b0e0 100644
--- a/kernel/audit.h
+++ b/kernel/audit.h
@@ -196,6 +196,12 @@ struct audit_context {
struct {
char *name;
} module;
+ struct {
+ struct audit_ntp_data data;
+ } ntp;
+ struct {
+ struct timespec64 injoffset;
+ } tk;
};
int fds[2];
struct audit_proctitle proctitle;
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 6efb0bb909d0..8983790ad86a 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1210,11 +1210,18 @@ static void audit_log_fcaps(struct audit_buffer *ab, struct audit_names *name)
from_kuid(&init_user_ns, name->fcap.rootid));
}
+void __audit_ntp_log_(const struct audit_ntp_data *ad);
+
static void show_special(struct audit_context *context, int *call_panic)
{
struct audit_buffer *ab;
int i;
+ if (context->type == AUDIT_TIME_ADJNTPVAL) {
+ __audit_ntp_log_(&context->ntp.data);
+ return;
+ }
+
ab = audit_log_start(context, GFP_KERNEL, context->type);
if (!ab)
return;
@@ -1324,6 +1331,11 @@ static void show_special(struct audit_context *context, int *call_panic)
audit_log_format(ab, "(null)");
break;
+ case AUDIT_TIME_INJOFFSET:
+ audit_log_format(ab, "sec=%lli nsec=%li",
+ (long long)context->tk.injoffset.tv_sec,
+ context->tk.injoffset.tv_nsec);
+ break;
}
audit_log_end(ab);
}
@@ -2571,9 +2583,18 @@ void __audit_fanotify(unsigned int response)
void __audit_tk_injoffset(struct timespec64 offset)
{
- audit_log(audit_context(), GFP_KERNEL, AUDIT_TIME_INJOFFSET,
- "sec=%lli nsec=%li",
- (long long)offset.tv_sec, offset.tv_nsec);
+ struct audit_context *context = audit_context();
+
+ context->type = AUDIT_TIME_INJOFFSET;
+ memcpy(&context->tk.injoffset, &offset, sizeof(offset));
+}
+
+void __audit_ntp_log(const struct audit_ntp_data *ad)
+{
+ struct audit_context *context = audit_context();
+
+ context->type = AUDIT_TIME_ADJNTPVAL;
+ memcpy(&context->ntp.data, ad, sizeof(*ad));
}
static void audit_log_ntp_val(const struct audit_ntp_data *ad,
@@ -2588,7 +2609,7 @@ static void audit_log_ntp_val(const struct audit_ntp_data *ad,
"op=%s old=%lli new=%lli", op, val->oldval, val->newval);
}
-void __audit_ntp_log(const struct audit_ntp_data *ad)
+void __audit_ntp_log_(const struct audit_ntp_data *ad)
{
audit_log_ntp_val(ad, "offset", AUDIT_NTP_OFFSET);
audit_log_ntp_val(ad, "freq", AUDIT_NTP_FREQ);
--
2.27.0
2 years, 11 months
[PATCH] audit: correct the AUDIT_DM_CTRL and AUDIT_DM_EVENT numbering
by Paul Moore
Due to conflict with the audit and SELinux trees the device mapper
audit record types need to be renumbered before landing in Linus'
tree.
Link: https://lore.kernel.org/lkml/CAHC9VhTLmzDQPqsj+vyBNua1X13UK_tTcixKZ7WWYEq...
Fixes: c1d7fa96e74b ("dm: introduce audit event module for device mapper")
Signed-off-by: Paul Moore <paul(a)paul-moore.com>
---
include/uapi/linux/audit.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index 6650ab6def2a..809e4c2041b3 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -118,8 +118,8 @@
#define AUDIT_TIME_ADJNTPVAL 1333 /* NTP value adjustment */
#define AUDIT_BPF 1334 /* BPF subsystem */
#define AUDIT_EVENT_LISTENER 1335 /* Task joined multicast read socket */
-#define AUDIT_DM_CTRL 1336 /* Device Mapper target control */
-#define AUDIT_DM_EVENT 1337 /* Device Mapper events */
+#define AUDIT_DM_CTRL 1338 /* Device Mapper target control */
+#define AUDIT_DM_EVENT 1339 /* Device Mapper events */
#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
3 years
[RFC PATCH v7 00/16] Integrity Policy Enforcement (IPE)
by deven.desai@linux.microsoft.com
From: Deven Bowers <deven.desai(a)linux.microsoft.com>
Overview:
---------
IPE is a Linux Security Module which takes a complimentary approach to
access control. Whereas existing systems approach use labels or paths
which control access to a resource, IPE controls access to a resource
based on the system's trust of said resource.
Trust requirements are established via IPE's policy, sourcing multiple
different implementations within the kernel to build a cohesive trust
model, based on how the system was built.
Trust, with respect to computing, is a concept that designates a set
of entities who will endorse a set of resources as non-malicious.
Traditionally, this is done via signatures, which is the act of endorsing
a resource.
Integrity, on the other hand, is the concept of ensuring that a resource
has not been modified since a point of time. This is typically done through
cryptographic hashes or signatures.
Trust and integrity are very closely tied together concepts, as integrity
is the way you can prove trust for a resource; otherwise it could have
been modified by an entity who is untrusted.
IPE provides a way for a user to express trust requirements of resources,
by using pre-existing systems which provide the integrity half of the
equation.
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.
Instead, IPE supports the PKI Trust Model, which generally designates a
set of entities that provide a measure absolute trust.
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.
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 properties: "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, 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:
policy_name="AllowSignedAndInitial" policy_version=0.0.0
DEFAULT action=DENY
op=EXECUTE dmverity_roothash=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="AllowSignedAndInitial" policy_version=0.0.0
DEFAULT action=DENY
op=EXECUTE dmverity_roothash=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" -binary -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: The securityfs commands 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. This includes architectural block diagrams.
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.
However, there is a patchset that is looking to address this gap [1].
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/all/20211012192410.2356090-1-mic@digikod.net/
FAQ:
----
Q: What's the difference between other LSMs which provide trust-based
access control, for instance, IMA?
A: IMA is a fantastic option when needing measurement in addition to the
trust-based access model. All of IMA is centered around their measurement
hashes, so you save time when doing both actions. IPE, on the other hand,
is a highly performant system that does not rely (and explicitly prohibits),
generating its own integrity mechanisms - separating measurement and access
control. Simply put, IPE provides only the enforcement of trust, while other
subsystems provide the integrity guarantee that IPE needs to determine the
trust of a resource. IMA provides both the integrity guarantee, the
enforcement of trust, and a whole host of other features that may not be
needed.
Changelog:
----------
Changes since v1:
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.
Changes since v2:
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.
Changes since v3:
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.
Changes since v4:
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.
Changes since v5:
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.
Changes since v6:
* 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
Deven Bowers (14):
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 trust audit message definitions
ipe: add auditing support
ipe: add permissive toggle
ipe: introduce 'boot_verified' as a trust provider
fs|dm-verity: add block_dev LSM blob and submit dm-verity data
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|security: add security hooks to fsverity digest and signature
ipe: enable support for fs-verity as a trust provider
Documentation/admin-guide/LSM/index.rst | 1 +
Documentation/admin-guide/LSM/ipe.rst | 587 ++++++++++
.../admin-guide/kernel-parameters.txt | 12 +
Documentation/security/index.rst | 1 +
Documentation/security/ipe.rst | 339 ++++++
MAINTAINERS | 9 +
block/bdev.c | 7 +
drivers/md/dm-verity-target.c | 20 +-
drivers/md/dm-verity-verify-sig.c | 16 +-
drivers/md/dm-verity-verify-sig.h | 10 +-
fs/verity/open.c | 12 +
fs/verity/signature.c | 5 +-
include/asm-generic/vmlinux.lds.h | 16 +
include/linux/blk_types.h | 1 +
include/linux/device-mapper.h | 3 +
include/linux/fsverity.h | 3 +
include/linux/lsm_hook_defs.h | 5 +
include/linux/lsm_hooks.h | 12 +
include/linux/security.h | 22 +
include/uapi/linux/audit.h | 4 +
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 | 100 ++
security/ipe/Makefile | 39 +
security/ipe/audit.c | 304 +++++
security/ipe/audit.h | 41 +
security/ipe/ctx.c | 381 ++++++
security/ipe/ctx.h | 43 +
security/ipe/ctx_test.c | 732 ++++++++++++
security/ipe/eval.c | 237 ++++
security/ipe/eval.h | 57 +
security/ipe/fs.c | 327 ++++++
security/ipe/fs.h | 13 +
security/ipe/hooks.c | 328 ++++++
security/ipe/hooks.h | 56 +
security/ipe/ipe.c | 143 +++
security/ipe/ipe.h | 27 +
security/ipe/ipe_parser.h | 59 +
security/ipe/modules.c | 134 +++
security/ipe/modules.h | 17 +
security/ipe/modules/Kconfig | 66 ++
security/ipe/modules/Makefile | 12 +
security/ipe/modules/boot_verified.c | 24 +
security/ipe/modules/dmverity_roothash.c | 80 ++
security/ipe/modules/dmverity_signature.c | 25 +
security/ipe/modules/fsverity_digest.c | 80 ++
security/ipe/modules/fsverity_signature.c | 33 +
security/ipe/modules/ipe_module.h | 40 +
security/ipe/parsers.c | 139 +++
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 | 299 +++++
security/ipe/policyfs.c | 528 +++++++++
security/security.c | 76 +-
63 files changed, 7069 insertions(+), 18 deletions(-)
create mode 100644 Documentation/admin-guide/LSM/ipe.rst
create mode 100644 Documentation/security/ipe.rst
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.33.0
3 years
[PATCH v30 00/28] LSM: Module stacking for AppArmor
by Casey Schaufler
This patchset provides the changes required for
the AppArmor security module to stack safely with any other.
v30: Rebase to 5.16-rc1
Replace the integrity sub-system reuse of the audit
subsystem event matching functions with IMA specific
functions. This is done because audit needs to maintain
information about multiple security modules in audit
rules while IMA to restricts the information to a single
security module.
The binder hooks have been changed and are no longer
called with sufficient information to identify the
interface_lsm. Pass that information in the binder
message, and use that in the compatibility decision.
Refactor the audit changes.
v29: Rebase to 5.15-rc1
Rework the supplimental audit record generation. Attach
a list of supplimental data to the audit_buffer and
generate the auxiliary records as needed on event end.
This should be usable for other auxiliary data, such as
container IDs. There is other ongoing audit work that
will require integration with this.
v28: Rebase to 5.14-rc2
Provide IMA rules bounds checking (patch 04)
Quote contexts in MAC_TASK_CONTEXTS and MAC_OBJ_CONTEXTS
audit records because of AppArmor's use of '=' in context
values. (patch 22,23)
v27: Fixes for landlock (patch 02)
Rework the subject audit record generation. This version is
simpler and reflects feedback from Paul Moore. (patch 22)
v26: Rebase to 5.13-rc1
Include the landlock security module.
Accomodate change from security_task_getsecid() to
security_task_getsecid_obj() and security_task_getsecid_subj().
v25: Rebase to 5.12-rc2
Incorporate feedback from v24
- The IMA team suggested improvements to the integrity rule
processing.
v24: Rebase to 5.11-rc1
Incorporate feedback from v23
- Address the IMA team's concerns about "label collisions".
A label collision occurs when there is ambiguity about
which of multiple LSMs is being targeted in the definition
of an integrity check rule. A system with Smack and
AppArmor would be unable to distinguish which LSM is
important to an integrity rule referrencing the label
"unconfined" as that label is meaningful to both.
Provide a boot option to specify which LSM will be used in
IMA rules when multiple LSMs are present. (patch 04)
Pull LSM "slot" identification from later audit patches in
in support of this (patch 03).
- Pick up a few audit events that need to include supplimental
subject context records that had been missed in the
previous version.
v23: Rebase to 5.10-rc4
Incorporate feedback from v22
- Change /proc/*/attr/display to /proc/*/attr/interface_lsm to
make the purpose clearer. (patch 0012)
- Include ABI documentation. (patch 0012, 0022)
- Introduce LSM documentation updates with the patches where
the interfaces are added rather than at the end. (patch 0012, 0022)
Include more maintainers and mail lists in To: and Cc: directives.
v22: Rebase to 5.10-rc1
v21: Rebase to 5.9-rc4
Incorporate feedback from v20
- Further revert UDS SO_PEERSEC to use scaffolding around
the interfaces that use lsmblobs and store only a single
secid. The possibility of multiple security modules
requiring data here is still a future problem.
- Incorporate Richard Guy Briggs' non-syscall auxiliary
records patch (patch 0019-0021) in place of my "supplimental"
records implementation. [I'm not sure I've given proper
attestation. I will correct as appropriate]
v20: Rebase to 5.9-rc1
Change the BPF security module to use the lsmblob data. (patch 0002)
Repair length logic in subject label processing (patch 0015)
Handle -EINVAL from the empty BPF setprocattr hook (patch 0020)
Correct length processing in append_ctx() (patch 0022)
v19: Rebase to 5.8-rc6
Incorporate feedback from v18
- Revert UDS SO_PEERSEC implementation to use lsmblobs
directly, rather than allocating as needed. The correct
treatment of out-of-memory conditions in the later case
is difficult to define. (patch 0005)
- Use a size_t in append_ctx() (patch 0021)
- Fix a memory leak when creating compound contexts. (patch 0021)
Fix build error when CONFIG_SECURITY isn't set (patch 0013)
Fix build error when CONFIG_SECURITY isn't set (patch 0020)
Fix build error when CONFIG_SECURITY isn't set (patch 0021)
v18: Rebase to 5.8-rc3
Incorporate feedback from v17
- Null pointer checking in UDS (patch 0005)
Match changes in IMA code (patch 0012)
Fix the behavior of LSM context supplimental audit
records so that there's always exactly one when it's
appropriate for there to be one. This is a substantial
change that requires extention of the audit_context beyond
syscall events. (patch 0020)
v17: Rebase to 5.7-rc4
v16: Rebase to 5.6
Incorporate feedback from v15 - Thanks Stephen, Mimi and Paul
- Generally improve commit messages WRT scaffolding
- Comment ima_lsm_isset() (patch 0002)
- Some question may remain on IMA warning (patch 0002)
- Mark lsm_slot as __lsm_ro_after_init not __init_data (patch 0002)
- Change name of lsmblob variable in ima_match_rules() (patch 0003)
- Instead of putting a struct lsmblob into the unix_skb_parms
structure put a pointer to an allocated instance. There is
currently only space for 5 u32's in unix_skb_parms and it is
likely to get even tighter. Fortunately, the lifecycle
management of the allocated lsmblob is simple. (patch 0005)
- Dropped Acks due to the above change (patch 0005)
- Improved commentary on secmark labeling scaffolding. (patch 0006)
- Reduced secmark related labeling scaffolding. (patch 0006)
- Replace use of the zeroth entry of an lsmblob in scaffolding
with a function lsmblob_value() to hopefully make it less
obscure. (patch 0006)
- Convert security_secmark_relabel_packet to use lsmblob as
this reduces much of the most contentious scaffolding. (patch 0006)
- Dropped Acks due to the above change (patch 0006)
- Added BUILD_BUG_ON() for CIPSO tag 6. (patch 0018)
- Reworked audit subject information. Instead of adding fields in
the middle of existing records add a new record to the event. When
a separate record is required use subj="?". (patch 0020)
- Dropped Acks due to the above change (patch 0020)
- Reworked audit object information. Instead of adding fields in
the middle of existing records add a new record to the event. When
a separate record is required use obj="?". (patch 0021)
- Dropped Acks due to the above change (patch 0021)
- Enhanced documentation (patch 0022)
- Removed unnecessary error code check in security_getprocattr()
(patch 0021)
v15: Rebase to 5.6-rc1
- Revise IMA data use (patch 0002)
Incorporate feedback from v14
- Fix lockdown module registration naming (patch 0002)
- Revise how /proc/self/attr/context is gathered. (patch 0022)
- Revise access modes on /proc/self/attr/context. (patch 0022)
- Revise documentation on LSM external interfaces. (patch 0022)
v14: Rebase to 5.5-rc5
Incorporate feedback from v13
- Use an array of audit rules (patch 0002)
- Significant change, removed Acks (patch 0002)
- Remove unneeded include (patch 0013)
- Use context.len correctly (patch 0015)
- Reorder code to be more sensible (patch 0016)
- Drop SO_PEERCONTEXT as it's not needed yet (patch 0023)
v13: Rebase to 5.5-rc2
Incorporate feedback from v12
- Print lsmblob size with %z (Patch 0002)
- Convert lockdown LSM initialization. (Patch 0002)
- Restore error check in nft_secmark_compute_secid (Patch 0006)
- Correct blob scaffolding in ima_must_appraise() (Patch 0009)
- Make security_setprocattr() clearer (Patch 0013)
- Use lsm_task_display more widely (Patch 0013)
- Use passed size in lsmcontext_init() (Patch 0014)
- Don't add a smack_release_secctx() hook (Patch 0014)
- Don't print warning in security_release_secctx() (Patch 0014)
- Don't duplicate the label in nfs4_label_init_security() (Patch 0016)
- Remove reviewed-by as code has significant change (Patch 0016)
- Send the entire lsmblob for Tag 6 (Patch 0019)
- Fix description of socket_getpeersec_stream parameters (Patch 0023)
- Retain LSMBLOB_FIRST. What was I thinking? (Patch 0023)
- Add compound context to LSM documentation (Patch 0023)
v12: Rebase to 5.5-rc1
Fixed a couple of incorrect contractions in the text.
v11: Rebase to 5.4-rc6
Incorporate feedback from v10
- Disambiguate reading /proc/.../attr/display by restricting
all use of the interface to the current process.
- Fix a merge error in AppArmor's display attribute check
v10: Ask the security modules if the display can be changed.
v9: There is no version 9
v8: Incorporate feedback from v7
- Minor clean-up in display value management
- refactor "compound" context creation to use a common
append_ctx() function.
v7: Incorporate feedback from v6
- Make setting the display a privileged operation. The
availability of compound contexts reduces the need for
setting the display.
v6: Incorporate feedback from v5
- Add subj_<lsm>= and obj_<lsm>= fields to audit records
- Add /proc/.../attr/context to get the full context in
lsmname\0value\0... format as suggested by Simon McVittie
- Add SO_PEERCONTEXT for getsockopt() to get the full context
in the same format, also suggested by Simon McVittie.
- Add /sys/kernel/security/lsm_display_default to provide
the display default value.
v5: Incorporate feedback from v4
- Initialize the lsmcontext in security_secid_to_secctx()
- Clear the lsmcontext in all security_release_secctx() cases
- Don't use the "display" on strictly internal context
interfaces.
- The SELinux binder hooks check for cases where the context
"display" isn't compatible with SELinux.
v4: Incorporate feedback from v3
- Mark new lsm_<blob>_alloc functions static
- Replace the lsm and slot fields of the security_hook_list
with a pointer to a LSM allocated lsm_id structure. The
LSM identifies if it needs a slot explicitly. Use the
lsm_id rather than make security_add_hooks return the
slot value.
- Validate slot values used in security.c
- Reworked the "display" process attribute handling so that
it works right and doesn't use goofy list processing.
- fix display value check in dentry_init_security
- Replace audit_log of secids with '?' instead of deleting
the audit log
v3: Incorporate feedback from v2
- Make lsmblob parameter and variable names more
meaningful, changing "le" and "l" to "blob".
- Improve consistency of constant naming.
- Do more sanity checking during LSM initialization.
- Be a bit clearer about what is temporary scaffolding.
- Rather than clutter security_getpeersec_dgram with
otherwise unnecessary checks remove the apparmor
stub, which does nothing useful.
Patch 01 separates the audit rule processing from the
integrity rule processing. They were never really the
same, but void pointers could hide that. The changes
following use the rule pointers differently in audit
and IMA, so keeping the code common is not a good idea.
Patch 02 moves management of the sock security blob
from the individual modules to the infrastructure.
Patches 03-04 introduce a structure "lsmblob" that will gradually
replace the "secid" as a shorthand for security module information.
At this point lsmblob contains an array of u32 secids, one "slot"
for each of the security modules compiled into the kernel that
used secids. A "slot" is allocated when a security module requests
one.
Patch 05 provides mechanism for the IMA subsystem to identify
explicitly which LSM is subject to IMA policy. This includes
a boot option for specifying the default and an additional option
in IMA rules "lsm=".
Patches 06-15 change LSM interfaces to use the lsmblob instead
of secids. It is important that the lsmblob be a fixed size entity
that does not have to be allocated. Several of the places
where it is used would have performance and/or locking
issues with dynamic allocation.
Patch 15 provides a mechanism for a process to identify which
security module's hooks should be used when displaying or
converting a security context string. A new interface
/proc/self/attr/interface_lsm contains the name of the security
module to show. Reading from this file will present the name of
the module, while writing to it will set the value. Only names
of active security modules are accepted. Internally, the name
is translated to the appropriate "slot" number for the module
which is then stored in the task security blob. Setting the
display requires that all modules using the /proc interfaces
allow the transition. The interface LSM of other processess
can be neither read nor written. All suggested cases for
reading the interface LSM of a different process have race
conditions.
Patch 16 Starts the process of changing how a security
context is represented. Since it is possible for a
security context to have been generated by more than one
security module it is now necessary to note which module
created a security context so that the correct "release"
hook can be called. There are several places where the
module that created a security context cannot be inferred.
This is achieved by introducing a "lsmcontext" structure
which contains the context string, its length and the
"slot" number of the security module that created it.
The security_release_secctx() interface is changed,
replacing the (string,len) pointer pair with a lsmcontext
pointer.
Patches 17-18 convert the security interfaces from
(string,len) pointer pairs to a lsmcontext pointer.
The slot number identifying the creating module is
added by the infrastructure. Where the security context
is stored for extended periods the data type is changed.
The Netlabel code is converted to save lsmblob structures
instead of secids in Patch 19. This is not strictly
necessary as there can only be one security module that
uses Netlabel at this point. Using a lsmblob is much
cleaner, as the interfaces that use the data have all
been converted.
Patch 20 adds checks to the binder hooks which verify
that both ends of a transaction use the same interface LSM.
Patch 21 adds a parameter to security_secid_to_secctx()
that indicates which of the security modules should be used
to provide the context.
Patches 22-24 provide mechanism to keeping a list of auxiliary
record data in an audit_buffer. The list is read when the
audit record is ended, and supplimental records are created
as needed.
Patch 25 adds a supplimental audit record for subject
LSM data when there are multiple security modules with such data.
The AUDIT_MAC_TASK_CONTEXTS record is used in conjuction with a
"subj=?" field to identify the subject data. The
AUDIT_MAC_TASK_CONTEXTS record identifies the security module
with the data: subj_selinux="xyz_t" subj_apparmor="abc".
An example of the MAC_TASK_CONTEXTS (1420) record is:
type=UNKNOWN[1420]
msg=audit(1600880931.832:113)
subj_apparmor="=unconfined"
subj_smack="_"
Patch 26 adds a supplimental audit record for object
LSM data when there are multiple security modules with such data.
The AUDIT_MAC_OBJ_CONTEXTS record is used in conjuction The
with a "obj=?" field to identify the object data.
The AUDIT_MAC_OBJ_CONTEXTS record identifies the security module
with the data: obj_selinux="xyz_t obj_apparmor="abc". While
AUDIT_MAC_TASK_CONTEXTS records will always contain an entry
for each possible security modules, AUDIT_MAC_OBJ_CONTEXTS
records will only contain entries for security modules for
which the object in question has data.
An example of the MAC_OBJ_CONTEXTS (1421) record is:
type=UNKNOWN[1421]
msg=audit(1601152467.009:1050):
obj_selinux="unconfined_u:object_r:user_home_t:s0"
Patch 27 adds a new interface for getting the compound security
contexts, /proc/self/attr/context. An example of the content
of this file is:
selinux\0one_u:one_r:one_t:s0-s0:c0.c1023\0apparmor\0unconfined\0
Finally, with all interference on the AppArmor hooks removed,
Patch 28 removes the exclusive bit from AppArmor. An unnecessary
stub hook was also removed.
The Ubuntu project is using an earlier version of this patchset in
their distribution to enable stacking for containers.
Performance measurements to date have the change within the "noise".
The sockperf and dbench results are on the order of 0.2% to 0.8%
difference, with better performance being as common as worse. The
benchmarks were run with AppArmor and Smack on Ubuntu.
https://github.com/cschaufler/lsm-stacking.git#stack-5.16-rc1-v30
Casey Schaufler (28):
integrity: disassociate ima_filter_rule from security_audit_rule
LSM: Infrastructure management of the sock security
LSM: Add the lsmblob data structure.
LSM: provide lsm name and id slot mappings
IMA: avoid label collisions with stacked LSMs
LSM: Use lsmblob in security_audit_rule_match
LSM: Use lsmblob in security_kernel_act_as
LSM: Use lsmblob in security_secctx_to_secid
LSM: Use lsmblob in security_secid_to_secctx
LSM: Use lsmblob in security_ipc_getsecid
LSM: Use lsmblob in security_task_getsecid
LSM: Use lsmblob in security_inode_getsecid
LSM: Use lsmblob in security_cred_getsecid
LSM: Specify which LSM to display
LSM: Ensure the correct LSM context releaser
LSM: Use lsmcontext in security_secid_to_secctx
LSM: Use lsmcontext in security_inode_getsecctx
LSM: security_secid_to_secctx in netlink netfilter
NET: Store LSM netlabel data in a lsmblob
binder: Pass LSM identifier for confirmation
LSM: Extend security_secid_to_secctx to include module selection
Audit: Keep multiple LSM data in audit_names
Audit: Create audit_stamp structure
Audit: Add framework for auxiliary records
Audit: Add record for multiple task security contexts
Audit: Add record for multiple object security contexts
LSM: Add /proc attr entry for full LSM context
AppArmor: Remove the exclusive flag
Documentation/ABI/testing/ima_policy | 8 +-
.../ABI/testing/procfs-attr-lsm_display | 22 +
Documentation/security/lsm.rst | 28 +
drivers/android/binder.c | 47 +-
drivers/android/binder_internal.h | 1 +
fs/ceph/xattr.c | 6 +-
fs/nfs/nfs4proc.c | 8 +-
fs/nfsd/nfs4xdr.c | 20 +-
fs/proc/base.c | 2 +
include/linux/audit.h | 15 +-
include/linux/cred.h | 3 +-
include/linux/lsm_hooks.h | 19 +-
include/linux/security.h | 244 ++++++-
include/net/netlabel.h | 8 +-
include/net/scm.h | 15 +-
include/uapi/linux/audit.h | 2 +
kernel/audit.c | 257 ++++++--
kernel/audit.h | 18 +-
kernel/auditfilter.c | 30 +-
kernel/auditsc.c | 130 ++--
kernel/cred.c | 12 +-
net/ipv4/cipso_ipv4.c | 26 +-
net/ipv4/ip_sockglue.c | 12 +-
net/netfilter/nf_conntrack_netlink.c | 24 +-
net/netfilter/nf_conntrack_standalone.c | 11 +-
net/netfilter/nfnetlink_queue.c | 38 +-
net/netfilter/nft_meta.c | 10 +-
net/netfilter/xt_SECMARK.c | 7 +-
net/netlabel/netlabel_kapi.c | 6 +-
net/netlabel/netlabel_unlabeled.c | 101 ++-
net/netlabel/netlabel_unlabeled.h | 2 +-
net/netlabel/netlabel_user.c | 13 +-
net/netlabel/netlabel_user.h | 6 +-
security/apparmor/include/apparmor.h | 3 +-
security/apparmor/include/net.h | 6 +-
security/apparmor/include/procattr.h | 2 +-
security/apparmor/lsm.c | 105 ++--
security/apparmor/procattr.c | 22 +-
security/bpf/hooks.c | 12 +-
security/commoncap.c | 7 +-
security/integrity/ima/ima.h | 26 -
security/integrity/ima/ima_appraise.c | 12 +-
security/integrity/ima/ima_main.c | 63 +-
security/integrity/ima/ima_policy.c | 58 +-
security/landlock/cred.c | 2 +-
security/landlock/fs.c | 2 +-
security/landlock/ptrace.c | 2 +-
security/landlock/setup.c | 5 +
security/landlock/setup.h | 1 +
security/loadpin/loadpin.c | 8 +-
security/lockdown/lockdown.c | 7 +-
security/safesetid/lsm.c | 8 +-
security/security.c | 595 ++++++++++++++++--
security/selinux/hooks.c | 99 +--
security/selinux/include/classmap.h | 2 +-
security/selinux/include/objsec.h | 5 +
security/selinux/include/security.h | 1 +
security/selinux/netlabel.c | 25 +-
security/selinux/ss/services.c | 4 +-
security/smack/smack.h | 6 +
security/smack/smack_access.c | 2 +-
security/smack/smack_lsm.c | 91 +--
security/smack/smack_netfilter.c | 4 +-
security/smack/smackfs.c | 10 +-
security/tomoyo/tomoyo.c | 8 +-
security/yama/yama_lsm.c | 7 +-
66 files changed, 1740 insertions(+), 621 deletions(-)
create mode 100644 Documentation/ABI/testing/procfs-attr-lsm_display
--
2.31.1
3 years
[PATCH] audit: accelerate audit rule filter
by Zixuan Zhao
From: zhaozixuan <zhaozixuan2(a)huawei.com>
Audit traverses rules when a syscall exits until it finds a matching rule.
For syscalls not monitored by any rules, audit has to traverse all rules
to know they are not interested. This process would be repeated many times
and cause performance issues when a user adds many syscall rules. To solve
this problem, we add an array to record the number of rules interested in
a syscall. When a syscall exits, audit will check the array to decide
whether to search syscall-rules or just quit. The complexity can be
optimized from O(n) to O(1) for syscalls that are not monitored by rules.
This patch does so with the following changes:
1. We define a global array audit_syscall_rules to record the number of
rules interested in a syscall. For compatible architectures which may have
two different syscall sets, we define one more array called
audit_compat_syscall_rules.
2. When a rule is added/deleted by a user, we use the syscall_nr
interested by the rule as the index of the global array and +1/-1 the
corresponding value. Considering tree-type rules usually monitor many
syscalls which may reduce the optimization effect, we move them from
audit_filter_list[AUDIT_FILTER_EXIT] to a new rule list named
audit_filter_dir_list, and add a new function audit_filter_dir to handle
these rules.
3. Add a check in function audit_filter_syscall. If
audit_syscall_rules[major] == 0 (or audit_compat_syscall_rules[major] == 0
for compatible architecture), quit the function early.
We used lat_syscall of lmbench3 to test the performance impact of this
patch. We changed the number of rules and run lat_syscall with 1000
repetitions at each test. Syscalls measured by lat_syscall are not
monitored by rules.
Before this optimization:
null read write stat fstat open
0 rules 1.87ms 2.74ms 2.56ms 26.31ms 4.13ms 69.66ms
10 rules 2.15ms 3.13ms 3.32ms 26.99ms 4.16ms 74.70ms
20 rules 2.45ms 3.97ms 3.82ms 27.05ms 4.60ms 76.35ms
30 rules 2.64ms 4.52ms 3.95ms 30.30ms 4.94ms 78.94ms
40 rules 2.83ms 4.97ms 4.23ms 32.16ms 5.40ms 81.88ms
50 rules 3.00ms 5.30ms 4.84ms 33.49ms 5.79ms 83.20ms
100 rules 4.24ms 9.75ms 7.42ms 37.68ms 6.55ms 93.70ms
160 rules 5.50ms 16.89ms 12.18ms 51.53ms 17.45ms 155.40ms
After this optimization:
null read write stat fstat open
0 rules 1.81ms 2.84ms 2.42ms 27.70ms 4.15ms 69.10ms
10 rules 1.97ms 2.83ms 2.69ms 27.70ms 4.15ms 69.30ms
20 rules 1.72ms 2.91ms 2.41ms 26.49ms 3.91ms 71.19ms
30 rules 1.85ms 2.94ms 2.48ms 26.27ms 3.97ms 71.43ms
40 rules 1.88ms 2.94ms 2.78ms 26.85ms 4.08ms 69.79ms
50 rules 1.86ms 3.17ms 3.08ms 26.25ms 4.03ms 72.32ms
100 rules 1.84ms 3.00ms 2.81ms 26.25ms 3.98ms 70.25ms
160 rules 1.92ms 3.32ms 3.06ms 26.81ms 4.57ms 71.41ms
As the result shown above, the syscall latencies increase as the number
of rules increases, while with the patch the latencies remain stable.
This could help when a user adds many audit rules for purposes (such as
attack tracing or process behavior recording) but suffers from low
performance.
Signed-off-by: zhaozixuan <zhaozixuan2(a)huawei.com>
---
include/linux/audit.h | 13 +++++
kernel/audit.c | 15 ++++++
kernel/audit.h | 12 +++++
kernel/auditfilter.c | 122 +++++++++++++++++++++++++++++++++++++++++-
kernel/auditsc.c | 48 ++++++++++++++++-
5 files changed, 207 insertions(+), 3 deletions(-)
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 82b7c1116a85..988b673ac66d 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -280,6 +280,19 @@ static inline int audit_signal_info(int sig, struct task_struct *t)
#define AUDIT_INODE_HIDDEN 2 /* audit record should be hidden */
#define AUDIT_INODE_NOEVAL 4 /* audit record incomplete */
+#include <asm/seccomp.h>
+#define AUDIT_ARCH_NATIVE SECCOMP_ARCH_NATIVE
+#define AUDIT_ARCH_NATIVE_NR SECCOMP_ARCH_NATIVE_NR
+#ifdef SECCOMP_ARCH_COMPAT
+#define AUDIT_ARCH_COMPAT SECCOMP_ARCH_COMPAT
+#define AUDIT_ARCH_COMPAT_NR SECCOMP_ARCH_COMPAT_NR
+#define AUDIR_ARCH_MAX_NR (SECCOMP_ARCH_NATIVE_NR > \
+ SECCOMP_ARCH_COMPAT_NR ? SECCOMP_ARCH_NATIVE_NR : \
+ SECCOMP_ARCH_COMPAT_NR)
+#else
+#define AUDIR_ARCH_MAX_NR SECCOMP_ARCH_NATIVE_NR
+#endif
+
#ifdef CONFIG_AUDITSYSCALL
#include <asm/syscall.h> /* for syscall_get_arch() */
diff --git a/kernel/audit.c b/kernel/audit.c
index 121d37e700a6..813a69bbf81a 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1638,6 +1638,10 @@ static struct pernet_operations audit_net_ops __net_initdata = {
static int __init audit_init(void)
{
int i;
+ struct audit_rule_count *arc = NULL;
+#ifdef AUDIT_ARCH_COMPAT
+ struct audit_rule_count *compat_arc = NULL;
+#endif
if (audit_initialized == AUDIT_DISABLED)
return 0;
@@ -1668,6 +1672,17 @@ static int __init audit_init(void)
panic("audit: failed to start the kauditd thread (%d)\n", err);
}
+ arc = alloc_audit_rule_count(AUDIT_ARCH_NATIVE_NR);
+ if (!arc)
+ panic("audit: failed to initialize audit_syscall_rules\n");
+ rcu_assign_pointer(audit_syscall_rules, arc);
+#ifdef AUDIT_ARCH_COMPAT
+ compat_arc = alloc_audit_rule_count(AUDIT_ARCH_COMPAT_NR);
+ if (!compat_arc)
+ panic("audit: failed to initialize audit_compat_syscall_rules\n");
+ rcu_assign_pointer(audit_compat_syscall_rules, compat_arc);
+#endif
+
audit_log(NULL, GFP_KERNEL, AUDIT_KERNEL,
"state=initialized audit_enabled=%u res=1",
audit_enabled);
diff --git a/kernel/audit.h b/kernel/audit.h
index d6a2c899a8db..7e452b9e2a30 100644
--- a/kernel/audit.h
+++ b/kernel/audit.h
@@ -199,6 +199,11 @@ struct audit_context {
struct audit_proctitle proctitle;
};
+struct audit_rule_count {
+ struct rcu_head rcu;
+ int length;
+ unsigned int counts[0];
+};
extern bool audit_ever_enabled;
extern void audit_log_session_info(struct audit_buffer *ab);
@@ -216,6 +221,13 @@ static inline int audit_hash_ino(u32 ino)
/* Indicates that audit should log the full pathname. */
#define AUDIT_NAME_FULL -1
+extern struct audit_rule_count *audit_syscall_rules;
+#ifdef AUDIT_ARCH_COMPAT
+extern struct audit_rule_count *audit_compat_syscall_rules;
+#endif
+extern inline struct audit_rule_count *alloc_audit_rule_count(int length);
+extern struct list_head audit_filter_dir_list;
+extern int audit_in_mask(const struct audit_krule *rule, unsigned long val);
extern int audit_match_class(int class, unsigned syscall);
extern int audit_comparator(const u32 left, const u32 op, const u32 right);
extern int audit_uid_comparator(kuid_t left, u32 op, kuid_t right);
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index db2c6b59dfc3..53da9cf99d29 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -60,6 +60,12 @@ static struct list_head audit_rules_list[AUDIT_NR_FILTERS] = {
DEFINE_MUTEX(audit_filter_mutex);
+struct audit_rule_count *audit_syscall_rules;
+#ifdef AUDIT_ARCH_COMPAT
+struct audit_rule_count *audit_compat_syscall_rules;
+#endif
+LIST_HEAD(audit_filter_dir_list);
+
static void audit_free_lsm_field(struct audit_field *f)
{
switch (f->type) {
@@ -909,6 +915,8 @@ static struct audit_entry *audit_find_rule(struct audit_entry *entry,
}
}
goto out;
+ } else if (entry->rule.tree) {
+ *p = list = &audit_filter_dir_list;
} else {
*p = list = &audit_filter_list[entry->rule.listnr];
}
@@ -926,6 +934,105 @@ static struct audit_entry *audit_find_rule(struct audit_entry *entry,
static u64 prio_low = ~0ULL/2;
static u64 prio_high = ~0ULL/2 - 1;
+inline struct audit_rule_count *alloc_audit_rule_count(int length)
+{
+ struct audit_rule_count *arc = kzalloc(
+ sizeof(struct audit_rule_count) + sizeof(unsigned int) * length,
+ GFP_KERNEL);
+ if (arc)
+ arc->length = length;
+ return arc;
+}
+static int copy_rule_counts(int arch, struct audit_rule_count **old_counts,
+ struct audit_rule_count **new_counts)
+{
+ if (arch == AUDIT_ARCH_NATIVE)
+ *old_counts = rcu_dereference_protected(audit_syscall_rules,
+ lockdep_is_held(&audit_filter_mutex));
+#ifdef AUDIT_ARCH_COMPAT
+ else if (arch == AUDIT_ARCH_COMPAT)
+ *old_counts = rcu_dereference_protected(audit_compat_syscall_rules,
+ lockdep_is_held(&audit_filter_mutex));
+#endif
+ else
+ return -EINVAL;
+
+ *new_counts = alloc_audit_rule_count((*old_counts)->length);
+ if (!*new_counts)
+ return -ENOMEM;
+
+ memcpy((*new_counts)->counts,
+ (*old_counts)->counts,
+ sizeof(unsigned int) * (*old_counts)->length);
+
+ return 0;
+}
+
+static inline bool arch_monitored(struct audit_entry *entry, int arch)
+{
+ return (entry->rule.arch_f == NULL ||
+ audit_comparator(arch,
+ entry->rule.arch_f->op,
+ entry->rule.arch_f->val));
+}
+
+static int audit_update_syscall_rule(struct audit_entry *entry, int delt)
+{
+ int i = 0;
+ int err = 0;
+ struct audit_rule_count *new_counts = NULL;
+ struct audit_rule_count *old_counts = NULL;
+ bool update_native;
+#ifdef AUDIT_ARCH_COMPAT
+ struct audit_rule_count *new_compat_counts = NULL;
+ struct audit_rule_count *old_compat_counts = NULL;
+ bool update_compat;
+#endif
+ if (entry->rule.listnr != AUDIT_FILTER_EXIT || entry->rule.watch || entry->rule.tree)
+ return 0;
+
+ update_native = arch_monitored(entry, AUDIT_ARCH_NATIVE);
+ if (update_native) {
+ err = copy_rule_counts(AUDIT_ARCH_NATIVE, &old_counts, &new_counts);
+ if (err)
+ return err;
+ }
+
+#ifdef AUDIT_ARCH_COMPAT
+ update_compat = arch_monitored(entry, AUDIT_ARCH_COMPAT);
+ if (update_compat) {
+ err = copy_rule_counts(AUDIT_ARCH_COMPAT, &old_compat_counts, &new_compat_counts);
+ if (err) {
+ kfree(new_counts);
+ return err;
+ }
+ }
+#endif
+
+ for (i = 0; i < AUDIR_ARCH_MAX_NR; i++) {
+ if ((audit_in_mask(&entry->rule, i) == 0))
+ continue;
+ if (i < AUDIT_ARCH_NATIVE_NR && update_native)
+ new_counts->counts[i] += delt;
+#ifdef AUDIT_ARCH_COMPAT
+ if (i < AUDIT_ARCH_COMPAT_NR && update_compat)
+ new_compat_counts->counts[i] += delt;
+#endif
+ }
+
+ if (update_native) {
+ rcu_assign_pointer(audit_syscall_rules, new_counts);
+ kfree_rcu(old_counts, rcu);
+ }
+#ifdef AUDIT_ARCH_COMPAT
+ if (update_compat) {
+ rcu_assign_pointer(audit_compat_syscall_rules, new_counts);
+ kfree_rcu(old_compat_counts, rcu);
+ }
+#endif
+ return 0;
+}
+
/* Add rule to given filterlist if not a duplicate. */
static inline int audit_add_rule(struct audit_entry *entry)
{
@@ -957,6 +1064,15 @@ static inline int audit_add_rule(struct audit_entry *entry)
return err;
}
+ err = audit_update_syscall_rule(entry, 1);
+ if (err) {
+ mutex_unlock(&audit_filter_mutex);
+ /* normally audit_add_tree_rule() will free it on failure */
+ if (tree)
+ audit_put_tree(tree);
+ return err;
+ }
+
if (watch) {
/* audit_filter_mutex is dropped and re-taken during this call */
err = audit_add_watch(&entry->rule, &list);
@@ -994,7 +1110,7 @@ static inline int audit_add_rule(struct audit_entry *entry)
entry->rule.flags &= ~AUDIT_FILTER_PREPEND;
} else {
list_add_tail(&entry->rule.list,
- &audit_rules_list[entry->rule.listnr]);
+ &audit_rules_list[entry->rule.listnr]);
list_add_tail_rcu(&entry->list, list);
}
#ifdef CONFIG_AUDITSYSCALL
@@ -1035,6 +1151,10 @@ int audit_del_rule(struct audit_entry *entry)
goto out;
}
+ ret = audit_update_syscall_rule(e, -1);
+ if (ret)
+ goto out;
+
if (e->rule.watch)
audit_remove_watch_rule(&e->rule);
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index b1cb1dbf7417..da764328c3aa 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -789,7 +789,7 @@ static enum audit_state audit_filter_task(struct task_struct *tsk, char **key)
return AUDIT_STATE_BUILD;
}
-static int audit_in_mask(const struct audit_krule *rule, unsigned long val)
+int audit_in_mask(const struct audit_krule *rule, unsigned long val)
{
int word, bit;
@@ -805,6 +805,25 @@ static int audit_in_mask(const struct audit_krule *rule, unsigned long val)
return rule->mask[word] & bit;
}
+static bool audit_syscall_monitored(int arch, int major)
+{
+ struct audit_rule_count *arc = NULL;
+
+ if (arch == AUDIT_ARCH_NATIVE)
+ arc = rcu_dereference(audit_syscall_rules);
+#ifdef AUDIT_ARCH_COMPAT
+ else if (arch == AUDIT_ARCH_COMPAT)
+ arc = rcu_dereference(audit_compat_syscall_rules);
+#endif
+ else
+ return false;
+
+ if (major < arc->length)
+ return arc->counts[major] != 0;
+
+ return false;
+}
+
/* At syscall exit time, this filter is called if the audit_state is
* not low enough that auditing cannot take place, but is also not
* high enough that we already know we have to write an audit record
@@ -820,6 +839,11 @@ static void audit_filter_syscall(struct task_struct *tsk,
return;
rcu_read_lock();
+ if (likely(!audit_syscall_monitored(ctx->arch, ctx->major))) {
+ rcu_read_unlock();
+ return;
+ }
+
list_for_each_entry_rcu(e, &audit_filter_list[AUDIT_FILTER_EXIT], list) {
if (audit_in_mask(&e->rule, ctx->major) &&
audit_filter_rules(tsk, &e->rule, ctx, NULL,
@@ -833,6 +857,25 @@ static void audit_filter_syscall(struct task_struct *tsk,
return;
}
+static void audit_filter_dir(struct task_struct *tsk,
+ struct audit_context *ctx)
+{
+ struct audit_entry *e;
+ enum audit_state state;
+
+ rcu_read_lock();
+ list_for_each_entry_rcu(e, &audit_filter_dir_list, list) {
+ if (audit_in_mask(&e->rule, ctx->major) &&
+ audit_filter_rules(tsk, &e->rule, ctx, NULL,
+ &state, false)) {
+ rcu_read_unlock();
+ ctx->current_state = state;
+ return;
+ }
+ }
+ rcu_read_unlock();
+}
+
/*
* Given an audit_name check the inode hash table to see if they match.
* Called holding the rcu read lock to protect the use of audit_inode_hash
@@ -1638,6 +1681,7 @@ void __audit_free(struct task_struct *tsk)
context->return_code = 0;
audit_filter_syscall(tsk, context);
+ audit_filter_dir(tsk, context);
audit_filter_inodes(tsk, context);
if (context->current_state == AUDIT_STATE_RECORD)
audit_log_exit();
@@ -1719,7 +1763,6 @@ void __audit_syscall_exit(int success, long return_code)
if (!list_empty(&context->killed_trees))
audit_kill_trees(context);
-
if (!context->dummy && context->in_syscall) {
if (success)
context->return_valid = AUDITSC_SUCCESS;
@@ -1745,6 +1788,7 @@ void __audit_syscall_exit(int success, long return_code)
context->return_code = return_code;
audit_filter_syscall(current, context);
+ audit_filter_dir(current, context);
audit_filter_inodes(current, context);
if (context->current_state == AUDIT_STATE_RECORD)
audit_log_exit();
--
2.17.1
3 years
Maximum Value for q_depth
by Amjad Gabbar
I am currently seeing a lot of auditd dispatch error issues. It is related
to a particular keyed rule that from the looks of it is generating close to
a million events /day. I have seen previous answers where it was advised to
increase the q_depth value to a suitable number.
Based on this, I would like to confirm what is the maximum advisable value
q_depth can have/take?
3 years
LSM stacking v30 Audit changes
by Casey Schaufler
It would be really, really helpful if I could be feedback
on the v30 LSM stacking patches approach to gathering
supplemental audit records. I used a list scheme so as
to support other uses, such as container ID records. It's
what I would want. It's an easy change if it isn't what
y'all want. I'm eager to get this resolved.
Thank you.
3 years
[PATCH RFC] integrity: disassociate ima_filter_rule from security_audit_rule
by Casey Schaufler
Create real functions for the ima_filter_rule interfaces.
These replace #defines that obscure the reuse of audit
interfaces. The new functions are put in security.c because
they use security module registered hooks that we don't
want exported.
Signed-off-by: Casey Schaufler <casey(a)schaufler-ca.com>
---
include/linux/security.h | 26 ++++++++++++++++++++++++++
security/integrity/ima/ima.h | 26 --------------------------
security/security.c | 21 +++++++++++++++++++++
3 files changed, 47 insertions(+), 26 deletions(-)
diff --git a/include/linux/security.h b/include/linux/security.h
index 7e0ba63b5dde..f98d047b8d0a 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1917,6 +1917,32 @@ static inline void security_audit_rule_free(void *lsmrule)
#endif /* CONFIG_SECURITY */
#endif /* CONFIG_AUDIT */
+#ifdef CONFIG_IMA_LSM_RULES
+#ifdef CONFIG_SECURITY
+int ima_filter_rule_init(u32 field, u32 op, char *rulestr, void **lsmrule);
+int ima_filter_rule_match(u32 secid, u32 field, u32 op, void *lsmrule);
+void ima_filter_rule_free(void *lsmrule);
+
+#else
+
+static inline int ima_filter_rule_init(u32 field, u32 op, char *rulestr,
+ void **lsmrule)
+{
+ return 0;
+}
+
+static inline int ima_filter_rule_match(u32 secid, u32 field, u32 op,
+ void *lsmrule)
+{
+ return 0;
+}
+
+static inline void ima_filter_rule_free(void *lsmrule)
+{ }
+
+#endif /* CONFIG_SECURITY */
+#endif /* CONFIG_IMA_LSM_RULES */
+
#ifdef CONFIG_SECURITYFS
extern struct dentry *securityfs_create_file(const char *name, umode_t mode,
diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h
index be965a8715e4..1b5d70ac2dc9 100644
--- a/security/integrity/ima/ima.h
+++ b/security/integrity/ima/ima.h
@@ -418,32 +418,6 @@ static inline void ima_free_modsig(struct modsig *modsig)
}
#endif /* CONFIG_IMA_APPRAISE_MODSIG */
-/* LSM based policy rules require audit */
-#ifdef CONFIG_IMA_LSM_RULES
-
-#define ima_filter_rule_init security_audit_rule_init
-#define ima_filter_rule_free security_audit_rule_free
-#define ima_filter_rule_match security_audit_rule_match
-
-#else
-
-static inline int ima_filter_rule_init(u32 field, u32 op, char *rulestr,
- void **lsmrule)
-{
- return -EINVAL;
-}
-
-static inline void ima_filter_rule_free(void *lsmrule)
-{
-}
-
-static inline int ima_filter_rule_match(u32 secid, u32 field, u32 op,
- void *lsmrule)
-{
- return -EINVAL;
-}
-#endif /* CONFIG_IMA_LSM_RULES */
-
#ifdef CONFIG_IMA_READ_POLICY
#define POLICY_FILE_FLAGS (S_IWUSR | S_IRUSR)
#else
diff --git a/security/security.c b/security/security.c
index 95e30fadba78..19ffb1bceb3b 100644
--- a/security/security.c
+++ b/security/security.c
@@ -2563,6 +2563,27 @@ int security_audit_rule_match(u32 secid, u32 field, u32 op, void *lsmrule)
}
#endif /* CONFIG_AUDIT */
+#ifdef CONFIG_IMA_LSM_RULES
+/*
+ * The integrity subsystem uses the same hooks as
+ * the audit subsystem.
+ */
+int ima_filter_rule_init(u32 field, u32 op, char *rulestr, void **lsmrule)
+{
+ return call_int_hook(audit_rule_init, 0, field, op, rulestr, lsmrule);
+}
+
+void ima_filter_rule_free(void *lsmrule)
+{
+ call_void_hook(audit_rule_free, lsmrule);
+}
+
+int ima_filter_rule_match(u32 secid, u32 field, u32 op, void *lsmrule)
+{
+ return call_int_hook(audit_rule_match, 0, secid, field, op, lsmrule);
+}
+#endif /* CONFIG_IMA_LSM_RULES */
+
#ifdef CONFIG_BPF_SYSCALL
int security_bpf(int cmd, union bpf_attr *attr, unsigned int size)
{
3 years, 1 month
[PATCH v1] add clock_adjtime to certification rulesets
by Richard Guy Briggs
The clock_adjtime syscall is missing from several certification rulesets that
monitor changes to the system clock. Add it.
Please see https://bugzilla.redhat.com/show_bug.cgi?id=1991919
Signed-off-by: Richard Guy Briggs <rgb(a)redhat.com>
---
rules/30-nispom.rules | 4 ++--
rules/30-pci-dss-v31.rules | 4 ++--
rules/30-stig.rules | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/rules/30-nispom.rules b/rules/30-nispom.rules
index e3873ef95069..ecac01a0b4e1 100644
--- a/rules/30-nispom.rules
+++ b/rules/30-nispom.rules
@@ -10,8 +10,8 @@
## Things that could affect time
-a always,exit -F arch=b32 -S adjtimex,settimeofday,stime -F key=time-change
-a always,exit -F arch=b64 -S adjtimex,settimeofday -F key=time-change
--a always,exit -F arch=b32 -S clock_settime -F a0=0x0 -F key=time-change
--a always,exit -F arch=b64 -S clock_settime -F a0=0x0 -F key=time-change
+-a always,exit -F arch=b32 -S clock_settime,clock_adjtime -F a0=0x0 -F key=time-change
+-a always,exit -F arch=b64 -S clock_settime,clock_adjtime -F a0=0x0 -F key=time-change
# Introduced in 2.6.39, commented out because it can make false positives
#-a always,exit -F arch=b32 -S clock_adjtime -F key=time-change
#-a always,exit -F arch=b64 -S clock_adjtime -F key=time-change
diff --git a/rules/30-pci-dss-v31.rules b/rules/30-pci-dss-v31.rules
index 7062b35f165c..0251bcafcc03 100644
--- a/rules/30-pci-dss-v31.rules
+++ b/rules/30-pci-dss-v31.rules
@@ -77,8 +77,8 @@
## We will place rules to check time synchronization
-a always,exit -F arch=b32 -S adjtimex,settimeofday,stime -F key=10.4.2b-time-change
-a always,exit -F arch=b64 -S adjtimex,settimeofday -F key=10.4.2b-time-change
--a always,exit -F arch=b32 -S clock_settime -F a0=0x0 -F key=10.4.2b-time-change
--a always,exit -F arch=b64 -S clock_settime -F a0=0x0 -F key=10.4.2b-time-change
+-a always,exit -F arch=b32 -S clock_settime,clock_adjtime -F a0=0x0 -F key=10.4.2b-time-change
+-a always,exit -F arch=b64 -S clock_settime,clock_adjtime -F a0=0x0 -F key=10.4.2b-time-change
# Introduced in 2.6.39, commented out because it can make false positives
#-a always,exit -F arch=b32 -S clock_adjtime -F key=10.4.2b-time-change
#-a always,exit -F arch=b64 -S clock_adjtime -F key=10.4.2b-time-change
diff --git a/rules/30-stig.rules b/rules/30-stig.rules
index 234f239cac06..60384f6b247d 100644
--- a/rules/30-stig.rules
+++ b/rules/30-stig.rules
@@ -26,8 +26,8 @@
## Things that could affect time
-a always,exit -F arch=b32 -S adjtimex,settimeofday,stime -F key=time-change
-a always,exit -F arch=b64 -S adjtimex,settimeofday -F key=time-change
--a always,exit -F arch=b32 -S clock_settime -F a0=0x0 -F key=time-change
--a always,exit -F arch=b64 -S clock_settime -F a0=0x0 -F key=time-change
+-a always,exit -F arch=b32 -S clock_settime,clock_adjtime -F a0=0x0 -F key=time-change
+-a always,exit -F arch=b64 -S clock_settime,clock_adjtime -F a0=0x0 -F key=time-change
# Introduced in 2.6.39, commented out because it can make false positives
#-a always,exit -F arch=b32 -S clock_adjtime -F key=time-change
#-a always,exit -F arch=b64 -S clock_adjtime -F key=time-change
--
2.27.0
3 years, 1 month