mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
Merge tag 'lsm-pr-20240105' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm
Pull security module updates from Paul Moore: - Add three new syscalls: lsm_list_modules(), lsm_get_self_attr(), and lsm_set_self_attr(). The first syscall simply lists the LSMs enabled, while the second and third get and set the current process' LSM attributes. Yes, these syscalls may provide similar functionality to what can be found under /proc or /sys, but they were designed to support multiple, simultaneaous (stacked) LSMs from the start as opposed to the current /proc based solutions which were created at a time when only one LSM was allowed to be active at a given time. We have spent considerable time discussing ways to extend the existing /proc interfaces to support multiple, simultaneaous LSMs and even our best ideas have been far too ugly to support as a kernel API; after +20 years in the kernel, I felt the LSM layer had established itself enough to justify a handful of syscalls. Support amongst the individual LSM developers has been nearly unanimous, with a single objection coming from Tetsuo (TOMOYO) as he is worried that the LSM_ID_XXX token concept will make it more difficult for out-of-tree LSMs to survive. Several members of the LSM community have demonstrated the ability for out-of-tree LSMs to continue to exist by picking high/unused LSM_ID values as well as pointing out that many kernel APIs rely on integer identifiers, e.g. syscalls (!), but unfortunately Tetsuo's objections remain. My personal opinion is that while I have no interest in penalizing out-of-tree LSMs, I'm not going to penalize in-tree development to support out-of-tree development, and I view this as a necessary step forward to support the push for expanded LSM stacking and reduce our reliance on /proc and /sys which has occassionally been problematic for some container users. Finally, we have included the linux-api folks on (all?) recent revisions of the patchset and addressed all of their concerns. - Add a new security_file_ioctl_compat() LSM hook to handle the 32-bit ioctls on 64-bit systems problem. This patch includes support for all of the existing LSMs which provide ioctl hooks, although it turns out only SELinux actually cares about the individual ioctls. It is worth noting that while Casey (Smack) and Tetsuo (TOMOYO) did not give explicit ACKs to this patch, they did both indicate they are okay with the changes. - Fix a potential memory leak in the CALIPSO code when IPv6 is disabled at boot. While it's good that we are fixing this, I doubt this is something users are seeing in the wild as you need to both disable IPv6 and then attempt to configure IPv6 labeled networking via NetLabel/CALIPSO; that just doesn't make much sense. Normally this would go through netdev, but Jakub asked me to take this patch and of all the trees I maintain, the LSM tree seemed like the best fit. - Update the LSM MAINTAINERS entry with additional information about our process docs, patchwork, bug reporting, etc. I also noticed that the Lockdown LSM is missing a dedicated MAINTAINERS entry so I've added that to the pull request. I've been working with one of the major Lockdown authors/contributors to see if they are willing to step up and assume a Lockdown maintainer role; hopefully that will happen soon, but in the meantime I'll continue to look after it. - Add a handful of mailmap entries for Serge Hallyn and myself. * tag 'lsm-pr-20240105' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm: (27 commits) lsm: new security_file_ioctl_compat() hook lsm: Add a __counted_by() annotation to lsm_ctx.ctx calipso: fix memory leak in netlbl_calipso_add_pass() selftests: remove the LSM_ID_IMA check in lsm/lsm_list_modules_test MAINTAINERS: add an entry for the lockdown LSM MAINTAINERS: update the LSM entry mailmap: add entries for Serge Hallyn's dead accounts mailmap: update/replace my old email addresses lsm: mark the lsm_id variables are marked as static lsm: convert security_setselfattr() to use memdup_user() lsm: align based on pointer length in lsm_fill_user_ctx() lsm: consolidate buffer size handling into lsm_fill_user_ctx() lsm: correct error codes in security_getselfattr() lsm: cleanup the size counters in security_getselfattr() lsm: don't yet account for IMA in LSM_CONFIG_COUNT calculation lsm: drop LSM_ID_IMA LSM: selftests for Linux Security Module syscalls SELinux: Add selfattr hooks AppArmor: Add selfattr hooks Smack: implement setselfattr and getselfattr hooks ...
This commit is contained in:
4
.mailmap
4
.mailmap
@@ -478,6 +478,8 @@ Paul E. McKenney <paulmck@kernel.org> <paulmck@linux.vnet.ibm.com>
|
||||
Paul E. McKenney <paulmck@kernel.org> <paulmck@us.ibm.com>
|
||||
Paul Mackerras <paulus@ozlabs.org> <paulus@samba.org>
|
||||
Paul Mackerras <paulus@ozlabs.org> <paulus@au1.ibm.com>
|
||||
Paul Moore <paul@paul-moore.com> <paul.moore@hp.com>
|
||||
Paul Moore <paul@paul-moore.com> <pmoore@redhat.com>
|
||||
Pavankumar Kondeti <quic_pkondeti@quicinc.com> <pkondeti@codeaurora.org>
|
||||
Peter A Jonsson <pj@ludd.ltu.se>
|
||||
Peter Oruba <peter.oruba@amd.com>
|
||||
@@ -542,6 +544,8 @@ Sebastian Reichel <sre@kernel.org> <sebastian.reichel@collabora.co.uk>
|
||||
Sebastian Reichel <sre@kernel.org> <sre@debian.org>
|
||||
Sedat Dilek <sedat.dilek@gmail.com> <sedat.dilek@credativ.de>
|
||||
Senthilkumar N L <quic_snlakshm@quicinc.com> <snlakshm@codeaurora.org>
|
||||
Serge Hallyn <sergeh@kernel.org> <serge.hallyn@canonical.com>
|
||||
Serge Hallyn <sergeh@kernel.org> <serue@us.ibm.com>
|
||||
Seth Forshee <sforshee@kernel.org> <seth.forshee@canonical.com>
|
||||
Shannon Nelson <shannon.nelson@amd.com> <snelson@pensando.io>
|
||||
Shannon Nelson <shannon.nelson@amd.com> <shannon.nelson@intel.com>
|
||||
|
||||
@@ -33,6 +33,7 @@ place where this information is gathered.
|
||||
sysfs-platform_profile
|
||||
vduse
|
||||
futex2
|
||||
lsm
|
||||
|
||||
.. only:: subproject and html
|
||||
|
||||
|
||||
73
Documentation/userspace-api/lsm.rst
Normal file
73
Documentation/userspace-api/lsm.rst
Normal file
@@ -0,0 +1,73 @@
|
||||
.. SPDX-License-Identifier: GPL-2.0
|
||||
.. Copyright (C) 2022 Casey Schaufler <casey@schaufler-ca.com>
|
||||
.. Copyright (C) 2022 Intel Corporation
|
||||
|
||||
=====================================
|
||||
Linux Security Modules
|
||||
=====================================
|
||||
|
||||
:Author: Casey Schaufler
|
||||
:Date: July 2023
|
||||
|
||||
Linux security modules (LSM) provide a mechanism to implement
|
||||
additional access controls to the Linux security policies.
|
||||
|
||||
The various security modules may support any of these attributes:
|
||||
|
||||
``LSM_ATTR_CURRENT`` is the current, active security context of the
|
||||
process.
|
||||
The proc filesystem provides this value in ``/proc/self/attr/current``.
|
||||
This is supported by the SELinux, Smack and AppArmor security modules.
|
||||
Smack also provides this value in ``/proc/self/attr/smack/current``.
|
||||
AppArmor also provides this value in ``/proc/self/attr/apparmor/current``.
|
||||
|
||||
``LSM_ATTR_EXEC`` is the security context of the process at the time the
|
||||
current image was executed.
|
||||
The proc filesystem provides this value in ``/proc/self/attr/exec``.
|
||||
This is supported by the SELinux and AppArmor security modules.
|
||||
AppArmor also provides this value in ``/proc/self/attr/apparmor/exec``.
|
||||
|
||||
``LSM_ATTR_FSCREATE`` is the security context of the process used when
|
||||
creating file system objects.
|
||||
The proc filesystem provides this value in ``/proc/self/attr/fscreate``.
|
||||
This is supported by the SELinux security module.
|
||||
|
||||
``LSM_ATTR_KEYCREATE`` is the security context of the process used when
|
||||
creating key objects.
|
||||
The proc filesystem provides this value in ``/proc/self/attr/keycreate``.
|
||||
This is supported by the SELinux security module.
|
||||
|
||||
``LSM_ATTR_PREV`` is the security context of the process at the time the
|
||||
current security context was set.
|
||||
The proc filesystem provides this value in ``/proc/self/attr/prev``.
|
||||
This is supported by the SELinux and AppArmor security modules.
|
||||
AppArmor also provides this value in ``/proc/self/attr/apparmor/prev``.
|
||||
|
||||
``LSM_ATTR_SOCKCREATE`` is the security context of the process used when
|
||||
creating socket objects.
|
||||
The proc filesystem provides this value in ``/proc/self/attr/sockcreate``.
|
||||
This is supported by the SELinux security module.
|
||||
|
||||
Kernel interface
|
||||
================
|
||||
|
||||
Set a security attribute of the current process
|
||||
-----------------------------------------------
|
||||
|
||||
.. kernel-doc:: security/lsm_syscalls.c
|
||||
:identifiers: sys_lsm_set_self_attr
|
||||
|
||||
Get the specified security attributes of the current process
|
||||
------------------------------------------------------------
|
||||
|
||||
.. kernel-doc:: security/lsm_syscalls.c
|
||||
:identifiers: sys_lsm_get_self_attr
|
||||
|
||||
.. kernel-doc:: security/lsm_syscalls.c
|
||||
:identifiers: sys_lsm_list_modules
|
||||
|
||||
Additional documentation
|
||||
========================
|
||||
|
||||
* Documentation/security/lsm.rst
|
||||
* Documentation/security/lsm-development.rst
|
||||
17
MAINTAINERS
17
MAINTAINERS
@@ -12417,6 +12417,12 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/har
|
||||
F: Documentation/admin-guide/LSM/LoadPin.rst
|
||||
F: security/loadpin/
|
||||
|
||||
LOCKDOWN SECURITY MODULE
|
||||
L: linux-security-module@vger.kernel.org
|
||||
S: Odd Fixes
|
||||
T: git https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm.git
|
||||
F: security/lockdown/
|
||||
|
||||
LOCKING PRIMITIVES
|
||||
M: Peter Zijlstra <peterz@infradead.org>
|
||||
M: Ingo Molnar <mingo@redhat.com>
|
||||
@@ -19455,12 +19461,17 @@ SECURITY SUBSYSTEM
|
||||
M: Paul Moore <paul@paul-moore.com>
|
||||
M: James Morris <jmorris@namei.org>
|
||||
M: "Serge E. Hallyn" <serge@hallyn.com>
|
||||
L: linux-security-module@vger.kernel.org (suggested Cc:)
|
||||
L: linux-security-module@vger.kernel.org
|
||||
S: Supported
|
||||
W: http://kernsec.org/
|
||||
T: git git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm.git
|
||||
Q: https://patchwork.kernel.org/project/linux-security-module/list
|
||||
B: mailto:linux-security-module@vger.kernel.org
|
||||
P: https://github.com/LinuxSecurityModule/kernel/blob/main/README.md
|
||||
T: git https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm.git
|
||||
F: include/uapi/linux/lsm.h
|
||||
F: security/
|
||||
F: tools/testing/selftests/lsm/
|
||||
X: security/selinux/
|
||||
K: \bsecurity_[a-z_0-9]\+\b
|
||||
|
||||
SELINUX SECURITY MODULE
|
||||
M: Paul Moore <paul@paul-moore.com>
|
||||
|
||||
@@ -498,3 +498,6 @@
|
||||
566 common futex_requeue sys_futex_requeue
|
||||
567 common statmount sys_statmount
|
||||
568 common listmount sys_listmount
|
||||
569 common lsm_get_self_attr sys_lsm_get_self_attr
|
||||
570 common lsm_set_self_attr sys_lsm_set_self_attr
|
||||
571 common lsm_list_modules sys_lsm_list_modules
|
||||
|
||||
@@ -472,3 +472,6 @@
|
||||
456 common futex_requeue sys_futex_requeue
|
||||
457 common statmount sys_statmount
|
||||
458 common listmount sys_listmount
|
||||
459 common lsm_get_self_attr sys_lsm_get_self_attr
|
||||
460 common lsm_set_self_attr sys_lsm_set_self_attr
|
||||
461 common lsm_list_modules sys_lsm_list_modules
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5)
|
||||
#define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800)
|
||||
|
||||
#define __NR_compat_syscalls 459
|
||||
#define __NR_compat_syscalls 462
|
||||
#endif
|
||||
|
||||
#define __ARCH_WANT_SYS_CLONE
|
||||
|
||||
@@ -923,6 +923,12 @@ __SYSCALL(__NR_futex_requeue, sys_futex_requeue)
|
||||
__SYSCALL(__NR_statmount, sys_statmount)
|
||||
#define __NR_listmount 458
|
||||
__SYSCALL(__NR_listmount, sys_listmount)
|
||||
#define __NR_lsm_get_self_attr 459
|
||||
__SYSCALL(__NR_lsm_get_self_attr, sys_lsm_get_self_attr)
|
||||
#define __NR_lsm_set_self_attr 460
|
||||
__SYSCALL(__NR_lsm_set_self_attr, sys_lsm_set_self_attr)
|
||||
#define __NR_lsm_list_modules 461
|
||||
__SYSCALL(__NR_lsm_list_modules, sys_lsm_list_modules)
|
||||
|
||||
/*
|
||||
* Please add new compat syscalls above this comment and update
|
||||
|
||||
@@ -458,3 +458,6 @@
|
||||
456 common futex_requeue sys_futex_requeue
|
||||
457 common statmount sys_statmount
|
||||
458 common listmount sys_listmount
|
||||
459 common lsm_get_self_attr sys_lsm_get_self_attr
|
||||
460 common lsm_set_self_attr sys_lsm_set_self_attr
|
||||
461 common lsm_list_modules sys_lsm_list_modules
|
||||
|
||||
@@ -464,3 +464,6 @@
|
||||
456 common futex_requeue sys_futex_requeue
|
||||
457 common statmount sys_statmount
|
||||
458 common listmount sys_listmount
|
||||
459 common lsm_get_self_attr sys_lsm_get_self_attr
|
||||
460 common lsm_set_self_attr sys_lsm_set_self_attr
|
||||
461 common lsm_list_modules sys_lsm_list_modules
|
||||
|
||||
@@ -397,3 +397,6 @@
|
||||
456 n32 futex_requeue sys_futex_requeue
|
||||
457 n32 statmount sys_statmount
|
||||
458 n32 listmount sys_listmount
|
||||
459 n32 lsm_get_self_attr sys_lsm_get_self_attr
|
||||
460 n32 lsm_set_self_attr sys_lsm_set_self_attr
|
||||
461 n32 lsm_list_modules sys_lsm_list_modules
|
||||
|
||||
@@ -373,3 +373,6 @@
|
||||
456 n64 futex_requeue sys_futex_requeue
|
||||
457 n64 statmount sys_statmount
|
||||
458 n64 listmount sys_listmount
|
||||
459 n64 lsm_get_self_attr sys_lsm_get_self_attr
|
||||
460 n64 lsm_set_self_attr sys_lsm_set_self_attr
|
||||
461 n64 lsm_list_modules sys_lsm_list_modules
|
||||
|
||||
@@ -446,3 +446,6 @@
|
||||
456 o32 futex_requeue sys_futex_requeue
|
||||
457 o32 statmount sys_statmount
|
||||
458 o32 listmount sys_listmount
|
||||
459 o32 lsm_get_self_attr sys_lsm_get_self_attr
|
||||
460 o32 lsm_set_self_attr sys_lsm_set_self_attr
|
||||
461 o32 lsm_list_modules sys_lsm_list_modules
|
||||
|
||||
@@ -457,3 +457,6 @@
|
||||
456 common futex_requeue sys_futex_requeue
|
||||
457 common statmount sys_statmount
|
||||
458 common listmount sys_listmount
|
||||
459 common lsm_get_self_attr sys_lsm_get_self_attr
|
||||
460 common lsm_set_self_attr sys_lsm_set_self_attr
|
||||
461 common lsm_list_modules sys_lsm_list_modules
|
||||
|
||||
@@ -545,3 +545,6 @@
|
||||
456 common futex_requeue sys_futex_requeue
|
||||
457 common statmount sys_statmount
|
||||
458 common listmount sys_listmount
|
||||
459 common lsm_get_self_attr sys_lsm_get_self_attr
|
||||
460 common lsm_set_self_attr sys_lsm_set_self_attr
|
||||
461 common lsm_list_modules sys_lsm_list_modules
|
||||
|
||||
@@ -461,3 +461,6 @@
|
||||
456 common futex_requeue sys_futex_requeue sys_futex_requeue
|
||||
457 common statmount sys_statmount sys_statmount
|
||||
458 common listmount sys_listmount sys_listmount
|
||||
459 common lsm_get_self_attr sys_lsm_get_self_attr sys_lsm_get_self_attr
|
||||
460 common lsm_set_self_attr sys_lsm_set_self_attr sys_lsm_set_self_attr
|
||||
461 common lsm_list_modules sys_lsm_list_modules sys_lsm_list_modules
|
||||
|
||||
@@ -461,3 +461,6 @@
|
||||
456 common futex_requeue sys_futex_requeue
|
||||
457 common statmount sys_statmount
|
||||
458 common listmount sys_listmount
|
||||
459 common lsm_get_self_attr sys_lsm_get_self_attr
|
||||
460 common lsm_set_self_attr sys_lsm_set_self_attr
|
||||
461 common lsm_list_modules sys_lsm_list_modules
|
||||
|
||||
@@ -504,3 +504,6 @@
|
||||
456 common futex_requeue sys_futex_requeue
|
||||
457 common statmount sys_statmount
|
||||
458 common listmount sys_listmount
|
||||
459 common lsm_get_self_attr sys_lsm_get_self_attr
|
||||
460 common lsm_set_self_attr sys_lsm_set_self_attr
|
||||
461 common lsm_list_modules sys_lsm_list_modules
|
||||
|
||||
@@ -463,3 +463,6 @@
|
||||
456 i386 futex_requeue sys_futex_requeue
|
||||
457 i386 statmount sys_statmount
|
||||
458 i386 listmount sys_listmount
|
||||
459 i386 lsm_get_self_attr sys_lsm_get_self_attr
|
||||
460 i386 lsm_set_self_attr sys_lsm_set_self_attr
|
||||
461 i386 lsm_list_modules sys_lsm_list_modules
|
||||
|
||||
@@ -380,6 +380,9 @@
|
||||
456 common futex_requeue sys_futex_requeue
|
||||
457 common statmount sys_statmount
|
||||
458 common listmount sys_listmount
|
||||
459 common lsm_get_self_attr sys_lsm_get_self_attr
|
||||
460 common lsm_set_self_attr sys_lsm_set_self_attr
|
||||
461 common lsm_list_modules sys_lsm_list_modules
|
||||
|
||||
#
|
||||
# Due to a historical design error, certain syscalls are numbered differently
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user