linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] lsm: introduce lsm_manage_policy() syscall
@ 2025-05-06 14:32 Maxime Bélair
  2025-05-06 14:32 ` [PATCH 1/3] Wire up the lsm_manage_policy syscall Maxime Bélair
                   ` (2 more replies)
  0 siblings, 3 replies; 36+ messages in thread
From: Maxime Bélair @ 2025-05-06 14:32 UTC (permalink / raw)
  To: linux-security-module
  Cc: john.johansen, paul, jmorris, serge, mic, kees,
	stephen.smalley.work, casey, takedakn, penguin-kernel, linux-api,
	apparmor, linux-kernel, Maxime Bélair

This patchset introduces a new syscall, lsm_manage_policy(), and the
associated Linux Security Module hook security_lsm_manage_policy(),
providing a unified interface for loading and managing LSM policies.
This syscall complements the existing per‑LSM pseudo‑filesystem mechanism
and works even when those filesystems are not mounted or available.

With this new syscall, administrators may lock down access to the
pseudo‑filesystem yet still manage LSM policies. A single, tightly scoped
entry point then replaces the many file operations exposed by those
filesystems, significantly reducing the attack surface. This is
particularly useful in containers or processes already confined by
Landlock, where these pseudo‑filesystems are typically unavailable.

Because it provides a logical and unified interface, lsm_manage_policy()
is simpler to use than several heterogeneous pseudo‑filesystems and
avoids edge cases such as partially loaded policies. It also eliminates
VFS overhead, yielding performance gains notably when many policies are
loaded, for instance at boot time.

This initial implementation is intentionally minimal to limit the scope
of changes. Currently, only policy loading is supported, and only
AppArmor registers this LSM hook. However, any LSM can adopt this
interface, and future patches could extend this syscall to support more
operations, such as replacing, removing, or querying loaded policies.

Landlock already provides three Landlock‑specific syscalls (e.g.
landlock_add_rule()) to restrict ambient rights for sets of processes
without touching any pseudo-filesystem. lsm_manage_policy() generalizes
that approach to the entire LSM layer, so any module can expose its
policy operations through one uniform interface and reap the advantages
outlined above.

This patchset is available at [1] and a minimal user space example
showing how to use this syscall with AppArmor is at [2].

[1] https://github.com/emixam16/linux/tree/lsm_syscall
[2] https://gitlab.com/emixam16/apparmor/tree/lsm_syscall

Maxime Bélair (3):
  Wire up the lsm_manage_policy syscall
  lsm: introduce security_lsm_manage_policy hook
  AppArmor: add support for lsm_manage_policy

 arch/alpha/kernel/syscalls/syscall.tbl        |  1 +
 arch/arm/tools/syscall.tbl                    |  1 +
 arch/x86/entry/syscalls/syscall_32.tbl        |  1 +
 arch/x86/entry/syscalls/syscall_64.tbl        |  1 +
 include/linux/lsm_hook_defs.h                 |  2 ++
 include/linux/security.h                      |  7 +++++++
 include/linux/syscalls.h                      |  4 ++++
 include/uapi/asm-generic/unistd.h             |  4 +++-
 include/uapi/linux/lsm.h                      |  8 +++++++
 kernel/sys_ni.c                               |  1 +
 security/apparmor/apparmorfs.c                | 19 +++++++++++++++++
 security/apparmor/include/apparmorfs.h        |  3 +++
 security/apparmor/lsm.c                       | 16 ++++++++++++++
 security/lsm_syscalls.c                       | 11 ++++++++++
 security/security.c                           | 21 +++++++++++++++++++
 tools/include/uapi/asm-generic/unistd.h       |  4 +++-
 .../arch/x86/entry/syscalls/syscall_64.tbl    |  1 +
 17 files changed, 103 insertions(+), 2 deletions(-)


base-commit: 9c32cda43eb78f78c73aee4aa344b777714e259b
-- 
2.48.1


^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2025-05-17  7:59 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-06 14:32 [PATCH 0/3] lsm: introduce lsm_manage_policy() syscall Maxime Bélair
2025-05-06 14:32 ` [PATCH 1/3] Wire up the lsm_manage_policy syscall Maxime Bélair
2025-05-07  6:26   ` Song Liu
2025-05-07 15:37     ` Maxime Bélair
2025-05-07 22:04       ` Tetsuo Handa
2025-05-08  7:52         ` John Johansen
2025-05-09 10:25           ` Mickaël Salaün
2025-05-11 11:09             ` John Johansen
2025-05-08  6:06       ` Song Liu
2025-05-08  8:18         ` John Johansen
2025-05-09 10:26           ` Mickaël Salaün
2025-05-11 10:47             ` John Johansen
2025-05-12 10:20               ` Mickaël Salaün
2025-05-17  7:59                 ` John Johansen
2025-05-08  7:12     ` John Johansen
2025-05-07 13:58   ` kernel test robot
2025-05-06 14:32 ` [PATCH 2/3] lsm: introduce security_lsm_manage_policy hook Maxime Bélair
2025-05-07  6:19   ` Song Liu
2025-05-07 15:37     ` Maxime Bélair
2025-05-08  8:20       ` John Johansen
2025-05-07 10:40   ` Tetsuo Handa
2025-05-07 15:37     ` Maxime Bélair
2025-05-07 20:25     ` Paul Moore
2025-05-08  8:29       ` John Johansen
2025-05-08 16:54         ` Casey Schaufler
2025-05-09 10:26           ` Mickaël Salaün
2025-05-09 14:21             ` Casey Schaufler
2025-05-11 11:26               ` John Johansen
2025-05-11 11:20             ` John Johansen
2025-05-08  8:25     ` John Johansen
2025-05-08 12:55       ` Tetsuo Handa
2025-05-08 14:44         ` John Johansen
2025-05-08 15:07           ` Tetsuo Handa
2025-05-09  3:25             ` John Johansen
2025-05-07 12:04   ` kernel test robot
2025-05-06 14:32 ` [PATCH 3/3] AppArmor: add support for lsm_manage_policy Maxime Bélair

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).