[RFC PATCH v2 0/6] security: introduce Kernel Assurance Plane
flat view
WARM2d
From: Ketan Bhardwaj <hidden>
Date: 2026-10-28 13:33:44
Also in:
linux-doc, linux-security-module, lkml
Subsystem:
documentation, exec & binfmt api, elf, memory management - core, scheduler, security subsystem, the rest · Maintainers:
Jonathan Corbet, Kees Cook, Andrew Morton, David Hildenbrand, Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot, Paul Moore, James Morris, "Serge E. Hallyn", Linus Torvalds
Kernel Assurance Plane (KAP) introduces objective-scoped authority as a kernel subsystem. Intent Lineage Groups (igroups) are its core kernel object, LSM hooks are its enforcement mechanism, and securityfs is its control-plane interface. Linux decides whether a task may perform an operation. It does not decide whether the operation still belongs to the objective the task was started for, which matters once long-running agents start programs, edit files and open connections on a user's behalf. KAP binds a task and its descendants to an igroup holding the authority compiled for that objective, and refuses operations outside it at existing LSM hooks. Planning and policy validation stay in privileged userspace. v1 [1] was the design document alone. This version adds the implementation it describes. An earlier revision of this code runs on Linux 6.18 as the guest kernel of Kata microVMs. There, under nested virtualization and in a single run, running the same binary unbound and then bound, enforcement added 154 ns to a read and 787 ns to an open, while the unhooked getpid control did not move. This version has not been measured yet. Changes since v1: * Add the implementation: the LSM and its igroup decision engine (3/6), the securityfs control plane (4/6), and checks on unshare and setns (5/6). * Documentation: drop the admin-guide/LSM index entry, which pointed at a page that does not exist (Randy Dunlap). Describe the authority format, kap.igfd, kap.transition and the event fields as implemented, and drop "It does not add code". * Add a MAINTAINERS entry (6/6). The control plane follows the shape discussed for v1: /sys/kernel/security/kap holds kap.default and an igroups link to a small internal filesystem, as AppArmor publishes its policy namespaces, so an igroup is created with mkdir as a cgroup is. Known gaps, where feedback is welcome: * The authority format 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 (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: 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@armoriq.io/ (local) Base commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907 (Linux 7.3-rc7) Ketan Bhardwaj (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 | 236 ++++++ 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 | 945 +++++++++++++++++++++++ security/kap/kap.h | 159 ++++ security/kap/kap_lsm.c | 866 +++++++++++++++++++++ security/kap/kapfs.c | 524 +++++++++++++ 17 files changed, 2904 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.51.0