BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Adrián García Casado" <adriangarciacasado42@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next] selftests/bpf: Fix va_list reuse across loop iterations in scanf_one_line()
Date: Mon, 09 Nov 2026 14:44:16 +0000	[thread overview]
Message-ID: <sashiko-outbox-205125@kernel.org> (raw)
In-Reply-To: <20261109143846.1626182-1-adriangarciacasado42@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/bpf: missing Fixes trailer for scanf_one_line() fix
--

commit be7c1bdc105e46aa8eb43384f62da500ab1ddc9a
Author: Adrián García Casado <adriangarciacasado42@gmail.com>

> selftests/bpf: Fix va_list reuse across loop iterations in scanf_one_line()
>
> scanf_one_line() initializes 'ap' with va_start() once before the
> getline() loop and passes it to vsscanf() on each iteration without
> reinitializing it.
>
> According to the C standard, once a va_list is passed to a function that
> invokes va_arg() (such as vsscanf()), its value becomes indeterminate and
> cannot be reused without an intervening va_end() and va_start().
>
> Specifically, when scanning '/proc/self/mounts' with the format string
> '%*s %4095s cgroup2 %s', every non-cgroup2 mount line matches the leading
> '%*s %4095s' (returning 1 instead of 2) and consumes one pointer argument
> from 'ap', exhausting the two passed pointers after the second line and
> causing vsscanf() to write into uninitialized stack values on subsequent
> lines.
>
> Move va_start() and va_end() inside the getline() loop so 'ap' is
> properly reinitialized for each line.
>
> Signed-off-by: Adrián García Casado <adriangarciacasado42@gmail.com>

[Severity: Low]
Should this commit include a Fixes: tag for the commit that introduced
scanf_one_line()?

  Fixes: 67cdcc405b46 ("veristat: Memory accounting for bpf programs")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261109143846.1626182-1-adriangarciacasado42@gmail.com?part=1

      reply	other threads:[~2026-11-09 14:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 14:38 [PATCH bpf-next] selftests/bpf: Fix va_list reuse across loop iterations in scanf_one_line() Adrián García Casado
2026-11-09 14:44 ` 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-205125@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=adriangarciacasado42@gmail.com \
    --cc=bpf@vger.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