All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kumar Kartikeya Dwivedi" <memxor@gmail.com>
To: <sashiko-reviews@lists.linux.dev>,
	"Emil Tsalapatis" <emil@etsalapatis.com>
Cc: <bpf@vger.kernel.org>
Subject: Re: [PATCH RESEND bpf-next v3 4/6] selftests/bpf: Add arena-based bitmap data structure
Date: Mon, 06 Jul 2026 21:04:12 +0200	[thread overview]
Message-ID: <DJRQ0BBKZLBA.8Q8ACS615TZK@gmail.com> (raw)
In-Reply-To: <20260706182758.21B901F000E9@smtp.kernel.org>

On Mon Jul 6, 2026 at 8:27 PM CEST, sashiko-bot wrote:
> Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
> - [High] Silent failures and falsely reported lock acquisition in bounded atomic bit operations on loop abort.
> - [High] `bmp_empty` and `bmp_subset` return `true` on an aborted loop, defaulting to an unsafe affirmative state.
> - [Medium] Bulk operations unconditionally apply a bitmask to the last word even if the processing loop aborts early.
> - [Medium] Missing `READ_ONCE()` or `volatile` cast in `bmp_test_bit` exposes lockless polling loops to compiler hoisting.
> --
>
> commit 634ac04142cf736158c99f577c0f903470937bfc
> Author: Emil Tsalapatis <emil@etsalapatis.com>
> selftests/bpf: Add arena-based bitmap data structure
>
> This patch adds an arena-based word-aligned bitmap data structure. The
> structure is useful as a building block for components like sched-ext
> to represent cpumask structures.
>
>> diff --git a/tools/testing/selftests/bpf/libarena/src/bitmap.bpf.c b/tools/testing/selftests/bpf/libarena/src/bitmap.bpf.c
>> index 0000000000000..80e814401fb9e
>> --- /dev/null
>> +++ b/tools/testing/selftests/bpf/libarena/src/bitmap.bpf.c
> [ ... ]
>> +__weak
>> +bool bmp_test_bit(u32 bit, struct bitmap __arena *bmp)
>> +{
>> +	return bmp->bits[BIT_WORD(bit)] & BIT_MASK(bit);
>> +}
>
> [Severity: Medium]
> Does this memory access need a READ_ONCE() or a volatile pointer cast?
>
> If this function is used in a lockless concurrent polling loop, could the
> compiler hoist the plain memory read out of the loop and cause an infinite
> spin that misses updates from other CPUs?
>

This one seems worth addressing; I would ignore the rest about can_loop
exhaustion. Please send a follow up fix.

> [...]

  reply	other threads:[~2026-07-06 19:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06 18:17 [PATCH RESEND bpf-next v3 0/6] selftests/bpf: libarena cleanup and bitmap struct Emil Tsalapatis
2026-07-06 18:17 ` [PATCH RESEND bpf-next v3 1/6] selftests/bpf: libarena: Replace leftover st_ prefix with test_ Emil Tsalapatis
2026-07-06 18:17 ` [PATCH RESEND bpf-next v3 2/6] selftests/bpf: libarena: Fix can-loop zero variable definition Emil Tsalapatis
2026-07-06 18:17 ` [PATCH RESEND bpf-next v3 3/6] selftests/bpf: libarena: Clean up allocation state before buddy tests Emil Tsalapatis
2026-07-06 18:17 ` [PATCH RESEND bpf-next v3 4/6] selftests/bpf: Add arena-based bitmap data structure Emil Tsalapatis
2026-07-06 18:27   ` sashiko-bot
2026-07-06 19:04     ` Kumar Kartikeya Dwivedi [this message]
2026-07-06 19:17       ` Emil Tsalapatis
2026-07-06 19:23         ` Kumar Kartikeya Dwivedi
2026-07-06 18:17 ` [PATCH RESEND bpf-next v3 5/6] selftests/bpf: libarena: Add bitmap selftests Emil Tsalapatis
2026-07-06 18:17 ` [PATCH RESEND bpf-next v3 6/6] selftests/bpf: libarena: Add parallel bitmap selftest Emil Tsalapatis
2026-07-06 18:32   ` sashiko-bot
2026-07-06 19:10 ` [PATCH RESEND bpf-next v3 0/6] selftests/bpf: libarena cleanup and bitmap struct patchwork-bot+netdevbpf

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=DJRQ0BBKZLBA.8Q8ACS615TZK@gmail.com \
    --to=memxor@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=emil@etsalapatis.com \
    --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 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.