Skip to content

eBPF-based security platform

bpf2: refuse what lockdown refuses, and /proc/kcore, without lockdown

Daniel Borkmann0a9755d15eed
diff --git a/Documentation/concepts/background/bpf-lsm.rst b/Documentation/concepts/background/bpf-lsm.rst
index f5b3ae5a..417d9f07 100644
--- a/Documentation/concepts/background/bpf-lsm.rst
+++ b/Documentation/concepts/background/bpf-lsm.rst
@@ -54,12 +54,12 @@ and IMA and EVM, when built in, still run last. No other LSM then
refuses an operation before shirudo's programs see and count it, and
on an upstream kernel without the carried xattr patch none can hide a
seal label by refusing the read of it (see :doc:`/security/threat-model`).
-The security code the target runs shrinks to what shirudo uses. One more LSM
-matters: the threat model assumes ``lockdown=integrity``, and lockdown is
-an LSM as well. A kernel built with
+The security code the target runs shrinks to what shirudo uses.
+Lockdown is an LSM as well, and shirudo's ``bpf2`` object refuses what
+its integrity mode refuses from ``init`` on, so the target needs no
+lockdown LSM. Where one runs, a kernel built with
``CONFIG_SECURITY_LOCKDOWN_LSM_EARLY`` starts it before it reads the
-list, so ``lsm=bpf`` keeps it; on any other kernel, use
-``lsm=lockdown,bpf``.
+list, so ``lsm=bpf`` keeps it, and it decides before shirudo.
BPF programs on LSM hooks
-------------------------
diff --git a/Documentation/contribute/testing/test-coverage.rst b/Documentation/contribute/testing/test-coverage.rst
index 05c6fea2..afb254f9 100644
--- a/Documentation/contribute/testing/test-coverage.rst
+++ b/Documentation/contribute/testing/test-coverage.rst
@@ -507,6 +507,10 @@ signed config image.
is not refused or counted, and on an XFS image it is refused and
counted. The XFS case needs XFS in the kernel and ``mkfs.xfs``,
which the slim test VM kernel lacks
+ * - ``t6154-lockdown``
+ - A PCI config write, ``/proc/kcore`` and ``/dev/mem``, where the
+ kernel has them, are refused, the first two counted as
+ ``Lockdown``, and a read of ``/sys/power/state`` counts nothing
``bpm`` (7)
~~~~~~~~~~~
@@ -1032,6 +1036,8 @@ tests assert that a refusal moves its counter:
- ``t6152``
* - ``XattrHandle``
- ``t6153``, on a kernel with XFS
+ * - ``Lockdown``
+ - ``t6154``
* - ``Kexec``
- ``t6126``
diff --git a/Documentation/internals/enforcement.rst b/Documentation/internals/enforcement.rst
index 2ed2922c..ea8b11bf 100644
--- a/Documentation/internals/enforcement.rst
+++ b/Documentation/internals/enforcement.rst
@@ -202,6 +202,15 @@ Kexec
``lsm/kernel_read_file`` refuse every kexec image and initramfs to
every caller.
+Lockdown
+ ``lsm/locked_down`` refuses, to every caller, what the kernel's
+ lockdown in integrity mode refuses, the ways root has to change the
+ running kernel, and ``/proc/kcore``, which that mode leaves
+ readable. Module signatures stay with the kernel's enforcement, and
+ the hibernation check is refused without a count, as every read of
+ ``/sys/power/state`` makes one. The kernel's lockdown LSM, where it
+ runs, decides first, and covers the boot before ``init``.
+
Writable state
``seal`` refuses changes to labeled inodes under
``/var/lib/shirudo`` to tasks without runtime authority.
@@ -221,7 +230,7 @@ order:
with ``shirudo_roots``. Pin the identity map.
#. Attach ``task_prctl``, ``bprm_check_security``, ``inode_rmdir``,
``inode_rename``, ``inode_mkdir``, ``inode_symlink``, ``inode_link``,
- ``kernel_load_data`` and ``kernel_read_file``.
+ ``kernel_load_data``, ``kernel_read_file`` and ``locked_down``.
#. Attach ``file_ioctl``, ``file_ioctl_compat``, ``bdev_setintegrity``
and ``bdev_free_security``.
#. Attach ``inode_unlink``, ``inode_setxattr``, ``inode_removexattr``,
@@ -519,6 +528,12 @@ when the record it needs is missing.
- ``EPERM``
- ``Kexec``
- Unconditional.
+ * - ``lsm/locked_down`` (``bpf2``)
+ - Every lockdown reason of integrity mode but module signatures,
+ and ``LOCKDOWN_KCORE``, to every caller.
+ - ``EPERM``
+ - ``Lockdown``; hibernation uncounted
+ - Unconditional; the kernel's lockdown LSM decides first.
* - ``lsm.s/file_open`` (``seal``)
- A write open of a labeled file to a task without authority. On a
directory open, and on any open by an authorized task, records or
diff --git a/Documentation/internals/kernel-interfaces.rst b/Documentation/internals/kernel-interfaces.rst
index 062b1b3b..f58d0152 100644
--- a/Documentation/internals/kernel-interfaces.rst
+++ b/Documentation/internals/kernel-interfaces.rst
@@ -286,7 +286,7 @@ LSM hooks
``inode_rmdir``, ``inode_mkdir``, ``inode_symlink``,
``inode_link``, ``inode_rename``, ``inode_setxattr``,
``inode_removexattr``, ``kernel_load_data``, ``kernel_read_file``,
- ``file_open``, ``sb_umount``, ``move_mount``, ``sb_mount``,
+ ``locked_down``, ``file_open``, ``sb_umount``, ``move_mount``, ``sb_mount``,
``sb_remount``, ``file_ioctl``, ``file_ioctl_compat``,
``bdev_setintegrity`` (sleepable), ``bdev_free_security``
- ``bpf2``
diff --git a/Documentation/operate/plan/hardening.rst b/Documentation/operate/plan/hardening.rst
index 5ac76653..76155637 100644
--- a/Documentation/operate/plan/hardening.rst
+++ b/Documentation/operate/plan/hardening.rst
@@ -35,16 +35,17 @@ Kernel configuration
* - Item
- Why
- Checked
- * - Lockdown in integrity mode: ``CONFIG_SECURITY_LOCKDOWN_LSM`` with
- ``lockdown`` in the LSM list and ``lockdown=integrity``, or
- ``CONFIG_LOCK_DOWN_KERNEL_FORCE_INTEGRITY``
- - Without lockdown, root keeps ways to write kernel memory or
- reconfigure hardware that shirudo has no hook for: ``/dev/mem``,
- MSRs, I/O ports, PCI resources, debugfs, ACPI table overrides and
- hibernation images. Module signature enforcement alone does not
- close them. Do not use confidentiality mode: it withholds
- ``bpf_probe_read_kernel()`` from BPF programs, which shirudo's own
- programs need, so they would not load.
+ * - Lockdown in integrity mode: optional
+ - shirudo's ``bpf2`` object refuses, from ``init`` on, what
+ integrity mode refuses but module signatures: ``/dev/mem``, MSRs,
+ I/O ports, PCI resources, debugfs writes, ACPI table overrides
+ and hibernation, and ``/proc/kcore`` with them, which the mode
+ leaves readable. The kernel's lockdown LSM, where it runs, refuses
+ first and covers the boot before ``init``; module signatures and
+ hibernation need the rows below either way. Do not use
+ confidentiality mode: it withholds ``bpf_probe_read_kernel()``
+ from BPF programs, which shirudo's own programs need, so they
+ would not load.
- no
* - Module signature enforcement: ``CONFIG_MODULE_SIG_FORCE`` or
``module.sig_enforce=1``, or lockdown, which also refuses unsigned
@@ -53,7 +54,8 @@ Kernel configuration
- no
* - ``CONFIG_STRICT_DEVMEM`` and ``CONFIG_IO_STRICT_DEVMEM``, or no
``/dev/mem`` at all
- - Limits ``/dev/mem`` when lockdown is not in force.
+ - Limits ``/dev/mem`` before ``init``, after which ``bpf2`` refuses
+ it.
- no
* - ``CONFIG_BLK_DEV_WRITE_MOUNTED=n``
- The seal acts on file operations. Root writing to the block
@@ -62,10 +64,11 @@ Kernel configuration
mounted block device.
- no
* - No hibernation: ``CONFIG_HIBERNATION=n``, ``nohibernate`` or
- lockdown
+ ``lockdown=integrity``
- Resuming from a hibernation image replaces kernel memory with
- what the image holds. shirudo refuses kexec loads, but it does not
- refuse hibernation.
+ what the image holds. shirudo refuses hibernating once ``init``
+ runs, but the initrd resumes before ``init``, from an image root
+ can write to swap.
- no
* - Kexec
- A kexec boots a kernel and initrd of root's choosing while the
diff --git a/Documentation/operate/plan/interoperability.rst b/Documentation/operate/plan/interoperability.rst
index 7e888156..a8617c70 100644
--- a/Documentation/operate/plan/interoperability.rst
+++ b/Documentation/operate/plan/interoperability.rst
@@ -278,8 +278,9 @@ Module loading and kernel live patching
:Mechanism: shirudo does not gate module loading.
``lsm/kernel_load_data`` and ``lsm/kernel_read_file`` let every load
- other than a kexec image or initramfs through. Whether a module loads
- is the kernel's decision: module signature enforcement and lockdown
+ other than a kexec image or initramfs through, and
+ ``lsm/locked_down`` leaves module signatures to the kernel. Whether a
+ module loads is the kernel's decision: module signature enforcement
(A4 in :doc:`/security/threat-model`). A livepatch module, as kpatch
or the kernel's ``klp-build`` produce, is a kernel module like any
other.
diff --git a/Documentation/reference/cli/status.rst b/Documentation/reference/cli/status.rst
index 7f9d4073..1b07be9b 100644
--- a/Documentation/reference/cli/status.rst
+++ b/Documentation/reference/cli/status.rst
@@ -408,7 +408,7 @@ Print the keepalive body of the same target, which follows no tree:
.. code-block:: console
target# shirudo status --keepalive
- {"schema":"shirudo.keepalive/1","boot_id":"82639935-1127-4dab-91b5-f818eabc7f13","version_id":"d0d7aa800303439023907d1979d917d46a21bec21f816689c138728a28e84af9","config_root":"6d5ed552f448a1c07e3b9d24f5a86c1e0b7d93f2c4e5a6b7180c9d2e3f4a5b6c","kernel_release":"7.3.0-bpf-next+","image_id":null,"image_version":null,"image_root":null,"verdict":"ok","cond":5461,"flags":0,"tamper":[15,0,0,0,0,1,0,0,0,0,0,8,0,0,0,0,0,1,0,0,1,0,0,0,0,0,7,0,0,2,0,0,0,0,0,0,0,0,0,0,0],"tree_id":null,"generation":null,"base_seq":null,"last_seq":null,"base_root":null,"projection_root":null,"mask":null,"set_sha256":"5f0c2e8b7a1d4c3f9e6b2a0d8c7f1e3b5a9d4c2e6f8b0a1d3c5e7f9b2d4a6c8e","count":1,"not_ok":0}
+ {"schema":"shirudo.keepalive/1","boot_id":"82639935-1127-4dab-91b5-f818eabc7f13","version_id":"d0d7aa800303439023907d1979d917d46a21bec21f816689c138728a28e84af9","config_root":"6d5ed552f448a1c07e3b9d24f5a86c1e0b7d93f2c4e5a6b7180c9d2e3f4a5b6c","kernel_release":"7.3.0-bpf-next+","image_id":null,"image_version":null,"image_root":null,"verdict":"ok","cond":5461,"flags":0,"tamper":[15,0,0,0,0,1,0,0,0,0,0,8,0,0,0,0,0,1,0,0,1,0,0,0,0,0,7,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0],"tree_id":null,"generation":null,"base_seq":null,"last_seq":null,"base_root":null,"projection_root":null,"mask":null,"set_sha256":"5f0c2e8b7a1d4c3f9e6b2a0d8c7f1e3b5a9d4c2e6f8b0a1d3c5e7f9b2d4a6c8e","count":1,"not_ok":0}
Add this boot's eventlog to the report:
diff --git a/Documentation/reference/files.rst b/Documentation/reference/files.rst
index 60648053..dc7a6404 100644
--- a/Documentation/reference/files.rst
+++ b/Documentation/reference/files.rst
@@ -346,7 +346,8 @@ by ``BPF_OBJ_GET`` (``ObjGet``). Directories stay listable.
* - ``bpf2_task_prctl_link``, ``bpf2_bprm_check_security_link``,
``inode_rmdir_link``, ``bpf2_inode_rename_link``,
``inode_mkdir_link``, ``inode_symlink_link``, ``inode_link_link``,
- ``kernel_load_data_link``, ``kernel_read_file_link``
+ ``kernel_load_data_link``, ``kernel_read_file_link``,
+ ``locked_down_link``
- Links of the exec identity, directory entry and kexec guards.
* - ``file_ioctl_link``, ``file_ioctl_compat_link``,
``bdev_integrity_link``, ``bdev_free_link``
diff --git a/Documentation/reference/formats/status-json.rst b/Documentation/reference/formats/status-json.rst
index 53a98679..0a90f2a1 100644
--- a/Documentation/reference/formats/status-json.rst
+++ b/Documentation/reference/formats/status-json.rst
@@ -959,7 +959,8 @@ indented here:
"SealCoreDump": 0,
"SealUprobe": 0,
"ExecShared": 0,
- "XattrHandle": 0
+ "XattrHandle": 0,
+ "Lockdown": 0
}
},
"config": {
@@ -1016,7 +1017,7 @@ of the same target read:
"ExecTraced": 0, "SealEntry": 0, "PerfAttach": 0, "PinEntry": 0,
"SealCopyUp": 0, "Kexec": 0, "TpmExtend": 0, "ObjGet": 1,
"SealSignal": 0, "SealCoreDump": 0, "SealUprobe": 0,
- "ExecShared": 0, "XattrHandle": 0
+ "ExecShared": 0, "XattrHandle": 0, "Lockdown": 0
}
}
diff --git a/Documentation/security/tamper-counters.rst b/Documentation/security/tamper-counters.rst
index 7d2b3449..1e44b204 100644
--- a/Documentation/security/tamper-counters.rst
+++ b/Documentation/security/tamper-counters.rst
@@ -244,6 +244,13 @@ counter.
while another process shares the task's root and working
directory (``CLONE_FS``)
- ``EACCES``
+ * - ``Lockdown``
+ - change or read of the running kernel that lockdown refuses
+ - ``lsm/locked_down``: every reason of integrity mode but module
+ signatures, which the kernel's enforcement keeps, and
+ hibernation, refused uncounted, and ``LOCKDOWN_KCORE``, for
+ every caller
+ - ``EPERM``
Unless the row says every caller, a task with runtime authority is
not refused and moves nothing.
diff --git a/Documentation/security/threat-model.rst b/Documentation/security/threat-model.rst
index fda9ef69..babf6b0e 100644
--- a/Documentation/security/threat-model.rst
+++ b/Documentation/security/threat-model.rst
@@ -174,18 +174,20 @@ without the protection.
for the caller (T3).
* - A4
- The kernel refuses unsigned modules (``CONFIG_MODULE_SIG`` with
- enforcement) and runs with lockdown in integrity mode
- (``CONFIG_SECURITY_LOCKDOWN_LSM`` and ``lockdown=integrity``).
- - An unsigned module is kernel code of root's choosing. Module
- signatures alone leave root ``/dev/mem``, MSR writes, port I/O,
- PCI BAR access, debugfs writes, ACPI table overrides and
- hibernation, each a way to change or replace the running
- kernel, and lockdown refuses them. Lockdown refuses an unsigned
- module only on a kernel that checks module signatures at all.
- - No, see U10. In confidentiality mode the kernel withholds
- ``bpf_probe_read_kernel()`` from BPF programs, which shirudo's
- own programs use, so that mode would stop ``init``. This is a
- reading of the kernel source and is not tested.
+ enforcement).
+ - An unsigned module is kernel code of root's choosing, and
+ shirudo leaves module signatures to the kernel. The other ways
+ root has to change or replace the running kernel, ``/dev/mem``,
+ MSR writes, port I/O, PCI BAR access, debugfs writes and ACPI
+ table overrides, the ones lockdown in integrity mode refuses,
+ ``bpf2`` refuses from ``init`` on through ``lsm/locked_down``,
+ with ``/proc/kcore``, which that mode leaves readable
+ (``Lockdown``, ``t6154``). The kernel's lockdown LSM is not
+ needed for them, and where it runs it decides first.
+ - No, see U10. Lockdown in confidentiality mode would withhold
+ ``bpf_probe_read_kernel()`` from shirudo's own programs and stop
+ ``init``. This is a reading of the kernel source and is not
+ tested.
* - A5
- 32-bit compatibility is off: ``CONFIG_COMPAT=n``, and on x86-64
also ``CONFIG_IA32_EMULATION=n`` and ``CONFIG_X86_X32_ABI=n``.
@@ -219,10 +221,13 @@ without the protection.
and ``/dev/tpmrm0``.
- No.
* - A9
- - Hibernation is unavailable. Lockdown in integrity mode disables
- it.
+ - Hibernation is unavailable from boot: ``CONFIG_HIBERNATION=n``,
+ or ``nohibernate`` or ``lockdown=integrity`` on the command line.
- A hibernation image is kernel memory on disk that root can
change before resume, through ``/dev/snapshot`` among others.
+ ``bpf2`` refuses hibernation once ``init`` runs, but a resume
+ runs in the initrd before it, from an image root can write to
+ swap.
The behavior of the register across hibernation is not analyzed
here.
- No.
@@ -234,9 +239,10 @@ without the protection.
- No. See R19.
* - A11
- The kernel command line is authenticated as part of the UKI. It
- carries ``lsm=`` with ``bpf``, ``lockdown=integrity``,
- ``bpf.keyring_unsealed=1`` and ``dm_verity.keyring_unsealed=1``,
- and nothing that masks or skips ``shirudo-initrd.service``.
+ carries ``lsm=`` with ``bpf``, ``bpf.keyring_unsealed=1`` and
+ ``dm_verity.keyring_unsealed=1``, ``nohibernate`` or
+ ``lockdown=integrity`` on a kernel with hibernation (A9), and
+ nothing that masks or skips ``shirudo-initrd.service``.
- The command line decides whether the LSM runs, whether the
keyrings accept shirudo's keys and whether ``init`` runs at all.
- Partly. ``init`` refuses a ``.bpf`` keyring the kernel sealed
@@ -1074,13 +1080,23 @@ runs next. ``lsm/kernel_load_data`` and ``lsm/kernel_read_file`` refuse
every kexec image and initramfs to every task, shirudo included, by
either system call (``Kexec``).
+The kernel that runs this boot has other ways in: ``/dev/mem``, MSRs,
+port I/O, PCI resources, debugfs writes and ACPI table overrides change
+it, and ``/proc/kcore`` reads it. ``lsm/locked_down`` refuses what
+lockdown in integrity mode refuses, module signatures aside (A4), and
+``/proc/kcore`` with it, to every task, whatever the command line says
+(``Lockdown``). Hibernation is refused too, but a resume runs in the
+initrd before ``init``, which A9 keeps off.
+
.. rst-class:: facts
:Adversary: ADV-B, root on the target without the signing key
-:Enforced at: ``lsm/kernel_load_data``, ``lsm/kernel_read_file``
-:Refusal: ``EPERM`` from ``kexec_load(2)`` and ``kexec_file_load(2)``
-:Counters: ``Kexec``
-:Tests: ``t4003``, ``t4101``, ``t6126``
+:Enforced at: ``lsm/kernel_load_data``, ``lsm/kernel_read_file``,
+ ``lsm/locked_down``
+:Refusal: ``EPERM`` from ``kexec_load(2)`` and ``kexec_file_load(2)``,
+ and from each lockdown check
+:Counters: ``Kexec``, ``Lockdown``
+:Tests: ``t4003``, ``t4101``, ``t6126``, ``t6154``
:Residual: R6, R7, R12, U11, U16
.. _tm-t7:
@@ -1672,8 +1688,8 @@ R21 upatches can be neutralized by changing their targets
An upatch stays loaded and measured while root makes it ineffective:
by unloading the module a kprobe targets, by replacing the binary a
``uprobe``, ``uretprobe``, ``uprobe.multi`` or ``uretprobe.multi``
- target names with a new inode,
- or, without lockdown (A4), by disabling kprobes through debugfs. These
+ target names with a new inode. Disabling kprobes through debugfs is
+ a debugfs write, which ``bpf2``'s lockdown refuses (A4). These
are readings of the kernel source and are not tested.
XDP coverage is reconciled, not continuous. A device added after load
@@ -1860,15 +1876,14 @@ U9 init can rebind the register after hiding this boot's record
U10 Kernel prerequisites are not checked
:Affects: A4, A5, A7, A9 and A10.
- :Consequence: A target without lockdown, with 32-bit compatibility,
- with the dm-verity keyring options on, with hibernation available
- or with writes under mounted file systems allowed initializes
- without an error and without the protection those assumptions
- give.
+ :Consequence: A target without module signature enforcement, with
+ 32-bit compatibility, with the dm-verity keyring options on, with
+ hibernation available at boot or with writes under mounted file
+ systems allowed initializes without an error and without the
+ protection those assumptions give.
:Status: Confirmed in code: the pre-flight checks none of them.
- :Meanwhile: Boot with ``lockdown=integrity`` on an authenticated
- command line and build the kernel as :doc:`/operate/plan/hardening`
- describes.
+ :Meanwhile: Build the kernel and its command line as
+ :doc:`/operate/plan/hardening` describes.
U11 The boot continues when init fails
:Affects: ``shirudo-initrd.service`` and the root file system's
@@ -2026,15 +2041,15 @@ the procedures.
The deployer:
- Builds the kernel with the signed-loader ABI and the carried kernel
- patches (A3), ``CONFIG_MODULE_SIG`` with enforcement and
- ``CONFIG_SECURITY_LOCKDOWN_LSM`` (A4), ``CONFIG_COMPAT=n`` (A5), both
+ patches (A3), ``CONFIG_MODULE_SIG`` with enforcement (A4),
+ ``CONFIG_COMPAT=n`` (A5), both
dm-verity keyring options off and no foreign built-in certificate
(A7), the TPM driver without ``i2c-dev`` or ``spidev`` on its bus
(A8), and ``CONFIG_BLK_DEV_WRITE_MOUNTED=n`` (A10)
- Boots a signed, measured UKI under Secure Boot whose command line
- carries ``lsm=`` with ``bpf``, ``lockdown=integrity``,
- ``bpf.keyring_unsealed=1`` and ``dm_verity.keyring_unsealed=1`` (A6,
- A11)
+ carries ``lsm=`` with ``bpf``, ``bpf.keyring_unsealed=1``,
+ ``dm_verity.keyring_unsealed=1`` and, on a kernel with hibernation,
+ ``nohibernate`` (A6, A9, A11)
- Keeps generic tools off the runtime image (A14)
- Keeps the environment files of the units absent or empty (U3) and
starts every shirudo unit from the runtime image (U7)
diff --git a/bpf/bpf2.c b/bpf/bpf2.c
index 9aa48da3..21b1ed82 100644
--- a/bpf/bpf2.c
+++ b/bpf/bpf2.c
@@ -468,6 +468,34 @@ int BPF_PROG(shirudo_lsm_kernel_read_file, struct file *file,
return shirudo_tamper_deny(TAMPER_KEXEC, -EPERM);
}
+/*
+ * Lockdown in integrity mode, the ways root has to change the running
+ * kernel, from /dev/mem to debugfs writes, and /proc/kcore, which that
+ * mode leaves readable, whether or not the command line asks for
+ * lockdown: the kernel's own lockdown LSM decides first where it runs.
+ * Module signatures stay with the kernel's enforcement (A4), and the
+ * hibernation check, which every read of /sys/power/state makes, is
+ * refused without a count.
+ */
+SEC("lsm/locked_down")
+int BPF_PROG(shirudo_lsm_locked_down, enum lockdown_reason what, int ret)
+{
+ if (ret)
+ return ret;
+ if (what == bpf_core_enum_value(enum lockdown_reason,
+ LOCKDOWN_MODULE_SIGNATURE))
+ return 0;
+ if (what == bpf_core_enum_value(enum lockdown_reason,
+ LOCKDOWN_HIBERNATION))
+ return -EPERM;
+ if (what == bpf_core_enum_value(enum lockdown_reason, LOCKDOWN_KCORE) ||
+ (what > LOCKDOWN_NONE &&
+ what < bpf_core_enum_value(enum lockdown_reason,
+ LOCKDOWN_INTEGRITY_MAX)))
+ return shirudo_tamper_deny(TAMPER_LOCKDOWN, -EPERM);
+ return 0;
+}
+
SEC("lsm/inode_rename")
int BPF_PROG(shirudo_lsm_inode_rename, struct inode *old_dir,
struct dentry *old_dentry, struct inode *new_dir,
diff --git a/bpf/lib/tamper.h b/bpf/lib/tamper.h
index 70dd1951..242b2724 100644
--- a/bpf/lib/tamper.h
+++ b/bpf/lib/tamper.h
@@ -53,6 +53,7 @@ enum tamper_point {
TAMPER_SEAL_UPROBE,
TAMPER_EXEC_SHARED,
TAMPER_XATTR_HANDLE,
+ TAMPER_LOCKDOWN,
TAMPER_MAX
};
diff --git a/testing/fixtures/keepalive/node-a-1.0.0.json b/testing/fixtures/keepalive/node-a-1.0.0.json
index 7f82c1c7..f5e8d052 100644
--- a/testing/fixtures/keepalive/node-a-1.0.0.json
+++ b/testing/fixtures/keepalive/node-a-1.0.0.json
@@ -1 +1 @@
-{"schema":"shirudo.keepalive/1","boot_id":"168d20a1-5011-4e1b-9924-d8b73c85aa4e","version_id":"d6d918ad22ff597579e6678bef75adca84d30f9661e0b7bbdbf534eebc138c1f","config_root":"1d8465c5b17838303fee92b3905420d294d2c22c576a0bdef0f69f190ed22807","kernel_release":"7.4.2","image_id":"fleet-os","image_version":"2026.11.1","image_root":"a3c3f1b0e4c2d7f09e3b6b2a8b1d5e7c4f6a9d0b2c8e1f3a5b7d9c0e2f4a6b8c","verdict":"ok","cond":5461,"flags":0,"tamper":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"tree_id":"fleet-base","generation":1,"base_seq":0,"last_seq":1,"base_root":"0000000000000000000000000000000000000000000000000000000000000000","projection_root":"04f83540c1727aefcf3c53449a99594c8fd1cc15e1466dbdbf3168cc8f9dc136","mask":"QA==","set_sha256":"6c9e113d02cd14646f617d7bba4a092b91bc3802dfdaae50e2fef7a01e0580aa","count":1,"not_ok":0}
\ No newline at end of file
+{"schema":"shirudo.keepalive/1","boot_id":"168d20a1-5011-4e1b-9924-d8b73c85aa4e","version_id":"d6d918ad22ff597579e6678bef75adca84d30f9661e0b7bbdbf534eebc138c1f","config_root":"1d8465c5b17838303fee92b3905420d294d2c22c576a0bdef0f69f190ed22807","kernel_release":"7.4.2","image_id":"fleet-os","image_version":"2026.11.1","image_root":"a3c3f1b0e4c2d7f09e3b6b2a8b1d5e7c4f6a9d0b2c8e1f3a5b7d9c0e2f4a6b8c","verdict":"ok","cond":5461,"flags":0,"tamper":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"tree_id":"fleet-base","generation":1,"base_seq":0,"last_seq":1,"base_root":"0000000000000000000000000000000000000000000000000000000000000000","projection_root":"04f83540c1727aefcf3c53449a99594c8fd1cc15e1466dbdbf3168cc8f9dc136","mask":"QA==","set_sha256":"6c9e113d02cd14646f617d7bba4a092b91bc3802dfdaae50e2fef7a01e0580aa","count":1,"not_ok":0}
\ No newline at end of file
diff --git a/testing/fixtures/keepalive/node-a-1.1.0.json b/testing/fixtures/keepalive/node-a-1.1.0.json
index 84e974fa..f54bc154 100644
--- a/testing/fixtures/keepalive/node-a-1.1.0.json
+++ b/testing/fixtures/keepalive/node-a-1.1.0.json
@@ -1 +1 @@
-{"schema":"shirudo.keepalive/1","boot_id":"168d20a1-5011-4e1b-9924-d8b73c85aa4e","version_id":"d6d918ad22ff597579e6678bef75adca84d30f9661e0b7bbdbf534eebc138c1f","config_root":"1d8465c5b17838303fee92b3905420d294d2c22c576a0bdef0f69f190ed22807","kernel_release":"7.4.2","image_id":"fleet-os","image_version":"2026.11.1","image_root":"a3c3f1b0e4c2d7f09e3b6b2a8b1d5e7c4f6a9d0b2c8e1f3a5b7d9c0e2f4a6b8c","verdict":"ok","cond":5461,"flags":0,"tamper":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"tree_id":"fleet-base","generation":3,"base_seq":0,"last_seq":3,"base_root":"0000000000000000000000000000000000000000000000000000000000000000","projection_root":"154522480ff8884daa95589e80f26f20248bbf9c192dfbb3cee04e03b4f136a1","mask":"VA==","set_sha256":"74e5bd2c665109f6d8f926af5476c266ad70ab07293ff13b1a13d0b89aa5c1bf","count":1,"not_ok":0}
\ No newline at end of file
+{"schema":"shirudo.keepalive/1","boot_id":"168d20a1-5011-4e1b-9924-d8b73c85aa4e","version_id":"d6d918ad22ff597579e6678bef75adca84d30f9661e0b7bbdbf534eebc138c1f","config_root":"1d8465c5b17838303fee92b3905420d294d2c22c576a0bdef0f69f190ed22807","kernel_release":"7.4.2","image_id":"fleet-os","image_version":"2026.11.1","image_root":"a3c3f1b0e4c2d7f09e3b6b2a8b1d5e7c4f6a9d0b2c8e1f3a5b7d9c0e2f4a6b8c","verdict":"ok","cond":5461,"flags":0,"tamper":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"tree_id":"fleet-base","generation":3,"base_seq":0,"last_seq":3,"base_root":"0000000000000000000000000000000000000000000000000000000000000000","projection_root":"154522480ff8884daa95589e80f26f20248bbf9c192dfbb3cee04e03b4f136a1","mask":"VA==","set_sha256":"74e5bd2c665109f6d8f926af5476c266ad70ab07293ff13b1a13d0b89aa5c1bf","count":1,"not_ok":0}
\ No newline at end of file
diff --git a/testing/fixtures/keepalive/node-b-1.0.0.json b/testing/fixtures/keepalive/node-b-1.0.0.json
index f6ed8e74..21a0df0e 100644
--- a/testing/fixtures/keepalive/node-b-1.0.0.json
+++ b/testing/fixtures/keepalive/node-b-1.0.0.json
@@ -1 +1 @@
-{"schema":"shirudo.keepalive/1","boot_id":"9a6f14ea-0cc2-45e1-8e23-7b887120cf54","version_id":"d6d918ad22ff597579e6678bef75adca84d30f9661e0b7bbdbf534eebc138c1f","config_root":"ff2cbeff5d0e9c41a7b36f28d14ce09b73a5182e6fc40d97b5e2a1683c0f7ff8","kernel_release":"7.4.2","image_id":"fleet-os","image_version":"2026.11.1","image_root":null,"verdict":"ok","cond":5461,"flags":0,"tamper":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"tree_id":"fleet-base","generation":1,"base_seq":0,"last_seq":1,"base_root":"0000000000000000000000000000000000000000000000000000000000000000","projection_root":"0000000000000000000000000000000000000000000000000000000000000000","mask":"gA==","set_sha256":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","count":0,"not_ok":0}
\ No newline at end of file
+{"schema":"shirudo.keepalive/1","boot_id":"9a6f14ea-0cc2-45e1-8e23-7b887120cf54","version_id":"d6d918ad22ff597579e6678bef75adca84d30f9661e0b7bbdbf534eebc138c1f","config_root":"ff2cbeff5d0e9c41a7b36f28d14ce09b73a5182e6fc40d97b5e2a1683c0f7ff8","kernel_release":"7.4.2","image_id":"fleet-os","image_version":"2026.11.1","image_root":null,"verdict":"ok","cond":5461,"flags":0,"tamper":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"tree_id":"fleet-base","generation":1,"base_seq":0,"last_seq":1,"base_root":"0000000000000000000000000000000000000000000000000000000000000000","projection_root":"0000000000000000000000000000000000000000000000000000000000000000","mask":"gA==","set_sha256":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","count":0,"not_ok":0}
\ No newline at end of file
diff --git a/testing/fixtures/keepalive/node-b-1.1.0.json b/testing/fixtures/keepalive/node-b-1.1.0.json
index 071d64c4..6bbfccb3 100644
--- a/testing/fixtures/keepalive/node-b-1.1.0.json
+++ b/testing/fixtures/keepalive/node-b-1.1.0.json
@@ -1 +1 @@
-{"schema":"shirudo.keepalive/1","boot_id":"9a6f14ea-0cc2-45e1-8e23-7b887120cf54","version_id":"d6d918ad22ff597579e6678bef75adca84d30f9661e0b7bbdbf534eebc138c1f","config_root":"ff2cbeff5d0e9c41a7b36f28d14ce09b73a5182e6fc40d97b5e2a1683c0f7ff8","kernel_release":"7.4.2","image_id":"fleet-os","image_version":"2026.11.1","image_root":null,"verdict":"ok","cond":5461,"flags":0,"tamper":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"tree_id":"fleet-base","generation":3,"base_seq":0,"last_seq":3,"base_root":"0000000000000000000000000000000000000000000000000000000000000000","projection_root":"0000000000000000000000000000000000000000000000000000000000000000","mask":"qA==","set_sha256":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","count":0,"not_ok":0}
\ No newline at end of file
+{"schema":"shirudo.keepalive/1","boot_id":"9a6f14ea-0cc2-45e1-8e23-7b887120cf54","version_id":"d6d918ad22ff597579e6678bef75adca84d30f9661e0b7bbdbf534eebc138c1f","config_root":"ff2cbeff5d0e9c41a7b36f28d14ce09b73a5182e6fc40d97b5e2a1683c0f7ff8","kernel_release":"7.4.2","image_id":"fleet-os","image_version":"2026.11.1","image_root":null,"verdict":"ok","cond":5461,"flags":0,"tamper":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"tree_id":"fleet-base","generation":3,"base_seq":0,"last_seq":3,"base_root":"0000000000000000000000000000000000000000000000000000000000000000","projection_root":"0000000000000000000000000000000000000000000000000000000000000000","mask":"qA==","set_sha256":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","count":0,"not_ok":0}
\ No newline at end of file
diff --git a/testing/fixtures/keepalive/ops-16.json b/testing/fixtures/keepalive/ops-16.json
index 76fadef7..9df18416 100644
--- a/testing/fixtures/keepalive/ops-16.json
+++ b/testing/fixtures/keepalive/ops-16.json
@@ -1 +1 @@
-{"schema":"shirudo.keepalive/1","boot_id":"d5140906-4eab-4983-a62c-29e49d449ea3","version_id":"d6d918ad22ff597579e6678bef75adca84d30f9661e0b7bbdbf534eebc138c1f","config_root":"1fbdff17ad8d50404772901df54d5aa2c698eddbb413e286fc654f80931c688a","kernel_release":"7.4.0-shirudo","image_id":"fleet-os","image_version":"2026.11.1","image_root":"a3c3f1b0e4c2d7f09e3b6b2a8b1d5e7c4f6a9d0b2c8e1f3a5b7d9c0e2f4a6b8c","verdict":"ok","cond":5461,"flags":0,"tamper":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"tree_id":"fleet-base","generation":42,"base_seq":0,"last_seq":12,"base_root":"0000000000000000000000000000000000000000000000000000000000000000","projection_root":"f59301708fc8e150c5d2abb1009b4f13fc0dcc1304b708f77dc14b1541679e28","mask":"WdlZAA==","set_sha256":"ac1af1d44b5c1fe3f616384db421138aa4d296595797b5864908a89276e17e6d","count":7,"not_ok":0}
\ No newline at end of file
+{"schema":"shirudo.keepalive/1","boot_id":"d5140906-4eab-4983-a62c-29e49d449ea3","version_id":"d6d918ad22ff597579e6678bef75adca84d30f9661e0b7bbdbf534eebc138c1f","config_root":"1fbdff17ad8d50404772901df54d5aa2c698eddbb413e286fc654f80931c688a","kernel_release":"7.4.0-shirudo","image_id":"fleet-os","image_version":"2026.11.1","image_root":"a3c3f1b0e4c2d7f09e3b6b2a8b1d5e7c4f6a9d0b2c8e1f3a5b7d9c0e2f4a6b8c","verdict":"ok","cond":5461,"flags":0,"tamper":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"tree_id":"fleet-base","generation":42,"base_seq":0,"last_seq":12,"base_root":"0000000000000000000000000000000000000000000000000000000000000000","projection_root":"f59301708fc8e150c5d2abb1009b4f13fc0dcc1304b708f77dc14b1541679e28","mask":"WdlZAA==","set_sha256":"ac1af1d44b5c1fe3f616384db421138aa4d296595797b5864908a89276e17e6d","count":7,"not_ok":0}
\ No newline at end of file
diff --git a/testing/fixtures/keepalive/quotes.tsv b/testing/fixtures/keepalive/quotes.tsv
index 7bd57e02..ba594b47 100644
--- a/testing/fixtures/keepalive/quotes.tsv
+++ b/testing/fixtures/keepalive/quotes.tsv
@@ -1,4 +1,4 @@
-node-a-1.0.0.json /1RDR4AYACIAC26qnBF6MihCyjLCji8Q8sJmUXn1Qh6GPwCuDFbLswFLACDaNzaLmTGJta5hxqgb6FFqNY2oMaMwsxwIqbxJOQ5VzAAAAAAAAAAKAAAAAAAAAAABIBkQIwAWNjYAAAABAAsDAAAAACDjsMRCmPwcFJr79MiZb7kkJ65B5GSbk0yklZkbeFK4VQ== ABgACwAgi4Fwa2CbrKGvoTtCvEsSTl67IjzUhe7WZkPSsDcNTZYAIMB5upp2sMl+u+C0ZAUjU2catO9AbuuTc7Q9FOGT96/i ACMACwAFAHIAAAAQABgACwADABAAIOPXhQHNHyOkg+gwQx4SiSNbBR8UpiOrYQ68ttai/KUQACD0QADC8ysgldseBqytxq67BEdBKdG16a6n1gwA0+HtuA== da37368b993189b5ae61c6a81be8516a358da831a330b31c08a9bc49390e55cc
-node-a-1.1.0.json /1RDR4AYACIAC26qnBF6MihCyjLCji8Q8sJmUXn1Qh6GPwCuDFbLswFLACAShV5xcV/bPg4RWN7CEuS4EecLszKatOXwwOk3OkKIuAAAAAAAAAAcAAAAAAAAAAABIBkQIwAWNjYAAAABAAsDAAAAACDjsMRCmPwcFJr79MiZb7kkJ65B5GSbk0yklZkbeFK4VQ== ABgACwAgaJrN5SzXk7ffZJC9tXeOftl2DxaznLZv0SRX7+IRfPMAIIbjBETyPewha32Xq1FROCBJe6/prg+xG02LhFNPhDRb ACMACwAFAHIAAAAQABgACwADABAAIOPXhQHNHyOkg+gwQx4SiSNbBR8UpiOrYQ68ttai/KUQACD0QADC8ysgldseBqytxq67BEdBKdG16a6n1gwA0+HtuA== 12855e71715fdb3e0e1158dec212e4b811e70bb3329ab4e5f0c0e9373a4288b8
-node-b-1.0.0.json /1RDR4AYACIAC1l8fIFi6VOTMQcyqjWrQ2g2b5zaL/1SzcUmkVI8zh6cACBoAkB6Ih2y9hq1lQWpk5x50Ivux8uFmuH4glt234UcTAAAAAAAAAAJAAAAAAAAAAABIBkQIwAWNjYAAAABAAsDAAAAACDjsMRCmPwcFJr79MiZb7kkJ65B5GSbk0yklZkbeFK4VQ== ABgACwAgxeKi7vbVIc1sbTAcbYvNCl3ronVFKO2CfqrfcT5lmFIAIMrJMf3KiJveZDjNXnJJCrMU5GyT8KPz0H+nhTE4m/Uy ACMACwAFAHIAAAAQABgACwADABAAIL1SpeBevicmumRAI1eBOOwE6XsC+CEC1O4pfKfZchT9ACAF/6zmu5EiPXssOPH0A2iu/CaeM2N6fKADQTj1eBeLEw== 6802407a221db2f61ab59505a9939c79d08beec7cb859ae1f8825b76df851c4c
-node-b-1.1.0.json /1RDR4AYACIAC1l8fIFi6VOTMQcyqjWrQ2g2b5zaL/1SzcUmkVI8zh6cACAG3x/X6GIDmeD42kECuur7j2O3ULeyJt/r5xOIkcZI/gAAAAAAAAAaAAAAAAAAAAABIBkQIwAWNjYAAAABAAsDAAAAACDjsMRCmPwcFJr79MiZb7kkJ65B5GSbk0yklZkbeFK4VQ== ABgACwAgKy2QVZma+3nIafXcf86g89JJYnivzy1wJA3xmSfX9I8AIGjHmbj6kuiKlad1S+Ns4FT7a/AG1GJ0fb10nAwpFXfn ACMACwAFAHIAAAAQABgACwADABAAIL1SpeBevicmumRAI1eBOOwE6XsC+CEC1O4pfKfZchT9ACAF/6zmu5EiPXssOPH0A2iu/CaeM2N6fKADQTj1eBeLEw== 06df1fd7e8620399e0f8da4102baeafb8f63b750b7b226dfebe7138891c648fe
+node-a-1.0.0.json /1RDR4AYACIAC9r407nH/GvK8V9whbAN5W7sd2p12DUEBzWU9gX+X5F+ACDBq8Ey3FnZcZW5twnTWwgqghfDQfxSIJGiAXQLM1JgyAAAAAAAAAAJAAAAAAAAAAABIBkQIwAWNjYAAAABAAsDAAAAACDjsMRCmPwcFJr79MiZb7kkJ65B5GSbk0yklZkbeFK4VQ== ABgACwAgJa6K6HT4NUOIpYrKZMT1WSAIqTbPTZSPyJNlol0Oz+UAIK+McjKFWyZIwDzN6oOG2Gpbfj1yycCFxNfey3UUDEB5 ACMACwAFAHIAAAAQABgACwADABAAIFgoZ+6XpoE3/sWCmSM1pcwh/u/2dcY1yp9JTBykdK4VACDxEkc5rBHAtnOjNZU5z2JcpfeQoxoI4EAi7B82iAxENQ== c1abc132dc59d97195b9b709d35b082a8217c341fc522091a201740b335260c8
+node-a-1.1.0.json /1RDR4AYACIAC9r407nH/GvK8V9whbAN5W7sd2p12DUEBzWU9gX+X5F+ACBL5BSxrlAgv/czzo6Npa3nDCgBplxNeWkiz0a377iOZAAAAAAAAAAcAAAAAAAAAAABIBkQIwAWNjYAAAABAAsDAAAAACDjsMRCmPwcFJr79MiZb7kkJ65B5GSbk0yklZkbeFK4VQ== ABgACwAgvPwaGD+j3TtrVgxHJ0t5fPKmaBMRJt9nZ0a7QTNEugAAIOdeUmwxksi9TCKjgMZfipjvlT8ViuDgXWrqEXsP68Zk ACMACwAFAHIAAAAQABgACwADABAAIFgoZ+6XpoE3/sWCmSM1pcwh/u/2dcY1yp9JTBykdK4VACDxEkc5rBHAtnOjNZU5z2JcpfeQoxoI4EAi7B82iAxENQ== 4be414b1ae5020bff733ce8e8da5ade70c2801a65c4d796922cf46b7efb88e64
+node-b-1.0.0.json /1RDR4AYACIAC4uo0JNu1oyV5LHEf1eoRpvUYhLfP7wWm47zs8F5wYMvACAVvcdjo5tKQjrKpnWHIVA5iHp6dV4jpXcSpKUNcei55AAAAAAAAAAJAAAAAAAAAAABIBkQIwAWNjYAAAABAAsDAAAAACDjsMRCmPwcFJr79MiZb7kkJ65B5GSbk0yklZkbeFK4VQ== ABgACwAgr+a9fOKJepTH4mNlKNdZhkwhKmLoIu6EIpZu6u4tiwcAIPklMlQuhF+ETAdpoWPnvFLHUDhW6nK2lCMUXQuIOwlV ACMACwAFAHIAAAAQABgACwADABAAIBx9ipOlM3Ji7QgU2dFw5fZX/LoFvN5xtPNstPrsmqHIACDYv6gg5uomNm5wuoUI/1N7Eetlrgr8oGdHCyw//Vmm9Q== 15bdc763a39b4a423acaa67587215039887a7a755e23a57712a4a50d71e8b9e4
+node-b-1.1.0.json /1RDR4AYACIAC4uo0JNu1oyV5LHEf1eoRpvUYhLfP7wWm47zs8F5wYMvACBd2XyVD/RPGFJZ3rDyPRS/iKgt8hpf6SI0iBqhBM9/GQAAAAAAAAAcAAAAAAAAAAABIBkQIwAWNjYAAAABAAsDAAAAACDjsMRCmPwcFJr79MiZb7kkJ65B5GSbk0yklZkbeFK4VQ== ABgACwAgVaTtxFQQaKrUent++6r+Z8joRGOiOMzyEAIiJ53lAKMAICQtAIwuTtYId300XkTrrKvI9o4Zb0/fXTPwKsw6SK99 ACMACwAFAHIAAAAQABgACwADABAAIBx9ipOlM3Ji7QgU2dFw5fZX/LoFvN5xtPNstPrsmqHIACDYv6gg5uomNm5wuoUI/1N7Eetlrgr8oGdHCyw//Vmm9Q== 5dd97c950ff44f185259deb0f23d14bf88a82df21a5fe92234881aa104cf7f19
diff --git a/testing/fixtures/keepalive/recompute.py b/testing/fixtures/keepalive/recompute.py
index ceb8d8ac..428d3aa9 100755
--- a/testing/fixtures/keepalive/recompute.py
+++ b/testing/fixtures/keepalive/recompute.py
@@ -24,7 +24,7 @@ BODY_KEYS = [
"projection_root", "mask", "set_sha256", "count", "not_ok",
]
CANONICAL_KEYS = ["seq", "op", "id", "selector", "artifact"]
-TAMPER_COUNTERS = 41
+TAMPER_COUNTERS = 42
ALL_OK = 0x1555
OPERATION_DIGESTS = [
@@ -51,9 +51,9 @@ MASKS = [
# The body the example pages print for node A after release 1.1.0: six
# conditions and no image keys.
-PAGE_BODY_LEN = 740
+PAGE_BODY_LEN = 742
PAGE_BODY_SHA256 = \
- "6e40704db76a1be5e3fd544511962cc502380e9aa63137e1e5fc4fa91d1a377c"
+ "0c0f36b05c35208895de17fe355810a9c6632c907fde8e3eb9cbbf20f4882e8e"
PAGE_COND = 0x555
VERSION_ID = "d6d918ad22ff597579e6678bef75adca84d30f9661e0b7bbdbf534eebc138c1f"
diff --git a/testing/functional/tamperproof/t6154-lockdown.sh b/testing/functional/tamperproof/t6154-lockdown.sh
new file mode 100755
index 00000000..9fad32f6
--- /dev/null
+++ b/testing/functional/tamperproof/t6154-lockdown.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+# SPDX-License-Identifier: BSD-2-Clause
+# Copyright (c) 2026 Authors of shirudo
+#
+# t6154 -- bpf2 refuses what lockdown in integrity mode refuses, whatever
+# the command line says, and /proc/kcore with it: the reads and writes of
+# the running kernel fail with EPERM and count as Lockdown, while the
+# hibernation check every read of /sys/power/state makes counts nothing.
+
+cd "$(dirname "$0")/../.."
+. ./integration-lib.sh
+target_guard
+command -v python3 >/dev/null 2>&1 || test_skip_all "no python3"
+W=$(mktemp -d)
+trap 'rm -rf "$W"' EXIT
+counter() {
+ "$SHIRUDO_BIN" status --json | python3 -c '
+import json, sys
+print(json.load(sys.stdin)["tamper_attempts"]["counters"][sys.argv[1]])
+' "$1"
+}
+# Prints the errno name an open of $1 for reading fails with, or done.
+open_errno() {
+ python3 -c '
+import errno, os, sys
+try:
+ os.close(os.open(sys.argv[1], os.O_RDONLY))
+ print("done")
+except OSError as e:
+ print(errno.errorcode[e.errno])
+' "$1"
+}
+before=$(counter Lockdown) || test_skip_all "no tamper counters"
+
+if [ -e /proc/kcore ]; then
+ test_expect_success '/proc/kcore is refused and counted' '
+ [ "$(open_errno /proc/kcore)" = EPERM ] &&
+ [ "$(counter Lockdown)" -gt "$before" ]
+ '
+fi
+CONFIG=$(ls /sys/bus/pci/devices/*/config 2>/dev/null | head -1)
+if [ -n "$CONFIG" ]; then
+ # The interrupt line byte written back as it is, should the write pass.
+ test_expect_success 'a PCI config write is refused and counted' '
+ now=$(counter Lockdown) &&
+ python3 - "$CONFIG" >"$W/pci" <<-\PY &&
+ import errno, sys
+ with open(sys.argv[1], "r+b", buffering=0) as f:
+ f.seek(0x3c)
+ line = f.read(1)
+ f.seek(0x3c)
+ try:
+ f.write(line)
+ print("done")
+ except OSError as e:
+ print(errno.errorcode[e.errno])
+ PY
+ grep -qx EPERM "$W/pci" &&
+ [ "$(counter Lockdown)" -gt "$now" ]
+ '
+fi
+if [ -e /dev/mem ]; then
+ test_expect_success '/dev/mem is refused' '
+ [ "$(open_errno /dev/mem)" = EPERM ]
+ '
+fi
+test_expect_success 'reading /sys/power/state counts nothing' '
+ now=$(counter Lockdown) &&
+ cat /sys/power/state >/dev/null 2>&1 || :
+ [ "$(counter Lockdown)" -eq "$now" ]
+'
+test_done
diff --git a/testing/proofs/cbmc/proofs.list b/testing/proofs/cbmc/proofs.list
index 060432d8..2c5f903c 100644
--- a/testing/proofs/cbmc/proofs.list
+++ b/testing/proofs/cbmc/proofs.list
@@ -56,7 +56,7 @@ log-escape --unwind 7 LEN=0-5
json-emit-string --unwind 5 --unwindset json_string.0:27,put_string_n.0:5,put_raw.0:7,well_formed.0:27,replaced.0:5,memchr.0:9,memcmp.0:13 LEN=0-4
json-emit-buffer --unwind 1 --unwindset json_raw_value.0:5,harness.0:5 --malloc-may-fail --malloc-fail-null LEN=0-4
json-emit-nest --object-bits 12 --unwind 1 --unwindset json_text.0:57,sequences.0:4,sequences.1:5,any_depth.0:4,any_depth.1:4,strcmp.0:12,memchr.0:9,put_string_n.0:2,put_string_n.1:2,put_raw.0:8,json_kv_raw.0:3,json_raw_value.0:3,json_raw.0:5,strlen.0:3,vsnprintf.2:5,vsnprintf.0:2,format_number.0:3,format_number.2:5,format_number.3:3
-keepalive-emit -I ../../.. --object-bits 12 --max-field-sensitivity-array-size 832 --unwind 1 --unwindset json_members.0:833,power_of_ten.0:6,put_string_n.0:5,put_string_n.1:66,put_raw.0:7,strlen.0:66,hex_is_lower.0:66,kv_tamper.0:42,kv_no_tree.0:8,json_raw_value.0:6,vsnprintf.2:4,vsnprintf.0:2,format_number.0:6,format_number.2:5,format_number.3:6,ends_in_any_number.0:6,ends_in_any_number.1:833,ends_in_any_number.2:5 LEN=0-3
+keepalive-emit -I ../../.. --object-bits 12 --max-field-sensitivity-array-size 832 --unwind 1 --unwindset json_members.0:833,power_of_ten.0:6,put_string_n.0:5,put_string_n.1:66,put_raw.0:7,strlen.0:66,hex_is_lower.0:66,kv_tamper.0:43,kv_no_tree.0:8,json_raw_value.0:6,vsnprintf.2:4,vsnprintf.0:2,format_number.0:6,format_number.2:5,format_number.3:6,ends_in_any_number.0:6,ends_in_any_number.1:833,ends_in_any_number.2:5 LEN=0-3
json-string --unwind 5 --unwindset json_string.0:7,parse_string.0:5,parse_string.1:7,memchr.0:9,memcmp.0:7,harness.0:8 LEN=0-6
json-escape --unwind 5 --unwindset parse_string.0:4,memcmp.0:9
json-roundtrip --unwind 1 --unwindset put_string_n.0:5,put_string_n.1:5,put_raw.0:7,vsnprintf.2:4,vsnprintf.0:2,format_number.0:3,format_number.2:5,format_number.3:3,parse_string.1:6,parse_string.0:4,hex4.0:5,utf8_width.0:4,memcmp.0:5 LEN=0-4
diff --git a/testing/unit/keepalive.c b/testing/unit/keepalive.c
index 6a47c223..8ad5332c 100644
--- a/testing/unit/keepalive.c
+++ b/testing/unit/keepalive.c
@@ -595,17 +595,17 @@ static const char * const tamper_order[] = {
"SealRename", "SealSetattr", "SealXattr", "SealLabel", "SealPtrace",
"SealPerf", "ExecTraced", "SealEntry", "PerfAttach", "PinEntry",
"SealCopyUp", "Kexec", "TpmExtend", "ObjGet", "SealSignal",
- "SealCoreDump", "SealUprobe", "ExecShared", "XattrHandle",
+ "SealCoreDump", "SealUprobe", "ExecShared", "XattrHandle", "Lockdown",
};
static void tamper_counters_keep_their_places(void)
{
size_t i;
- ASSERT_EQ(ARRAY_SIZE(tamper_order), 41);
+ ASSERT_EQ(ARRAY_SIZE(tamper_order), 42);
ASSERT_EQ(TAMPER_MAX, ARRAY_SIZE(tamper_order));
EXPECT_EQ(TAMPER_LOAD_NOT_LOADER, 0);
- EXPECT_EQ(TAMPER_XATTR_HANDLE, TAMPER_MAX - 1);
+ EXPECT_EQ(TAMPER_LOCKDOWN, TAMPER_MAX - 1);
for (i = 0; i < ARRAY_SIZE(tamper_order); i++)
EXPECT_STREQ(tamper_name(i), tamper_order[i]);
}
@@ -622,7 +622,7 @@ static void body_lists_the_counters_in_enum_order(void)
in.tamper = tamper;
expect_member(&in, ",\"tamper\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,"
"16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,"
- "34,35,36,18446744073709551615,38,39,40,41],\"tree_id\":");
+ "34,35,36,18446744073709551615,38,39,40,41,42],\"tree_id\":");
}
static void body_refuses_a_missing_string(void)
@@ -742,7 +742,7 @@ static void body_of_the_largest_values_fits(void)
in.tamper = tamper;
ASSERT_EQ(keepalive_emit(&in, body, sizeof(body), &whole), 0);
- EXPECT_EQ(whole, 3382);
+ EXPECT_EQ(whole, 3403);
EXPECT_LT(whole, KEEPALIVE_BODY_MAX);
EXPECT_EQ(keepalive_emit(&in, body, whole, &len), -ENOSPC);
EXPECT_EQ(keepalive_emit(&in, body, whole + 1, &len), 0);
diff --git a/util/image_guards.c b/util/image_guards.c
index 7f5e787d..0aaeea71 100644
--- a/util/image_guards.c
+++ b/util/image_guards.c
@@ -99,6 +99,8 @@ shirudo_observer_guards[OBSERVER_HOOK_COUNT] = {
BPFFS_DIR "/kernel_load_data_link" },
{ "shirudo_lsm_kernel_read_file",
BPFFS_DIR "/kernel_read_file_link" },
+ { "shirudo_lsm_locked_down",
+ BPFFS_DIR "/locked_down_link" },
};
const struct image_guard
diff --git a/util/image_guards.h b/util/image_guards.h
index 91b90c16..af71a2d8 100644
--- a/util/image_guards.h
+++ b/util/image_guards.h
@@ -11,7 +11,7 @@
#define SEAL_HOOK_COUNT 27
#define IMAGE_SEAL_HOOK_COUNT 2
#define MOUNT_HOOK_COUNT 5
-#define OBSERVER_HOOK_COUNT 9
+#define OBSERVER_HOOK_COUNT 10
#define IMAGE_OBSERVER_HOOK_COUNT 4
struct image_guard {
diff --git a/util/tamper.c b/util/tamper.c
index 186be435..8290f125 100644
--- a/util/tamper.c
+++ b/util/tamper.c
@@ -102,6 +102,8 @@ static const struct {
"exec of the runtime binary by a task that shares its file system context" },
[TAMPER_XATTR_HANDLE] = { "XattrHandle",
"XFS attribute change by file handle, which passes no xattr hook" },
+ [TAMPER_LOCKDOWN] = { "Lockdown",
+ "change or read of the running kernel that lockdown refuses" },
};
const char *tamper_name(enum tamper_point point)