From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: "Miguel Martín Gil" <miguel.martin.gil.uni@gmail.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
peterz@infradead.org, mingo@redhat.com, namhyung@kernel.org
Subject: Re: [PATCH 1/1] perf util: fix perf_exe() buffer write past end
Date: Fri, 29 May 2026 21:18:54 -0300 [thread overview]
Message-ID: <ahos7mGhWpiwkwY6@x1> (raw)
In-Reply-To: <CAP-5=fW6uR+VBp7F=98iSKuS6j+wAHbbpSjxRZ-9mxaudupY4Q@mail.gmail.com>
On Tue, May 26, 2026 at 08:05:44AM -0700, Ian Rogers wrote:
> On Tue, May 26, 2026 at 4:10 AM Miguel Martín Gil
> <miguel.martin.gil.uni@gmail.com> wrote:
> >
> > perf_exe() passes len to readlink() and then unconditionally writes a trailing NUL at buf[n]. If readlink() returns len, the write lands one byte past the buffer.
> >
> > Read at most len - 1 bytes and keep the existing NUL termination. Also guard the fallback path for tiny buffers so copying "perf" cannot overflow.
> >
> > Signed-off-by: Miguel Martín Gil <miguel.martin.gil.uni@gmail.com>
>
> Reviewed-by: Ian Rogers <irogers@google.com>
>
> and Sashiko is green:
> https://sashiko.dev/#/patchset/20260526110852.7259-2-miguel.martin.gil.uni%40gmail.com
Thanks, applied to perf-tools-next, for v7.2.
- Arnaldo
prev parent reply other threads:[~2026-05-30 0:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 11:08 [PATCH 0/1] perf util: fix out-of-bounds write in perf_exe() Miguel Martín Gil
2026-05-26 11:08 ` [PATCH 1/1] perf util: fix perf_exe() buffer write past end Miguel Martín Gil
2026-05-26 15:05 ` Ian Rogers
2026-05-30 0:18 ` Arnaldo Carvalho de Melo [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=ahos7mGhWpiwkwY6@x1 \
--to=acme@kernel.org \
--cc=irogers@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=miguel.martin.gil.uni@gmail.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox