<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/git/next/linux-next.git/tools/perf/util, branch master</title>
<subtitle>The linux-next integration testing tree</subtitle>
<id>https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/atom?h=master</id>
<link rel='self' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/'/>
<updated>2026-09-04T17:14:34+00:00</updated>
<entry>
<title>Merge branch 'perf-tools-next' of https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git</title>
<updated>2026-09-04T17:14:34+00:00</updated>
<author>
<name>Mark Brown</name>
<email>broonie@kernel.org</email>
</author>
<published>2026-09-04T17:14:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=ba3bd66de8a1625c07344896bf48d09c280b6c00'/>
<id>urn:sha1:ba3bd66de8a1625c07344896bf48d09c280b6c00</id>
<content type='text'>
</content>
</entry>
<entry>
<title>perf jitdump: Validate unwinding sizes against record payload</title>
<updated>2026-08-31T12:06:05+00:00</updated>
<author>
<name>Arnaldo Carvalho de Melo</name>
<email>acme@redhat.com</email>
</author>
<published>2026-06-17T17:00:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=92d50319b4f0c0bbee8a236a09063272cd22faab'/>
<id>urn:sha1:92d50319b4f0c0bbee8a236a09063272cd22faab</id>
<content type='text'>
jit_repipe_unwinding_info() copies unwinding_size and eh_frame_hdr_size
from the jitdump record into jd-&gt; fields without checking them against
the actual payload size.  Downstream, jit_add_eh_frame_info() in
genelf.c computes unwinding_table_size = unwinding_size -
eh_frame_hdr_size, which underflows when eh_frame_hdr_size &gt;
unwinding_size.  The result is passed as d-&gt;d_size to libelf, causing
an OOB heap read into the output ELF file.

Validate that unwinding_size fits within the record payload and that
eh_frame_hdr_size does not exceed unwinding_size before allocating or
storing the values, so a bogus record cannot force a large allocation
that is then discarded.

mapped_size is likewise taken from the record and was narrowed into an
int for the mmap2 len computation in jit_repipe_code_load() and
jit_repipe_code_move(); values above INT_MAX would turn negative,
producing a wrong mmap2 length.  Use uint64_t for usize so the value
cannot truncate.

Fixes: 0284fecd13b6db3e ("perf jit: Add unwinding support")
Reported-by: sashiko-bot &lt;sashiko-bot@kernel.org&gt;
Reviewed-by: Ian Rogers &lt;irogers@google.com&gt;
Cc: Stefano Sanfilippo &lt;ssanfilippo@chromium.org&gt;
Cc: Stephane Eranian &lt;eranian@google.com&gt;
Assisted-by: LLM
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf jitdump: Validate sym string NUL-termination in code load</title>
<updated>2026-08-31T12:05:59+00:00</updated>
<author>
<name>Arnaldo Carvalho de Melo</name>
<email>acme@redhat.com</email>
</author>
<published>2026-06-17T16:59:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=98bfe1142ccbaa5ffdca5dcdddd26f238ad33585'/>
<id>urn:sha1:98bfe1142ccbaa5ffdca5dcdddd26f238ad33585</id>
<content type='text'>
jit_repipe_code_load() computes sym = (void *)jr + sizeof(jr-&gt;load) and
passes it to jit_emit_elf() which calls strlen(sym) via jit_write_elf().
If code_size equals total_size - sizeof(jr-&gt;load), the sym pointer
aliases the code blob with no NUL terminator, and strlen() scans past
the buffer into adjacent heap memory.

Add a memchr() check to verify the symbol name is NUL-terminated within
the region between the load header and the code blob before use.

Fixes: 598b7c6919c7bbcc ("perf jit: add source line info support")
Reported-by: sashiko-bot &lt;sashiko-bot@kernel.org&gt;
Reviewed-by: Ian Rogers &lt;irogers@google.com&gt;
Cc: Stephane Eranian &lt;eranian@google.com&gt;
Assisted-by: LLM
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf jitdump: Validate debug entries on native (non-swap) path</title>
<updated>2026-08-31T12:05:52+00:00</updated>
<author>
<name>Arnaldo Carvalho de Melo</name>
<email>acme@redhat.com</email>
</author>
<published>2026-06-17T16:52:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=51e14e495f0cea061bbad33e7635f7fd857113ad'/>
<id>urn:sha1:51e14e495f0cea061bbad33e7635f7fd857113ad</id>
<content type='text'>
The bounds-checking and nr_entry clamping added for the byte-swap path
only runs when jd-&gt;needs_bswap is true.  On native-endian files, nr_entry
passes through unvalidated to jit_repipe_debug_info(), which stores it
as jd-&gt;nr_debug_entries.  Downstream, jit_process_debug_info() in
genelf_debug.c iterates nr_debug_entries times via debug_entry_next(),
which calls strlen() on each entry's name field — a crafted nr_entry
causes OOB reads and writes.

Add bounds-checked iteration in jit_repipe_debug_info() that validates
each debug_entry fits in the payload and its name is NUL-terminated
before calling debug_entry_next().  Clamp nr_debug_entries to the count
of valid entries.

Fixes: 598b7c6919c7bbcc ("perf jit: add source line info support")
Reported-by: sashiko-bot &lt;sashiko-bot@kernel.org&gt;
Reviewed-by: Ian Rogers &lt;irogers@google.com&gt;
Cc: Stephane Eranian &lt;eranian@google.com&gt;
Assisted-by: LLM
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf jitdump: Use dirname() return value in jit_open()</title>
<updated>2026-08-31T12:05:43+00:00</updated>
<author>
<name>Arnaldo Carvalho de Melo</name>
<email>acme@redhat.com</email>
</author>
<published>2026-06-15T23:41:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=4eddf7d9e341eb8c41704b8aa27b4a91f4e2c7c9'/>
<id>urn:sha1:4eddf7d9e341eb8c41704b8aa27b4a91f4e2c7c9</id>
<content type='text'>
jit_open() calls dirname(jd-&gt;dir) but ignores the return value.  POSIX
says dirname() may return a pointer to internal static storage — glibc
does this when the path has no '/', returning "." from a static buffer
and leaving jd-&gt;dir unchanged with the original filename.

Capture the return value and copy it back to jd-&gt;dir when dirname()
returns a different pointer.

Fixes: 9b07e27f88b9 ("perf inject: Add jitdump mmap injection support")
Reported-by: sashiko-bot &lt;sashiko-bot@kernel.org&gt;
Reviewed-by: Ian Rogers &lt;irogers@google.com&gt;
Cc: Stephane Eranian &lt;eranian@google.com&gt;
Assisted-by: LLM
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf jitdump: Free event in jit_repipe_code_move()</title>
<updated>2026-08-31T12:05:36+00:00</updated>
<author>
<name>Arnaldo Carvalho de Melo</name>
<email>acme@redhat.com</email>
</author>
<published>2026-06-15T23:39:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=7fc5851aac606b9e4143f6857710cc5f346770c5'/>
<id>urn:sha1:7fc5851aac606b9e4143f6857710cc5f346770c5</id>
<content type='text'>
jit_repipe_code_move() allocates a perf_event with calloc but never
frees it — the 'out' label exits with only perf_sample__exit().

The sibling function jit_repipe_code_load() correctly calls
free(event) at its out label.  Add the same free(event) to
jit_repipe_code_move().

Fixes: 9b07e27f88b9 ("perf inject: Add jitdump mmap injection support")
Reported-by: sashiko-bot &lt;sashiko-bot@kernel.org&gt;
Reviewed-by: Ian Rogers &lt;irogers@google.com&gt;
Cc: Stephane Eranian &lt;eranian@google.com&gt;
Assisted-by: LLM
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf jitdump: Fix funlockfile on unlocked stream in jit_open() error path</title>
<updated>2026-08-31T12:05:26+00:00</updated>
<author>
<name>Arnaldo Carvalho de Melo</name>
<email>acme@redhat.com</email>
</author>
<published>2026-06-15T23:35:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=bfde6848c1e24fd979d0138c57c1cc28c35093c3'/>
<id>urn:sha1:bfde6848c1e24fd979d0138c57c1cc28c35093c3</id>
<content type='text'>
If the malloc() for the initial read buffer fails, jit_open() jumps to
the error label which calls funlockfile(jd-&gt;in).  However, flockfile()
is called later in the function, so at this point the stream was never
locked.  Calling funlockfile() on an unlocked stream is undefined
behavior per POSIX.

Split the error path into two labels: 'error' (after flockfile) calls
funlockfile before cleanup, 'error_noflock' (before flockfile) skips
the unlock.

Fixes: 9b07e27f88b9 ("perf inject: Add jitdump mmap injection support")
Reported-by: sashiko-bot &lt;sashiko-bot@kernel.org&gt;
Reviewed-by: Ian Rogers &lt;irogers@google.com&gt;
Cc: Stephane Eranian &lt;eranian@google.com&gt;
Assisted-by: LLM
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf jitdump: Check snprintf return before computing header size</title>
<updated>2026-08-31T12:05:19+00:00</updated>
<author>
<name>Arnaldo Carvalho de Melo</name>
<email>acme@redhat.com</email>
</author>
<published>2026-06-15T23:27:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=0155f05ea6e133c18a04b8b5945cac59870da156'/>
<id>urn:sha1:0155f05ea6e133c18a04b8b5945cac59870da156</id>
<content type='text'>
snprintf() returns the would-have-been length on truncation.  When the
jitted filename exceeds PATH_MAX, the unclamped 'size' value inflates
sizeof(event-&gt;mmap2.filename) - size into a massive underflow, causing
the header.size computation to write an oversized header.  The
subsequent write to 'id = event + header.size - idr_size' then corrupts
the heap.

Clamp size to PATH_MAX - 1 after snprintf in both jit_repipe_code_load()
and jit_repipe_code_move().

Fixes: 9b07e27f88b9 ("perf inject: Add jitdump mmap injection support")
Reported-by: sashiko-bot &lt;sashiko-bot@kernel.org&gt;
Reviewed-by: Ian Rogers &lt;irogers@google.com&gt;
Cc: Stephane Eranian &lt;eranian@google.com&gt;
Assisted-by: LLM
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf jitdump: Bounds-check debug entry byte-swap loop</title>
<updated>2026-08-31T12:05:10+00:00</updated>
<author>
<name>Arnaldo Carvalho de Melo</name>
<email>acme@redhat.com</email>
</author>
<published>2026-06-15T23:26:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=ede3cd8151675c2983cd49104b1e9b25a3712ed8'/>
<id>urn:sha1:ede3cd8151675c2983cd49104b1e9b25a3712ed8</id>
<content type='text'>
The byte-swap loop for JIT_CODE_DEBUG_INFO uses array indexing
(jr-&gt;info.entries[n]) to iterate debug entries.  struct debug_entry has
a flexible array member name[], so each entry has a different size.
Array indexing computes offsets assuming fixed-size elements, landing
inside variable-length name strings after the first entry and
byte-swapping garbage.

Additionally, nr_entry is read from untrusted jitdump input without
validation against total_size, so a crafted value causes OOB reads.

Replace the array indexing with debug_entry_next() pointer arithmetic
(which correctly accounts for the variable-length name) and
bounds-check each entry against the record's total_size before
byte-swapping.

Fixes: 9b07e27f88b9 ("perf inject: Add jitdump mmap injection support")
Reported-by: sashiko-bot &lt;sashiko-bot@kernel.org&gt;
Reviewed-by: Ian Rogers &lt;irogers@google.com&gt;
Cc: Stephane Eranian &lt;eranian@google.com&gt;
Assisted-by: LLM
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf jitdump: Prevent integer underflow in debug info size calculation</title>
<updated>2026-08-31T12:05:00+00:00</updated>
<author>
<name>Arnaldo Carvalho de Melo</name>
<email>acme@redhat.com</email>
</author>
<published>2026-06-15T23:23:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=dfe8fe96efca3c32979dc0859f88e15b677d25f1'/>
<id>urn:sha1:dfe8fe96efca3c32979dc0859f88e15b677d25f1</id>
<content type='text'>
jit_repipe_debug_info() and jit_repipe_unwinding_info() compute payload
sizes by subtracting the fixed header size from total_size:

  sz = jr-&gt;prefix.total_size - sizeof(jr-&gt;info);

When total_size is smaller than the header struct (from a truncated or
corrupted jitdump record), the subtraction underflows to a massive
value, causing an oversized allocation followed by an OOB memcpy.

Validate that total_size covers at least the fixed header before the
subtraction in both functions.

Fixes: 598b7c6919c7 ("perf jit: add source line info support")
Fixes: 0284fecd13b6 ("perf jit: Add unwinding support")
Reported-by: sashiko-bot &lt;sashiko-bot@kernel.org&gt;
Reviewed-by: Ian Rogers &lt;irogers@google.com&gt;
Cc: Stephane Eranian &lt;eranian@google.com&gt;
Cc: Stefano Sanfilippo &lt;ssanfilippo@chromium.org&gt;
Assisted-by: LLM
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
</feed>
