From: Paul Moore <paul@paul-moore.com>
To: Casey Schaufler <casey@schaufler-ca.com>,
casey@schaufler-ca.com, linux-security-module@vger.kernel.org
Cc: jmorris@namei.org, serge@hallyn.com, keescook@chromium.org,
john.johansen@canonical.com, penguin-kernel@i-love.sakura.ne.jp,
stephen.smalley.work@gmail.com, linux-kernel@vger.kernel.org,
selinux@vger.kernel.org, mic@digikod.net,
ceph-devel@vger.kernel.org, linux-nfs@vger.kernel.org
Subject: Re: [PATCH v2 4/6] LSM: lsm_context in security_dentry_init_security
Date: Mon, 21 Oct 2024 19:39:49 -0400 [thread overview]
Message-ID: <b94aa34a25a19ea729faa1c8240ebf5b@paul-moore.com> (raw)
In-Reply-To: <20241014151450.73674-5-casey@schaufler-ca.com>
On Oct 14, 2024 Casey Schaufler <casey@schaufler-ca.com> wrote:
>
> Replace the (secctx,seclen) pointer pair with a single lsm_context
> pointer to allow return of the LSM identifier along with the context
> and context length. This allows security_release_secctx() to know how
> to release the context. Callers have been modified to use or save the
> returned data from the new structure.
>
> Special care is taken in the NFS code, which uses the same data structure
> for its own copied labels as it does for the data which comes from
> security_dentry_init_security(). In the case of copied labels the data
> has to be freed, not released.
>
> The scaffolding funtion lsmcontext_init() is no longer needed and is
> removed.
>
> Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
> Cc: ceph-devel@vger.kernel.org
> Cc: linux-nfs@vger.kernel.org
> ---
> fs/ceph/super.h | 3 +--
> fs/ceph/xattr.c | 16 ++++++----------
> fs/fuse/dir.c | 35 ++++++++++++++++++-----------------
> fs/nfs/dir.c | 2 +-
> fs/nfs/inode.c | 17 ++++++++++-------
> fs/nfs/internal.h | 8 +++++---
> fs/nfs/nfs4proc.c | 22 +++++++++-------------
> fs/nfs/nfs4xdr.c | 22 ++++++++++++----------
> include/linux/lsm_hook_defs.h | 2 +-
> include/linux/nfs4.h | 8 ++++----
> include/linux/nfs_fs.h | 2 +-
> include/linux/security.h | 26 +++-----------------------
> security/security.c | 9 ++++-----
> security/selinux/hooks.c | 9 +++++----
> 14 files changed, 80 insertions(+), 101 deletions(-)
...
> diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
> index 039898d70954..47652d217d05 100644
> --- a/include/linux/nfs_fs.h
> +++ b/include/linux/nfs_fs.h
> @@ -457,7 +457,7 @@ static inline void nfs4_label_free(struct nfs4_label *label)
> {
> #ifdef CONFIG_NFS_V4_SECURITY_LABEL
> if (label) {
> - kfree(label->label);
> + kfree(label->lsmctx.context);
Shouldn't this be a call to security_release_secctx() instead of a raw
kfree()?
> kfree(label);
> }
> #endif
--
paul-moore.com
next prev parent reply other threads:[~2024-10-21 23:39 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20241014151450.73674-1-casey.ref@schaufler-ca.com>
2024-10-14 15:14 ` [PATCH v2 0/6] LSM: Replace secctx/len pairs with lsm_context Casey Schaufler
2024-10-14 15:14 ` [PATCH v2 1/6] LSM: Ensure the correct LSM context releaser Casey Schaufler
2024-10-15 3:40 ` sergeh
2024-10-21 23:39 ` Paul Moore
2024-10-21 23:58 ` Casey Schaufler
2024-10-22 16:25 ` Paul Moore
2024-10-14 15:14 ` [PATCH v2 2/6] LSM: Replace context+len with lsm_context Casey Schaufler
2024-10-14 15:14 ` [PATCH v2 3/6] LSM: Use lsm_context in security_inode_getsecctx Casey Schaufler
2024-10-14 15:14 ` [PATCH v2 4/6] LSM: lsm_context in security_dentry_init_security Casey Schaufler
2024-10-21 23:39 ` Paul Moore [this message]
2024-10-22 0:00 ` Casey Schaufler
2024-10-22 16:35 ` Paul Moore
2024-10-22 16:46 ` Casey Schaufler
2024-10-14 15:14 ` [PATCH v2 5/6] LSM: secctx provider check on release Casey Schaufler
2024-10-21 23:39 ` Paul Moore
2024-10-22 0:05 ` Casey Schaufler
2024-10-22 16:28 ` Paul Moore
2024-10-14 15:14 ` [PATCH v2 6/6] LSM: Use lsm_context in security_inode_notifysecctx Casey Schaufler
2024-10-14 21:29 ` [PATCH v2 0/6] LSM: Replace secctx/len pairs with lsm_context Serge E. Hallyn
2024-10-14 21:35 ` Serge E. Hallyn
2024-10-14 21:54 ` Casey Schaufler
2024-10-14 21:47 ` Casey Schaufler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b94aa34a25a19ea729faa1c8240ebf5b@paul-moore.com \
--to=paul@paul-moore.com \
--cc=casey@schaufler-ca.com \
--cc=ceph-devel@vger.kernel.org \
--cc=jmorris@namei.org \
--cc=john.johansen@canonical.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mic@digikod.net \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=selinux@vger.kernel.org \
--cc=serge@hallyn.com \
--cc=stephen.smalley.work@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).