BPF List
 help / color / mirror / Atom feed
From: Vineet Gupta <vineet.gupta@linux.dev>
To: bot+bpf-ci@kernel.org, bpf@vger.kernel.org, ast@kernel.org,
	eddyz87@gmail.com, andrii@kernel.org, ihor.solodrai@linux.dev
Cc: linux-kernel@vger.kernel.org, daniel@iogearbox.net,
	martin.lau@kernel.org, yonghong.song@linux.dev, clm@meta.com
Subject: Re: [bpf-next 4/4] selftests/bpf: vmtest.sh: preserve command quoting when running in the VM
Date: Mon, 3 Aug 2026 12:52:35 -0700	[thread overview]
Message-ID: <959ebb50-910b-4ca4-8134-855cebe4521e@linux.dev> (raw)
In-Reply-To: <6d96174316041032ba75e8b9901245772bd4aad2873b795fd71df038bf909763@mail.kernel.org>



On 8/3/26 11:31 AM, bot+bpf-ci@kernel.org wrote:
>>      Note this makes the trailing command strictly an argv rather than a shell
>>      snippet: passing it pre-quoted as one word, e.g.
>>
>>              vmtest.sh -- "./test_progs -t foo"
>>
>>      no longer works, and neither does embedding guest-side shell syntax such
>>      as ';' or a redirection. Neither form is documented - usage() and
>>      README.rst both show the command unquoted - and 'sh -c ...' still works.
> Is the claim about README.rst accurate?

You are right, it is not.

>   Looking at
> tools/testing/selftests/bpf/README.rst lines 106-115, there is a
> documented vmtest.sh invocation whose trailing command is explicitly
> quoted:
>
>    $ PLATFORM=riscv64 CROSS_COMPILE=riscv64-linux-gnu- \
>      tools/testing/selftests/bpf/vmtest.sh \
>      -l <path of local rootfs image> -- \
>      ./test_progs -d \
>          \"$(cat tools/testing/selftests/bpf/DENYLIST.riscv64 | ... | tr -s '\n' ',' )\"
>
> The `\"` are escaped in the user's host shell, so vmtest.sh's main()
> receives argv[3] as the literal 10-character string `",exceptions,"`
> including the double quotes.
>
> Under the old `command="$@"`, the guest bash's second parse of the init
> script performed quote removal on those literal quotes, so test_progs
> received `-d ,exceptions,`. That is exactly what the `\"` in the recipe
> are for: they survive the host and are consumed by the guest.
>
> With `command=$(printf '%q ' "$@")` the quotes are escaped
> (`\",exceptions,\"`) and reach the binary verbatim, so test_progs now
> receives `-d ",exceptions,"`.
>
> Downstream that argument goes to parse_arg() ARG_TEST_NAME_GLOB_DENYLIST
> -> parse_test_list() (tools/testing/selftests/bpf/testing_helpers.c),
> which strtok_r()s on ',' and hands each field to insert_test() with
> is_glob_pattern=true. So the filter list becomes three globs instead of
> one: ["] [exceptions] ["], two of which can never match a test name in
> glob_match() (test_progs.c).
>
> For DENYLIST.riscv64 as it stands today the damage is confined to those
> two junk filters, because the file's first line is a comment and
> therefore reduces to an empty leading field.
>
> The same recipe applied to a denylist file whose first line is a real
> entry silently drops that entry. With DENYLIST.asan-shaped input:
>
>    OLD guest -> test_progs -d [*arena*,task_local_data,uprobe_multi_test,]
>      filters: [*arena*] [task_local_data] [uprobe_multi_test]
>    NEW guest -> test_progs -d ["*arena*,task_local_data,uprobe_multi_test,"]
>      filters: ["*arena*] [task_local_data] [uprobe_multi_test] ["]
>
> `"*arena*` matches nothing, so the *arena* tests are no longer denied
> and run anyway, a silent loss of denylist coverage rather than an error.

This is a really good catch. Indeed arena never matches.

> Should the commit message be corrected to acknowledge that README.rst
> does document a quoted invocation that breaks with this change, and
> should README.rst lines 109-115 be updated in the same patch to remove
> the now-harmful `\"`?

v2 drops the backslash, fixes README.rst and also updates the changelog 
accordingly.

Thx,
-Vineet

> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
>
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/30836252778


      reply	other threads:[~2026-08-03 19:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 17:02 [bpf-next 0/4] selftest related fixes Vineet Gupta
2026-08-03 17:02 ` [bpf-next 1/4] selftests/bpf: map_kptr: force BPF_STX for the scalar store to kptr Vineet Gupta
2026-08-03 17:02 ` [bpf-next 2/4] selftests/bpf: add --no-error-summary to skip end-of-run error log dump Vineet Gupta
2026-08-03 18:15   ` bot+bpf-ci
2026-08-03 19:48     ` Vineet Gupta
2026-08-03 17:02 ` [bpf-next 3/4] selftests/bpf: report failed subtest count in test_progs summary Vineet Gupta
2026-08-03 18:31   ` bot+bpf-ci
2026-08-03 18:36     ` Vineet Gupta
2026-08-03 17:02 ` [bpf-next 4/4] selftests/bpf: vmtest.sh: preserve command quoting when running in the VM Vineet Gupta
2026-08-03 18:31   ` bot+bpf-ci
2026-08-03 19:52     ` Vineet Gupta [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=959ebb50-910b-4ca4-8134-855cebe4521e@linux.dev \
    --to=vineet.gupta@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bot+bpf-ci@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=clm@meta.com \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@kernel.org \
    --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