All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Xu Yunxiang" <xyx2021@mail.ustc.edu.cn>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf 2/2] selftests/bpf: Test slices escaping a clone call frame
Date: Wed, 09 Sep 2026 04:34:35 +0000	[thread overview]
Message-ID: <20260909043435.A117F1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260909042858.1734125-3-xyx2021@mail.ustc.edu.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Multi-line comments do not follow the strict BPF subsystem comment style.
--

commit 720f5969dc3c0d1bbc8d954089385b04bccca58f
Author: Xu Yunxiang <xyx2021@mail.ustc.edu.cn>

selftests/bpf: Test slices escaping a clone call frame

This commit adds a success case and a failure case to test BPF dynptr slice
behavior when a slice escapes a clone call frame. These tests verify that
subprogram return behaves correctly with respect to slice validity and
shared reference release.

> diff --git a/tools/testing/selftests/bpf/progs/dynptr_fail.c b/tools/testing/selftests/bpf/progs/dynptr_fail.c
> index 1cd61d72c166f..0704662cd32f3 100644
> --- a/tools/testing/selftests/bpf/progs/dynptr_fail.c
> +++ b/tools/testing/selftests/bpf/progs/dynptr_fail.c
> @@ -1892,6 +1892,52 @@ int clone_invalidate4(void *ctx)
>  	return 0;
>  }
>  
> +static __noinline void clone_slice_in_subprog(struct bpf_dynptr *ptr, int **data)
> +{
> +	struct bpf_dynptr clone;
> +
> +	bpf_dynptr_clone(ptr, &clone);
> +	*data = bpf_dynptr_data(&clone, 0, sizeof(val));
> +}
> +
> +/* A slice that escapes the clone's call frame remains valid while the
> + * shared ringbuf reservation is live.
> + */

[Severity: Low]
This isn't a bug, but does this multi-line comment format match the BPF
subsystem requirements? The BPF guidelines specify that multi-line comments
must have the opening /* on its own line.

> +SEC("?raw_tp")
> +__success
> +int clone_slice_returned_frame_valid(void *ctx)
> +{
> +	struct bpf_dynptr ptr;
> +	int *data = NULL;
> +
> +	bpf_ringbuf_reserve_dynptr(&ringbuf, val, 0, &ptr);
> +	clone_slice_in_subprog(&ptr, &data);
> +	if (data)
> +		*data = 123;
> +	bpf_ringbuf_submit_dynptr(&ptr, 0);
> +
> +	return 0;
> +}
> +
> +/* Releasing the shared reservation must invalidate a slice that escaped
> + * from a clone's call frame.
> + */

[Severity: Low]
Similarly here, could this multi-line comment be updated so the text
starts on the next line after the opening /* marker?

> +SEC("?raw_tp")
> +__failure __msg("invalid mem access 'scalar'")
> +int clone_slice_returned_frame_invalid(void *ctx)
> +{

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260909042858.1734125-1-xyx2021@mail.ustc.edu.cn?part=2

  reply	other threads:[~2026-09-09  4:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-29  3:27 [PATCH 6.6.y 0/2] bpf: fix dynptr lifetime invalidation on release Xu Yunxiang
2026-08-29  3:36 ` [PATCH 6.6.y 1/2] bpf: Invalidate dynptr slices by dynptr_id " Xu Yunxiang
2026-08-29  3:56   ` sashiko-bot
2026-08-29  3:37 ` [PATCH 6.6.y 2/2] bpf: Invalidate dynptr clones in every call frame " Xu Yunxiang
2026-08-29  4:07   ` sashiko-bot
2026-09-09  4:28     ` [PATCH bpf 0/2] bpf: Preserve escaped dynptr slice ancestry Xu Yunxiang
2026-09-09  4:28       ` [PATCH bpf 1/2] bpf: Preserve escaped dynptr slice ancestry on subprog return Xu Yunxiang
2026-09-09  5:18         ` bot+bpf-ci
2026-09-09  4:28       ` [PATCH bpf 2/2] selftests/bpf: Test slices escaping a clone call frame Xu Yunxiang
2026-09-09  4:34         ` sashiko-bot [this message]
2026-09-09  5:18         ` bot+bpf-ci
2026-08-29 10:26 ` [PATCH 6.6.y v2 0/3] bpf: fix dynptr release handling Xu Yunxiang
2026-08-29 10:26   ` [PATCH 6.6.y v2 1/3] bpf: Invalidate dynptr slices by dynptr_id on release Xu Yunxiang
2026-08-29 10:26   ` [PATCH 6.6.y v2 2/3] bpf: Propagate referenced dynptr release errors Xu Yunxiang
2026-08-29 10:42     ` sashiko-bot
2026-08-29 10:26   ` [PATCH 6.6.y v2 3/3] bpf: Invalidate dynptr clones in every call frame on release Xu Yunxiang
2026-08-30  2:56   ` [PATCH 6.6.y v2 0/3] bpf: fix dynptr release handling Sasha Levin

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=20260909043435.A117F1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=xyx2021@mail.ustc.edu.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.