public inbox for linux-security-module@vger.kernel.org
 help / color / mirror / Atom feed
From: Casey Schaufler <casey@schaufler-ca.com>
To: Al Viro <viro@zeniv.linux.org.uk>, linux-fsdevel@vger.kernel.org
Cc: torvalds@linux-foundation.org, brauner@kernel.org, jack@suse.cz,
	neil@brown.name, linux-security-module@vger.kernel.org,
	dhowells@redhat.com, linkinjeon@kernel.org,
	Casey Schaufler <casey@schaufler-ca.com>
Subject: Re: [PATCH 1/6] security_dentry_init_security(): constify qstr argument
Date: Thu, 11 Sep 2025 07:30:41 -0700	[thread overview]
Message-ID: <66295710-bb13-45e9-a87f-98b8aa6aa86a@schaufler-ca.com> (raw)
In-Reply-To: <20250911050534.3116491-1-viro@zeniv.linux.org.uk>

On 9/10/2025 10:05 PM, Al Viro wrote:
> Nothing outside of fs/dcache.c has any business modifying
> dentry names; passing &dentry->d_name as an argument should
> have that argument declared as a const pointer.
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

For the Smack bit:

Acked-by: Casey Schaufler <casey@schaufler-ca.com>

> ---
>  include/linux/lsm_hook_defs.h | 2 +-
>  include/linux/security.h      | 4 ++--
>  security/security.c           | 2 +-
>  security/selinux/hooks.c      | 2 +-
>  security/smack/smack_lsm.c    | 2 +-
>  5 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h
> index fd11fffdd3c3..aa4d6ec9c98b 100644
> --- a/include/linux/lsm_hook_defs.h
> +++ b/include/linux/lsm_hook_defs.h
> @@ -85,7 +85,7 @@ LSM_HOOK(int, -EOPNOTSUPP, dentry_init_security, struct dentry *dentry,
>  	 int mode, const struct qstr *name, const char **xattr_name,
>  	 struct lsm_context *cp)
>  LSM_HOOK(int, 0, dentry_create_files_as, struct dentry *dentry, int mode,
> -	 struct qstr *name, const struct cred *old, struct cred *new)
> +	 const struct qstr *name, const struct cred *old, struct cred *new)
>  
>  #ifdef CONFIG_SECURITY_PATH
>  LSM_HOOK(int, 0, path_unlink, const struct path *dir, struct dentry *dentry)
> diff --git a/include/linux/security.h b/include/linux/security.h
> index 521bcb5b9717..3f694d3ebd70 100644
> --- a/include/linux/security.h
> +++ b/include/linux/security.h
> @@ -391,7 +391,7 @@ int security_dentry_init_security(struct dentry *dentry, int mode,
>  				  const char **xattr_name,
>  				  struct lsm_context *lsmcxt);
>  int security_dentry_create_files_as(struct dentry *dentry, int mode,
> -					struct qstr *name,
> +					const struct qstr *name,
>  					const struct cred *old,
>  					struct cred *new);
>  int security_path_notify(const struct path *path, u64 mask,
> @@ -871,7 +871,7 @@ static inline int security_dentry_init_security(struct dentry *dentry,
>  }
>  
>  static inline int security_dentry_create_files_as(struct dentry *dentry,
> -						  int mode, struct qstr *name,
> +						  int mode, const struct qstr *name,
>  						  const struct cred *old,
>  						  struct cred *new)
>  {
> diff --git a/security/security.c b/security/security.c
> index ad163f06bf7a..db2d75be87cc 100644
> --- a/security/security.c
> +++ b/security/security.c
> @@ -1775,7 +1775,7 @@ EXPORT_SYMBOL(security_dentry_init_security);
>   * Return: Returns 0 on success, error on failure.
>   */
>  int security_dentry_create_files_as(struct dentry *dentry, int mode,
> -				    struct qstr *name,
> +				    const struct qstr *name,
>  				    const struct cred *old, struct cred *new)
>  {
>  	return call_int_hook(dentry_create_files_as, dentry, mode,
> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index c95a5874bf7d..58ce49954206 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -2901,7 +2901,7 @@ static int selinux_dentry_init_security(struct dentry *dentry, int mode,
>  }
>  
>  static int selinux_dentry_create_files_as(struct dentry *dentry, int mode,
> -					  struct qstr *name,
> +					  const struct qstr *name,
>  					  const struct cred *old,
>  					  struct cred *new)
>  {
> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> index fc340a6f0dde..5caa372ffbf3 100644
> --- a/security/smack/smack_lsm.c
> +++ b/security/smack/smack_lsm.c
> @@ -4908,7 +4908,7 @@ static int smack_inode_copy_up_xattr(struct dentry *src, const char *name)
>  }
>  
>  static int smack_dentry_create_files_as(struct dentry *dentry, int mode,
> -					struct qstr *name,
> +					const struct qstr *name,
>  					const struct cred *old,
>  					struct cred *new)
>  {

  parent reply	other threads:[~2025-09-11 15:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-11  5:01 [PATCHES] simple part of ->d_name stuff Al Viro
2025-09-11  5:05 ` [PATCH 1/6] security_dentry_init_security(): constify qstr argument Al Viro
2025-09-11  5:05   ` [PATCH 2/6] exfat_find(): " Al Viro
2025-09-11  6:02     ` Namjae Jeon
2025-09-15 12:45     ` Christian Brauner
2025-09-11  5:05   ` [PATCH 3/6] afs_edit_dir_{add,remove}(): " Al Viro
2025-09-15 12:45     ` Christian Brauner
2025-09-11  5:05   ` [PATCH 4/6] afs_dir_search: " Al Viro
2025-09-15 12:46     ` Christian Brauner
2025-09-11  5:05   ` [PATCH 5/6] generic_ci_validate_strict_name(): constify name argument Al Viro
2025-09-15 12:46     ` Christian Brauner
2025-09-11  5:05   ` [PATCH 6/6] make it easier to catch those who try to modify ->d_name Al Viro
2025-09-15 12:46     ` Christian Brauner
2025-09-11 14:30   ` Casey Schaufler [this message]
2025-09-11 20:54   ` [PATCH 1/6] security_dentry_init_security(): constify qstr argument Paul Moore
2025-09-15 12:45   ` Christian Brauner
2025-09-11  5:59 ` [PATCHES] simple part of ->d_name stuff David Howells
2025-09-11 16:56 ` Linus Torvalds

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=66295710-bb13-45e9-a87f-98b8aa6aa86a@schaufler-ca.com \
    --to=casey@schaufler-ca.com \
    --cc=brauner@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=jack@suse.cz \
    --cc=linkinjeon@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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