From: Yonghong Song <yonghong.song@linux.dev>
To: Paul Chaignon <paul.chaignon@gmail.com>, bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Florent Revest <revest@chromium.org>
Subject: Re: [PATCH bpf 2/2] selftests/bpf: Add negative test cases for snprintf
Date: Tue, 1 Jul 2025 09:03:19 -0700 [thread overview]
Message-ID: <387dd87d-ef1b-415d-bfa2-1608dce65e32@linux.dev> (raw)
In-Reply-To: <30ed8c0add8d08c22cec95f302d85d2e4a2dd760.1750953849.git.paul.chaignon@gmail.com>
On 6/26/25 9:07 AM, Paul Chaignon wrote:
> This patch adds a couple negative test cases with a trailing % at the
> end of the format string.
>
> Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>
LGTM with a nit below.
Acked-by: Yonghong Song <yonghong.song@linux.dev>
> ---
> tools/testing/selftests/bpf/prog_tests/snprintf.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/snprintf.c b/tools/testing/selftests/bpf/prog_tests/snprintf.c
> index 4be6fdb78c6a..594441acb707 100644
> --- a/tools/testing/selftests/bpf/prog_tests/snprintf.c
> +++ b/tools/testing/selftests/bpf/prog_tests/snprintf.c
> @@ -116,6 +116,8 @@ static void test_snprintf_negative(void)
> ASSERT_ERR(load_single_snprintf("%llc"), "invalid specifier 7");
> ASSERT_ERR(load_single_snprintf("\x80"), "non ascii character");
> ASSERT_ERR(load_single_snprintf("\x1"), "non printable character");
> + ASSERT_ERR(load_single_snprintf("%p%"), "invalid specifier 8");
> + ASSERT_ERR(load_single_snprintf("%s%"), "invalid specifier 9");
The above "%s%" test already succeeded without Patch 1. It would be
good to mention this in the commit message to avoid confusion.
> }
>
> void test_snprintf(void)
next prev parent reply other threads:[~2025-07-01 16:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-26 16:06 [PATCH bpf 1/2] bpf: Reject %p% format string in bprintf-like helpers Paul Chaignon
2025-06-26 16:07 ` [PATCH bpf 2/2] selftests/bpf: Add negative test cases for snprintf Paul Chaignon
2025-07-01 16:03 ` Yonghong Song [this message]
2025-07-01 15:56 ` [PATCH bpf 1/2] bpf: Reject %p% format string in bprintf-like helpers Yonghong Song
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=387dd87d-ef1b-415d-bfa2-1608dce65e32@linux.dev \
--to=yonghong.song@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=paul.chaignon@gmail.com \
--cc=revest@chromium.org \
/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.