BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chris Mason" <mason@kernel.org>, bpf@vger.kernel.org
Cc: linux-security-module@vger.kernel.org
Subject: Re: [PATCH bpf] bpf: Destroy inode storage after an RCU grace period
Date: Thu, 03 Dec 2026 17:25:53 +0000	[thread overview]
Message-ID: <sashiko-outbox-248257@kernel.org> (raw)
In-Reply-To: <20261203163706.50213-1-mason@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] bpf: modified multi-line comments in bpf_inode_storage.c violate
  BPF style
--

commit b8ac1197acd3f529720434f8eed1437d3463198b
Author: Chris Mason <mason@kernel.org>

bpf: Destroy inode storage after an RCU grace period

This commit moves BPF inode storage destruction from the
inode_free_security() LSM hook to inode_free_security_rcu() and changes
the storage owner from the struct inode to the LSM blob.

> diff --git a/kernel/bpf/bpf_inode_storage.c b/kernel/bpf/bpf_inode_storage.c
> index f9e81060c1f45..fdae59b25cd34 100644
> --- a/kernel/bpf/bpf_inode_storage.c
> +++ b/kernel/bpf/bpf_inode_storage.c

[ ... ]

> @@ -126,29 +123,35 @@ BPF_CALL_4(bpf_inode_storage_get, struct bpf_map *, map, struct inode *, inode,
>  	   void *, value, u64, flags)
>  {

[ ... ]

> -	/* explicitly check that the inode_storage_ptr is not
> +	if (!inode)
> +		return (unsigned long)NULL;
> +
> +	/* explicitly check that the blob is not
>  	 * NULL as inode_storage_lookup returns NULL in this case and
>  	 * bpf_local_storage_update expects the owner to have a
>  	 * valid storage pointer.
>  	 */

[ ... ]

> -	/* This helper must only called from where the inode is guaranteed
> -	 * to have a refcount and cannot be freed.
> +	/* This helper must only be called from places where the lifetime of the
> +	 * inode is guaranteed. Either by being refcounted or by being protected
> +	 * by an RCU read-side critical section.
>  	 */

[ ... ]

> @@ -164,8 +167,9 @@ BPF_CALL_2(bpf_inode_storage_delete,
>  	if (!inode)
>  		return -EINVAL;
>  
> -	/* This helper must only called from where the inode is guaranteed
> -	 * to have a refcount and cannot be freed.
> +	/* This helper must only be called from places where the lifetime of the
> +	 * inode is guaranteed. Either by being refcounted or by being protected
> +	 * by an RCU read-side critical section.
>  	 */
>  	return inode_storage_delete(inode, map);
>  }

[Severity: Low]
This isn't a bug, but BPF code uses the modern kernel multi-line comment
style where the opening /* sits on its own line and the comment text starts
on the following line.  Could these three modified multi-line comments in
bpf_inode_storage_get() and bpf_inode_storage_delete() be updated to match?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203163706.50213-1-mason@kernel.org?part=1

      reply	other threads:[~2026-12-03 17:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 16:37 [PATCH bpf] bpf: Destroy inode storage after an RCU grace period Chris Mason
2026-12-03 17:25 ` sashiko-bot [this message]

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=sashiko-outbox-248257@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mason@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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