From: sashiko-bot@kernel.org
To: "Aaron Tomlin" <atomlin@atomlin.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v3 perf-tools-next 3/7] perf trace: Align pointer advance in augmented string beautifier
Date: Sat, 19 Sep 2026 01:08:50 +0000 [thread overview]
Message-ID: <20260919010850.A74071F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260919005530.728615-4-atomlin@atomlin.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] perf trace: unpadded augmented arguments corruption due to unconditional PERF_ALIGN
--
commit edc9d58d23d30decc9c0076b0136df1e5ab01c70
Author: Aaron Tomlin <atomlin@atomlin.com>
perf trace: Align pointer advance in augmented string beautifier
This commit updates the augmented string beautifier in perf trace to
round up the consumed payload bytes to an 8-byte boundary using PERF_ALIGN.
It also adds bounds checking to prevent reading out of bounds if the aligned
consumed offset exceeds the remaining buffer.
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -1912,10 +1912,15 @@ static size_t syscall_arg__scnprintf_augmented_string(struct syscall_arg *arg, c
> * So that the next arg with a payload can consume its augmented arg, i.e. for rename* syscalls
> * we would have two strings, each prefixed by its size.
> */
> - consumed = sizeof(*augmented_arg) + augmented_arg->size;
> + consumed = sizeof(*augmented_arg) + PERF_ALIGN(augmented_arg->size, sizeof(u64));
[Severity: High]
Does this unconditional alignment cause corruption when reading arguments
produced by the generic BPF tracepoint?
The generic BPF producer, specifically augment_arg() in
tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c, emits unpadded,
tightly-packed arguments. When tracing syscalls with multiple string or
pointer arguments (such as linkat, symlinkat, or move_mount), the BPF
program packs the strings consecutively.
Since PERF_ALIGN skips non-existent padding bytes here, could this
over-advance the pointer and misalign the reader for the second argument,
causing it to read arbitrary payload bytes as the size and value fields?
Additionally, might this affect backward compatibility when analyzing
older, unpadded perf.data files where augmented string arguments are not
aligned to an 8-byte boundary?
>
> - arg->augmented.args = ((void *)arg->augmented.args) + consumed;
> - arg->augmented.size -= consumed;
> + if (consumed > arg->augmented.size) {
> + arg->augmented.args = NULL;
> + arg->augmented.size = 0;
> + } else {
> + arg->augmented.args = ((void *)arg->augmented.args) + consumed;
> + arg->augmented.size -= consumed;
> + }
>
> return printed;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260919005530.728615-1-atomlin@atomlin.com?part=3
next prev parent reply other threads:[~2026-09-19 1:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-19 0:55 [PATCH v3 perf-tools-next 0/7] perf trace: Validate payload bounds across augmented argument beautifiers Aaron Tomlin
2026-09-19 0:55 ` [PATCH v3 perf-tools-next 1/7] perf trace: Add upper bound checks for augmented BTF struct printing Aaron Tomlin
2026-09-19 1:07 ` sashiko-bot
2026-09-19 0:55 ` [PATCH v3 perf-tools-next 2/7] perf trace: Validate payload bounds in augmented string beautifier Aaron Tomlin
2026-09-19 1:08 ` sashiko-bot
2026-09-19 0:55 ` [PATCH v3 perf-tools-next 3/7] perf trace: Align pointer advance " Aaron Tomlin
2026-09-19 1:08 ` sashiko-bot [this message]
2026-09-19 0:55 ` [PATCH v3 perf-tools-next 4/7] perf trace: Validate payload bounds in augmented buffer beautifier Aaron Tomlin
2026-09-19 1:09 ` sashiko-bot
2026-09-19 0:55 ` [PATCH v3 perf-tools-next 5/7] perf trace beauty: Validate payload size in augmented timespec beautifier Aaron Tomlin
2026-09-19 1:08 ` sashiko-bot
2026-09-19 0:55 ` [PATCH v3 perf-tools-next 6/7] perf trace beauty: Validate payload size in augmented sockaddr beautifier Aaron Tomlin
2026-09-19 1:05 ` sashiko-bot
2026-09-19 0:55 ` [PATCH v3 perf-tools-next 7/7] perf trace beauty: Validate payload size in augmented perf_event_open beautifier Aaron Tomlin
2026-09-19 1:04 ` sashiko-bot
2026-09-30 18:29 ` [PATCH v3 perf-tools-next 0/7] perf trace: Validate payload bounds across augmented argument beautifiers Aaron Tomlin
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=20260919010850.A74071F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=atomlin@atomlin.com \
--cc=linux-perf-users@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