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 5/7] perf trace beauty: Validate payload size in augmented timespec beautifier
Date: Sat, 19 Sep 2026 01:08:55 +0000 [thread overview]
Message-ID: <20260919010856.6829D1F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260919005530.728615-6-atomlin@atomlin.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] perf: Silently disables nanosleep augmentation on 64-bit due to BPF size mismatch
--
commit d5a8c844e701a29578b91e18d924a25e7e3167e6
Author: Aaron Tomlin <atomlin@atomlin.com>
perf trace beauty: Validate payload size in augmented timespec beautifier
This commit introduces bounds checking in the timespec beautifier to prevent
reading past the end of the available buffer if a malformed or truncated
perf.data record is provided.
> diff --git a/tools/perf/trace/beauty/timespec.c b/tools/perf/trace/beauty/timespec.c
> index b14ab72a2738e..84755d8d2c87f 100644
> --- a/tools/perf/trace/beauty/timespec.c
> +++ b/tools/perf/trace/beauty/timespec.c
> @@ -7,15 +7,24 @@
>
> static size_t syscall_arg__scnprintf_augmented_timespec(struct syscall_arg *arg, char *bf, size_t size)
> {
> - struct timespec *ts = (struct timespec *)arg->augmented.args->value;
> + struct augmented_arg *augmented_arg = arg->augmented.args;
> + struct timespec *ts;
>
> + if (arg->augmented.size < (int)(sizeof(*augmented_arg) + sizeof(*ts)))
> + return 0;
[Severity: High]
Does this bounds check deterministically fail for the nanosleep syscall on
64-bit platforms?
When tracing the nanosleep syscall using perf trace, the BPF script
sys_enter_nanosleep incorrectly calculates its output length by omitting
sizeof(u64) for the augmented_arg header, outputting exactly 16 bytes.
The bounds check introduced here requires sizeof(*augmented_arg) + sizeof(*ts),
which is 24 bytes on 64-bit systems. Since 16 < 24, the check deterministically
fails and silently returns 0.
This disables the nanosleep augmentation feature on 64-bit systems, falling
back to raw pointer printing instead of showing the timespec structure.
> +
> + ts = (struct timespec *)augmented_arg->value;
> return scnprintf(bf, size, "{ .tv_sec: %" PRIu64 ", .tv_nsec: %" PRIu64 " }", ts->tv_sec, ts->tv_nsec);
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260919005530.728615-1-atomlin@atomlin.com?part=5
next prev parent reply other threads:[~2026-09-19 1:09 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
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 [this message]
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=20260919010856.6829D1F00898@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