All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] perf util: fix out-of-bounds write in perf_exe()
@ 2026-05-26 11:08 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
  0 siblings, 1 reply; 4+ messages in thread
From: Miguel Martín Gil @ 2026-05-26 11:08 UTC (permalink / raw)
  To: linux-perf-users
  Cc: linux-kernel, peterz, mingo, acme, namhyung,
	Miguel Martín Gil

perf_exe() currently passes the full buffer length to readlink() and then
unconditionally appends a trailing NUL at buf[n].

When readlink() returns exactly len bytes, the NUL store lands one byte past
the end of the caller buffer.

This series fixes it by reading at most len - 1 bytes and keeping explicit NUL
termination only within bounds. It also hardens the fallback path for tiny
buffers so copying "perf" cannot overflow.

Miguel Martín Gil (1):
  perf util: fix perf_exe() buffer write past end

 tools/perf/util/util.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

-- 
2.43.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-05-30  0:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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.