Skip to content

LSM: Replace secctx/len pairs with lsm_context

Casey Schaufler audit ceph-devel linux-integrity linux-nfs linux-security-module lkml netdev netfilter-devel selinux 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest5 patches 31 repliesIn review
  2. v26 patches 15 repliesSuperseded
  3. v15 patches 1 replySuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5LSM: Ensure the correct LSM context releaserdrivers/android/binder.c fs/ceph/xattr.c fs/nfs/nfs4proc.c +16 more+165 -1073 replies
2/5LSM: Replace context+len with lsm_contextdrivers/android/binder.c include/linux/lsm_hook_defs.h include/linux/security.h +14 more+118 -12112 replies
3/5LSM: Use lsm_context in security_inode_getsecctxfs/nfsd/nfs4xdr.c include/linux/lsm_hook_defs.h include/linux/security.h +3 more+31 -331 reply
4/5LSM: lsm_context in security_dentry_init_securityfs/ceph/super.h fs/ceph/xattr.c fs/fuse/dir.c +5 more+50 -7014 replies
5/5LSM: secctx provider check on releasesecurity/apparmor/secid.c security/selinux/hooks.c+10 -161 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/5] LSM: Replace secctx/len pairs with lsm_context

LSM: Replace secctx/len pairs with lsm_context

Several of the Linux Security Module (LSM) interfaces use a pair of pointers for transmitting security context data and data length. The data passed is refered to as a security context. While all existing modules provide nul terminated strings, there is no requirement that they to so. Hence, the length is necessary.

Security contexts are provided by a number of interfaces. The interface security_release_secctx() is used when the caller is finished with the data. Each of the security modules that provide security contexts manages them differently. This was safe in the past, because only one security module that provides security contexts is allowed to be active. To allow multiple active modules that use security contexts it is necessary to identify which security module created a security context. Adding a third pointer to the interfaces for the LSM identification is not appealing.

A new structure, lsm_context, is created for use in these interfaces. It includes three members: the data pointer, the data length and the LSM ID of its creator. The interfaces that create contexts and security_release_secctx() now use a pointer to an lsm_context instead of a pointer pair.

The changes are mostly mechanical, and some scaffolding is used within the patch set to allow for smaller individual patches.

This patch set depends on the patch set LSM: Move away from secids:

        https://github.com/cschaufler/lsm-stacking.git#lsmprop-6.12-rc1-v4

https://github.com/cschaufler/lsm-stacking.git#context-6.12-rc1-v3

Revisons:
v3: Don't change NFS data storage format
Retain argument alignments
Set released context pointers to NULL
v2: Rebase for static calls in LSM infrastructure

Casey Schaufler (5):
LSM: Ensure the correct LSM context releaser
LSM: Replace context+len with lsm_context
LSM: Use lsm_context in security_inode_getsecctx
LSM: lsm_context in security_dentry_init_security
LSM: secctx provider check on release

 drivers/android/binder.c                | 25 +++++-----
 fs/ceph/super.h                         |  3 +-
 fs/ceph/xattr.c                         | 12 ++---
 fs/fuse/dir.c                           | 35 +++++++-------
 fs/nfs/nfs4proc.c                       | 22 ++++++---
 fs/nfsd/nfs4xdr.c                       | 22 ++++-----
 include/linux/lsm_hook_defs.h           | 13 +++--
 include/linux/security.h                | 37 ++++++++++-----
 include/net/scm.h                       | 12 ++---
 kernel/audit.c                          | 33 +++++++------
 kernel/auditsc.c                        | 27 +++++------
 net/ipv4/ip_sockglue.c                  | 12 ++---
 net/netfilter/nf_conntrack_netlink.c    | 16 +++----
 net/netfilter/nf_conntrack_standalone.c | 11 ++---
 net/netfilter/nfnetlink_queue.c         | 22 ++++-----
 net/netlabel/netlabel_unlabeled.c       | 44 +++++++----------
 net/netlabel/netlabel_user.c            | 10 ++--
 security/apparmor/include/secid.h       |  7 ++-
 security/apparmor/secid.c               | 34 +++++++------
 security/security.c                     | 63 ++++++++++++-------------
 security/selinux/hooks.c                | 50 ++++++++++++++------
 security/smack/smack_lsm.c              | 49 +++++++++++--------
 22 files changed, 293 insertions(+), 266 deletions(-)
Signature · 1 line
2.46.0