Thread (4 messages) flat view 4 messages, 3 authors, 2024-12-06

Re: [PATCH v3 1/5] LSM: Ensure the correct LSM context releaser

From: Paul Moore <paul@paul-moore.com>
Date: 2024-10-31 22:53:39
Also in: linux-integrity, linux-nfs, linux-security-module, lkml, netfilter-devel, selinux

On Oct 23, 2024 Casey Schaufler [off-list ref] wrote:
Add a new lsm_context data structure to hold all the information about a
"security context", including the string, its size and which LSM allocated
the string. The allocation information is necessary because LSMs have
different policies regarding the lifecycle of these strings. SELinux
allocates and destroys them on each use, whereas Smack provides a pointer
to an entry in a list that never goes away.

Update security_release_secctx() to use the lsm_context instead of a
(char *, len) pair. Change its callers to do likewise.  The LSMs
supporting this hook have had comments added to remind the developer
that there is more work to be done.

The BPF security module provides all LSM hooks. While there has yet to
be a known instance of a BPF configuration that uses security contexts,
the possibility is real. In the existing implementation there is
potential for multiple frees in that case.

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Cc: linux-integrity@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: audit@vger.kernel.org
Cc: netfilter-devel@vger.kernel.org
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: linux-nfs@vger.kernel.org
Cc: Todd Kjos <redacted>
---
 drivers/android/binder.c                | 24 +++++++--------
 fs/ceph/xattr.c                         |  6 +++-
 fs/nfs/nfs4proc.c                       |  8 +++--
 fs/nfsd/nfs4xdr.c                       |  8 +++--
 include/linux/lsm_hook_defs.h           |  2 +-
 include/linux/security.h                | 35 ++++++++++++++++++++--
 include/net/scm.h                       | 11 +++----
 kernel/audit.c                          | 30 +++++++++----------
 kernel/auditsc.c                        | 23 +++++++-------
 net/ipv4/ip_sockglue.c                  | 10 +++----
 net/netfilter/nf_conntrack_netlink.c    | 10 +++----
 net/netfilter/nf_conntrack_standalone.c |  9 +++---
 net/netfilter/nfnetlink_queue.c         | 13 +++++---
 net/netlabel/netlabel_unlabeled.c       | 40 +++++++++++--------------
 net/netlabel/netlabel_user.c            | 11 ++++---
 security/apparmor/include/secid.h       |  2 +-
 security/apparmor/secid.c               | 11 +++++--
 security/security.c                     |  8 ++---
 security/selinux/hooks.c                | 11 +++++--
 19 files changed, 165 insertions(+), 107 deletions(-)
This revision looks okay to me, and with no real comments from the other
affected subsystems on this or the previous revision I'm going to go
ahead and merge this into the lsm/dev branch.

Thanks Casey.

--
paul-moore.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help