[RFC PATCH v4 0/6] security: introduce Kernel Assurance Plane

From: HARIHARA SUDHAN. R

Date: Mon Nov 23 2026 - 06:44:05 EST


Kernel Assurance Plane (KAP) adds an objective-scoped authority context as a
kernel object. An Intent Lineage Group (igroup) is that object: an externally
managed authority whose lifetime is tied to an objective rather than to a
process, a thread group or a sandbox, that a trusted controller can update or
revoke in place while unmodified worker tasks keep running.

v1 [1] was the design document. v2 added the implementation and moved the
control plane under securityfs. v3 [2] reworked the design document to answer
the v2 review. This version folds in the v3 review: automated review findings
and a request to put a diffstat on the cover letter. The design and the model
are unchanged from v3.

Changes since v3:

* Fixes from automated review (3/6, the LSM). Each was checked against the
source; findings that did not reproduce were left alone.
- Fix a use-after-free in the link check: the source parent dentry was read
and then used across a sleeping allocation and d_path, where a concurrent
rename could free it. Pin it with dget_parent and release it after.
- Fix an uninitialised-stack infoleak on a short connect(): the target
render read the address and port before addrlen was known to cover them.
Require a family-sized addrlen and otherwise leave the address for the
protocol layer to reject.
- Close a fail-open path: when a mapping's backing path cannot be resolved,
mmap and mprotect now run the execmem predicate with an unresolved target,
so a revoked or expired igroup still denies rather than allowing the map.
- Normalise /proc/self to the thread-group leader in the current PID
namespace (task_tgid_vnr) rather than this thread's global PID.
- Do not let an exact-path deny be slipped by unlinking the file first:
d_path renders an unlinked file as "<path> (deleted)", so strip that
suffix before matching.
- Match a user-namespace create as "user:create" so a "user:*" allow or
deny applies, rather than a bare "user" that only matched a wildcard.
- Guard the transition-sequence parser against u64 overflow.
- Reject a lineage root that carries control characters or the JSON string
metacharacters, since it is written verbatim into the kap.events JSON.
* Control plane (4/6, securityfs).
- kapfs now sets its superblock operations (simple_statfs), block size and
time granularity.
- Validate the lineage-root write the same way as above.
* Design document (1/6).
- Clarify the epoch semantics, which were contradictory: a running task is
narrowed by installing a new authority at the same epoch, which re-points
the bound task without interrupting it; raising the epoch is what revokes
a task, failing its checks closed until it is bound again.
* Cover letter: add the diffstat (thanks, Lorenzo).

The prototype runs as the guest kernel of Kata microVMs (Linux 6.18) and of
Docker Sandboxes (Linux 7.0). In a Kata guest under nested virtualization,
running the same binary unbound and then bound, enforcement adds 154 ns to a
read and 787 ns to an open, while the unhooked getpid control does not move. On
Docker Sandboxes, allow, deny and revoke were exercised on a real agent.

Known gaps, where feedback is welcome:

* Whether KAP should keep its own mediation or compose with Landlock and
existing hooks is open and is question 1; the current series is the
self-contained form.
* The authority wire form is a strict subset of JSON and is experimental.
* Decisions are serialized by one spinlock, and those that resolve a path
allocate a PATH_MAX buffer before taking it. Both are prototype choices.
* igroups cannot be removed yet, and kap.procs keeps the pids written to it
after those tasks exit. A task's binding lives in its task blob and is
released with it.
* A thread created while its process is being bound can miss the binding.
cgroups closes the same race with cgroup_threadgroup_rwsem; KAP does not yet.
* Control writes need CAP_SYS_ADMIN. CAP_MAC_ADMIN may be the better fit.
* unshare and setns call KAP directly because they have no LSM hook in this
base (question 5 in the document).
* There are no selftests in this series yet. It was built with and without KAP
and with networking, namespaces and io_uring disabled, and boot tested in
QEMU with lock debugging (PROVE_LOCKING and DEBUG_ATOMIC_SLEEP): the control
plane, file and exec decisions, epoch revocation of a running task and
kap.default.
* The LSM ID is provisional and is for the LSM maintainers to confirm.

[1] https://lore.kernel.org/linux-security-module/20261021165748.19304-1-ketan@xxxxxxxxxx/
[2] https://lore.kernel.org/linux-security-module/20261110202246.274-1-harisudhan@xxxxxxxxxx/


HARIHARA SUDHAN. R (6):
docs: security: Describe the Kernel Assurance Plane design
security: kap: add the LSM ID and internal headers
security: add the Kernel Assurance Plane LSM
security: kap: add the securityfs control plane
kernel: add KAP checks for unshare and setns
MAINTAINERS: add an entry for the Kernel Assurance Plane

Documentation/ABI/testing/securityfs-kap | 111 +++
Documentation/security/index.rst | 1 +
Documentation/security/kap.rst | 341 ++++++++
MAINTAINERS | 10 +
include/linux/kap.h | 16 +
include/linux/lsm_count.h | 9 +-
include/uapi/linux/lsm.h | 1 +
kernel/fork.c | 4 +
kernel/nsproxy.c | 5 +
security/Kconfig | 1 +
security/Makefile | 1 +
security/kap/Kconfig | 14 +
security/kap/Makefile | 2 +
security/kap/igroup.c | 976 +++++++++++++++++++++++
security/kap/kap.h | 160 ++++
security/kap/kap_lsm.c | 903 +++++++++++++++++++++
security/kap/kapfs.c | 530 ++++++++++++
17 files changed, 3084 insertions(+), 1 deletion(-)
create mode 100644 Documentation/ABI/testing/securityfs-kap
create mode 100644 Documentation/security/kap.rst
create mode 100644 include/linux/kap.h
create mode 100644 security/kap/Kconfig
create mode 100644 security/kap/Makefile
create mode 100644 security/kap/igroup.c
create mode 100644 security/kap/kap.h
create mode 100644 security/kap/kap_lsm.c
create mode 100644 security/kap/kapfs.c


base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
--
2.43.0