BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yonghong Song" <yonghong.song@linux.dev>, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 3/3] selftests/bpf: Test enum value relocations out of the local enumerator range
Date: Thu, 26 Nov 2026 18:02:58 +0000	[thread overview]
Message-ID: <sashiko-outbox-235988@kernel.org> (raw)
In-Reply-To: <20261126175618.1884490-1-yonghong.song@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/bpf: non-standard multi-line comments in
  core_reloc_types.h
--

commit b84e0514078e764d621bc1f043d99af2bc50dbfb
Author: Yonghong Song <yonghong.song@linux.dev>

selftests/bpf: Test enum value relocations out of the local enumerator range

This commit adds CO-RE relocation selftests verifying that libbpf poisons
enum and enum64 value relocations whose target values fall outside the
range of the local enumerator type.

> diff --git a/tools/testing/selftests/bpf/progs/core_reloc_types.h b/tools/testing/selftests/bpf/progs/core_reloc_types.h
> index 116a67fdd1b2e..01d67521efd12 100644
> --- a/tools/testing/selftests/bpf/progs/core_reloc_types.h
> +++ b/tools/testing/selftests/bpf/progs/core_reloc_types.h
> @@ -1409,6 +1409,62 @@ struct core_reloc_enumval___byte_unpacked {
>  	enum named_byte_enum___byte_unpacked f3;
>  };
>  
> +/* second enum value out of the range of the local int enumerator, as the
> + * target enum is 8 bytes, should fail
> + */
> +enum named_enum___err_too_big {
> +	NAMED_ENUM_VAL1___err_too_big = 1,
> +	NAMED_ENUM_VAL2___err_too_big = 0x200000000ULL,
> +	NAMED_ENUM_VAL3___err_too_big = 3,
> +};
> +
> +struct core_reloc_enumval___err_too_big {
> +	enum named_enum___err_too_big f1;
> +	anon_enum f2;
> +};
> +
> +/* second enum value out of the range of the local int enumerator, as the
> + * target enum is signed and 8 bytes, should fail
> + */
> +enum named_enum___err_too_small {
> +	NAMED_ENUM_VAL1___err_too_small = 1,
> +	NAMED_ENUM_VAL2___err_too_small = -0x100000000LL,
> +	NAMED_ENUM_VAL3___err_too_small = 3,
> +};
> +
> +struct core_reloc_enumval___err_too_small {
> +	enum named_enum___err_too_small f1;
> +	anon_enum f2;
> +};
> +
> +/* second enum value out of the range of the local int enumerator, as the
> + * target enum is unsigned, should fail
> + */
> +enum named_enum___err_int {
> +	NAMED_ENUM_VAL1___err_int = 1,
> +	NAMED_ENUM_VAL2___err_int = 0x80000000,
> +	NAMED_ENUM_VAL3___err_int = 3,
> +};
> +
> +struct core_reloc_enumval___err_int {
> +	enum named_enum___err_int f1;
> +	anon_enum f2;
> +};
> +
> +/* first unsigned enum value out of the range of the local unsigned int
> + * enumerator, as the target enum is 8 bytes, should fail
> + */
> +enum named_uint_enum___err_uint {
> +	UINT_ENUM_VAL1___err_uint = 0x100000000ULL,
> +	UINT_ENUM_VAL2___err_uint = 0xffffffff,
> +};
> +
> +struct core_reloc_enumval___err_uint {
> +	enum named_enum f1;
> +	anon_enum f2;
> +	enum named_uint_enum___err_uint f3;
> +};
> +
>  enum named_unsigned_enum64___err_missing {
>  	UNSIGNED_ENUM64_VAL1___err_missing = 0x1ffffffffULL,
>  	UNSIGNED_ENUM64_VAL3___err_missing = 0x3ffffffffULL,
> @@ -1423,3 +1479,17 @@ struct core_reloc_enum64val___err_missing {
>  	enum named_unsigned_enum64___err_missing f1;
>  	enum named_signed_enum64___err_missing f2;
>  };
> +
> +/* first signed enum value out of the range of the local long enumerator, as
> + * the target enum is unsigned, should fail
> + */

[Severity: Low]
This isn't a bug, but the five new multi-line comments in
core_reloc_types.h place text on the same line as the opening /*.  Per
BPF coding style, the opening /* of a multi-line comment should be on its
own line with the comment text starting on the next line.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126175602.1882988-1-yonghong.song@linux.dev?part=3

      reply	other threads:[~2026-11-26 18:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 17:56 [PATCH bpf-next 0/3] libbpf: Check enum value relocations against the local enumerator type Yonghong Song
2026-11-26 17:56 ` [PATCH bpf-next 1/3] libbpf: Poison an enum value relocation out of the local enumerator range Yonghong Song
2026-11-26 18:36   ` bot+bpf-ci
2026-11-26 17:56 ` [PATCH bpf-next 2/3] selftests/bpf: Test enum value relocations within " Yonghong Song
2026-11-26 18:00   ` sashiko-bot
2026-11-26 17:56 ` [PATCH bpf-next 3/3] selftests/bpf: Test enum value relocations out of " Yonghong Song
2026-11-26 18:02   ` 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-235988@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=yonghong.song@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