From: Greg Kroah-Hartman Date: Wed, 22 Jul 2026 12:44:08 +0000 (+0200) Subject: fix up perf builds for 6.18.y X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=f9a791afb40de221110fa1cdfff579e3bb6af095;p=thirdparty%2Fkernel%2Fstable-queue.git fix up perf builds for 6.18.y --- diff --git a/queue-6.18/perf-bpf-fix-metadata-leak-in-perf_env__add_bpf_info.patch b/queue-6.18/perf-bpf-fix-metadata-leak-in-perf_env__add_bpf_info.patch index 97dcc2e0bc..b1b880bdad 100644 --- a/queue-6.18/perf-bpf-fix-metadata-leak-in-perf_env__add_bpf_info.patch +++ b/queue-6.18/perf-bpf-fix-metadata-leak-in-perf_env__add_bpf_info.patch @@ -24,14 +24,12 @@ Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- - tools/perf/util/bpf-event.c | 1 + + tools/perf/util/bpf-event.c | 1 + 1 file changed, 1 insertion(+) -diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c -index bfaf1c7b7352c9..2f5908cc8bd6f5 100644 --- a/tools/perf/util/bpf-event.c +++ b/tools/perf/util/bpf-event.c -@@ -875,6 +875,7 @@ static int perf_env__add_bpf_info(struct perf_env *env, u32 id) +@@ -873,6 +873,7 @@ static int perf_env__add_bpf_info(struct if (!perf_env__insert_bpf_prog_info(env, info_node)) { pr_debug("%s: duplicate add bpf info request for id %u\n", __func__, btf_id); @@ -39,6 +37,3 @@ index bfaf1c7b7352c9..2f5908cc8bd6f5 100644 free(info_linear); free(info_node); goto out; --- -2.53.0 - diff --git a/queue-6.18/perf-bpf-validate-array-presence-before-casting-bpf-.patch b/queue-6.18/perf-bpf-validate-array-presence-before-casting-bpf-.patch index 2705d025b7..089e115dab 100644 --- a/queue-6.18/perf-bpf-validate-array-presence-before-casting-bpf-.patch +++ b/queue-6.18/perf-bpf-validate-array-presence-before-casting-bpf-.patch @@ -35,17 +35,15 @@ Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- - tools/perf/util/bpf-event.c | 20 +++++++++++++++++--- - tools/perf/util/bpf-event.h | 4 ++-- - tools/perf/util/dso.c | 10 ++++++++++ - tools/perf/util/header.c | 3 +-- + tools/perf/util/bpf-event.c | 20 +++++++++++++++++--- + tools/perf/util/bpf-event.h | 4 ++-- + tools/perf/util/dso.c | 10 ++++++++++ + tools/perf/util/header.c | 3 +-- 4 files changed, 30 insertions(+), 7 deletions(-) -diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c -index 579742afe2221f..9fa64c4bde6972 100644 --- a/tools/perf/util/bpf-event.c +++ b/tools/perf/util/bpf-event.c -@@ -59,6 +59,10 @@ static int machine__process_bpf_event_load(struct machine *machine, +@@ -59,6 +59,10 @@ static int machine__process_bpf_event_lo return 0; info_linear = info_node->info_linear; @@ -56,7 +54,7 @@ index 579742afe2221f..9fa64c4bde6972 100644 for (i = 0; i < info_linear->info.nr_jited_ksyms; i++) { u64 *addrs = (u64 *)(uintptr_t)(info_linear->info.jited_ksyms); u64 addr = addrs[i]; -@@ -961,12 +965,15 @@ int evlist__add_bpf_sb_event(struct evlist *evlist, struct perf_env *env) +@@ -959,12 +963,15 @@ int evlist__add_bpf_sb_event(struct evli return evlist__add_sb_event(evlist, &attr, bpf_event__sb_cb, env); } @@ -75,7 +73,7 @@ index 579742afe2221f..9fa64c4bde6972 100644 char name[KSYM_NAME_LEN]; struct btf *btf = NULL; u32 sub_prog_cnt, i; -@@ -976,6 +983,13 @@ void __bpf_event__print_bpf_prog_info(struct bpf_prog_info *info, +@@ -974,6 +981,13 @@ void __bpf_event__print_bpf_prog_info(st sub_prog_cnt != info->nr_jited_func_lens) return; @@ -89,8 +87,6 @@ index 579742afe2221f..9fa64c4bde6972 100644 if (info->btf_id) { struct btf_node *node; -diff --git a/tools/perf/util/bpf-event.h b/tools/perf/util/bpf-event.h -index 60d2c6637af5d6..da4eeb4a1a7320 100644 --- a/tools/perf/util/bpf-event.h +++ b/tools/perf/util/bpf-event.h @@ -40,7 +40,7 @@ struct btf_node { @@ -102,7 +98,7 @@ index 60d2c6637af5d6..da4eeb4a1a7320 100644 struct perf_env *env, FILE *fp); void bpf_metadata_free(struct bpf_metadata *metadata); -@@ -58,7 +58,7 @@ static inline int evlist__add_bpf_sb_event(struct evlist *evlist __maybe_unused, +@@ -58,7 +58,7 @@ static inline int evlist__add_bpf_sb_eve return 0; } @@ -111,11 +107,9 @@ index 60d2c6637af5d6..da4eeb4a1a7320 100644 struct perf_env *env __maybe_unused, FILE *fp __maybe_unused) { -diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c -index 5b88b19f9d8e3c..48f0617df2dbbd 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c -@@ -882,6 +882,12 @@ static ssize_t bpf_read(struct dso *dso, u64 offset, char *data) +@@ -879,6 +879,12 @@ static ssize_t bpf_read(struct dso *dso, return -1; } @@ -128,7 +122,7 @@ index 5b88b19f9d8e3c..48f0617df2dbbd 100644 len = node->info_linear->info.jited_prog_len; buf = (u8 *)(uintptr_t)node->info_linear->info.jited_prog_insns; -@@ -1927,6 +1933,10 @@ const u8 *dso__read_symbol(struct dso *dso, const char *symfs_filename, +@@ -1920,6 +1926,10 @@ const u8 *dso__read_symbol(struct dso *d return NULL; } info_linear = info_node->info_linear; @@ -139,11 +133,9 @@ index 5b88b19f9d8e3c..48f0617df2dbbd 100644 assert(len <= info_linear->info.jited_prog_len); *out_buf_len = len; return (const u8 *)(uintptr_t)(info_linear->info.jited_prog_insns); -diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c -index 131fdbe9cefda5..9cb1d54b2452d9 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c -@@ -1825,8 +1825,7 @@ static void print_bpf_prog_info(struct feat_fd *ff, FILE *fp) +@@ -1825,8 +1825,7 @@ static void print_bpf_prog_info(struct f node = rb_entry(next, struct bpf_prog_info_node, rb_node); next = rb_next(&node->rb_node); @@ -153,6 +145,3 @@ index 131fdbe9cefda5..9cb1d54b2452d9 100644 } up_read(&env->bpf_progs.lock); --- -2.53.0 - diff --git a/queue-6.18/perf-dso-fix-heap-overflow-in-dso__get_filename-on-d.patch b/queue-6.18/perf-dso-fix-heap-overflow-in-dso__get_filename-on-d.patch index c0787ff614..e3e2e0f312 100644 --- a/queue-6.18/perf-dso-fix-heap-overflow-in-dso__get_filename-on-d.patch +++ b/queue-6.18/perf-dso-fix-heap-overflow-in-dso__get_filename-on-d.patch @@ -26,14 +26,12 @@ Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- - tools/perf/util/dso.c | 9 ++++++++- + tools/perf/util/dso.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c -index 1205224e110375..cfbad2d0496e89 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c -@@ -605,8 +605,15 @@ static char *dso__get_filename(struct dso *dso, const char *root_dir, +@@ -602,8 +602,15 @@ static char *dso__get_filename(struct ds /* empty pathname means file wasn't actually compressed */ if (newpath[0] != '\0') { @@ -50,6 +48,3 @@ index 1205224e110375..cfbad2d0496e89 100644 } } return name; --- -2.53.0 - diff --git a/queue-6.18/perf-dso-set-standard-errno-on-decompression-failure.patch b/queue-6.18/perf-dso-set-standard-errno-on-decompression-failure.patch index f7b86dc2b1..f4cb63cc1b 100644 --- a/queue-6.18/perf-dso-set-standard-errno-on-decompression-failure.patch +++ b/queue-6.18/perf-dso-set-standard-errno-on-decompression-failure.patch @@ -27,14 +27,12 @@ Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- - tools/perf/util/dso.c | 8 +++++++- + tools/perf/util/dso.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c -index 48f0617df2dbbd..d63e97480fece4 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c -@@ -602,7 +602,13 @@ static char *dso__get_filename(struct dso *dso, const char *root_dir, +@@ -599,7 +599,13 @@ static char *dso__get_filename(struct ds size_t len = sizeof(newpath); if (dso__decompress_kmodule_path(dso, name, newpath, len) < 0) { @@ -49,6 +47,3 @@ index 48f0617df2dbbd..d63e97480fece4 100644 goto out; } --- -2.53.0 - diff --git a/queue-6.18/perf-maps-add-maps__mutate_mapping.patch b/queue-6.18/perf-maps-add-maps__mutate_mapping.patch deleted file mode 100644 index a041770e8e..0000000000 --- a/queue-6.18/perf-maps-add-maps__mutate_mapping.patch +++ /dev/null @@ -1,416 +0,0 @@ -From fccf3266bfc6922dcb2cab26633ce786b13cd163 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 11 Jun 2026 09:41:18 -0700 -Subject: perf maps: Add maps__mutate_mapping - -From: Ian Rogers - -[ Upstream commit 75a4888b7029a1f98613aef91f517b2ee1f03d43 ] - -During kernel ELF symbol parsing (dso__process_kernel_symbol), proc -kallsyms image loading (dso__load_kernel_sym, -dso__load_guest_kernel_sym), and dynamic kernel memory map alignment -updates (machine__update_kernel_mmap), the loader directly modifies live -virtual address boundary keys fields on map objects. - -If these boundaries are mutated while the map pointer actively resides -inside the parent maps cache array list (kmaps) outside of any lock -closure, an unsafe concurrent window is exposed where parallel worker -lookup threads (e.g., inside perf top) can mistakenly assume the cache -remains sorted based on stale parameters, executing binary search -queries (bsearch) across an unsorted range and triggering lookup -failures. - -Fix this by introducing maps__mutate_mapping() that explicitly acquires -the parent maps write semaphore lock, executes an incoming mutation -callback block to perform the field updates under lock protection, and -invalidates the sorted tracking flags prior to releasing the write lock. - -This guarantees synchronization invariants, closing the concurrent -lookup race window. The adjacent module alignment pass inside -machine__create_kernel_maps() is safely preserved as a high-performance -lockless pass, as its invocation lifecycle bounds remain strictly -single-threaded by contract during session initialization construction. - -To safely support this unconditional down_write write lock mutator -without recursive read-to-write self-deadlock upgrades during lazy -symbol loading, we introduce a public maps__load_maps() API. - -It copies map pointers under a brief read lock and force-loads all -modules locklessly outside the lock. Callers (such as perf inject) must -pre-load all kernel symbol maps up front at startup using -maps__load_maps(), completely bypassing dynamic runtime mutations. - -Fixes: 39b12f781271 ("perf tools: Make it possible to read object code from vmlinux") - -Assisted-by: Antigravity:gemini-3.1-pro -Signed-off-by: Ian Rogers -Tested-by: James Clark -Cc: Adrian Hunter -Cc: Gabriel Marin -Cc: Ingo Molnar -Cc: Jiri Olsa -Cc: Namhyung Kim -Cc: Peter Zijlstra -Signed-off-by: Arnaldo Carvalho de Melo -Signed-off-by: Sasha Levin ---- - tools/perf/util/machine.c | 32 +++++--- - tools/perf/util/maps.c | 148 ++++++++++++++++++++++++++++------- - tools/perf/util/maps.h | 3 + - tools/perf/util/symbol-elf.c | 41 ++++++---- - tools/perf/util/symbol.c | 17 +++- - 5 files changed, 183 insertions(+), 58 deletions(-) - -diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c -index b5dd42588c916d..1de644fe91a873 100644 ---- a/tools/perf/util/machine.c -+++ b/tools/perf/util/machine.c -@@ -1522,22 +1522,30 @@ static void machine__set_kernel_mmap(struct machine *machine, - map__set_end(machine->vmlinux_map, ~0ULL); - } - --static int machine__update_kernel_mmap(struct machine *machine, -- u64 start, u64 end) -+struct kernel_mmap_mutation_ctx { -+ u64 start; -+ u64 end; -+}; -+ -+static int kernel_mmap_mutate_cb(struct map *map, void *data) - { -- struct map *orig, *updated; -- int err; -+ struct kernel_mmap_mutation_ctx *ctx = data; - -- orig = machine->vmlinux_map; -- updated = map__get(orig); -+ map__set_start(map, ctx->start); -+ map__set_end(map, ctx->end); -+ if (ctx->start == 0 && ctx->end == 0) -+ map__set_end(map, ~0ULL); -+ return 0; -+} - -- machine->vmlinux_map = updated; -- maps__remove(machine__kernel_maps(machine), orig); -- machine__set_kernel_mmap(machine, start, end); -- err = maps__insert(machine__kernel_maps(machine), updated); -- map__put(orig); -+static int machine__update_kernel_mmap(struct machine *machine, -+ u64 start, u64 end) -+{ -+ struct kernel_mmap_mutation_ctx ctx = { .start = start, .end = end }; - -- return err; -+ return maps__mutate_mapping(machine__kernel_maps(machine), -+ machine->vmlinux_map, -+ kernel_mmap_mutate_cb, &ctx); - } - - int machine__create_kernel_maps(struct machine *machine) -diff --git a/tools/perf/util/maps.c b/tools/perf/util/maps.c -index 23aa8a95d04542..a6d19af4386e9c 100644 ---- a/tools/perf/util/maps.c -+++ b/tools/perf/util/maps.c -@@ -551,6 +551,48 @@ void maps__remove(struct maps *maps, struct map *map) - up_write(maps__lock(maps)); - } - -+/** -+ * maps__mutate_mapping - Apply write-protected mutations to a map. -+ * @maps: The maps collection containing the map. -+ * @map: The map to mutate. -+ * @mutate_cb: Callback function that performs the actual mutations. -+ * @data: Private data passed to the callback. -+ * -+ * This acquires the write lock on the maps semaphore to safely protect -+ * concurrent readers from seeing partially mutated or unsorted map boundaries. -+ * -+ * WARNING: Acquiring down_write() here can trigger a recursive self-deadlock if -+ * the caller already holds the read lock (e.g., during maps__for_each_map() or -+ * maps__find() iteration paths that trigger lazy symbol loading). To completely -+ * avoid this deadlock, all kernel/module maps must be pre-loaded up-front (via -+ * maps__load_maps()) under a clean, single-threaded context before entering -+ * multi-threaded event processing loops. -+ */ -+int maps__mutate_mapping(struct maps *maps, struct map *map, -+ int (*mutate_cb)(struct map *map, void *data), void *data) -+{ -+ int err = 0; -+ -+ if (maps) { -+ down_write(maps__lock(maps)); -+ -+ err = mutate_cb(map, data); -+ -+ RC_CHK_ACCESS(maps)->maps_by_address_sorted = false; -+ RC_CHK_ACCESS(maps)->maps_by_name_sorted = false; -+ -+ up_write(maps__lock(maps)); -+ -+#ifdef HAVE_LIBDW_SUPPORT -+ libdw__invalidate_dwfl(maps, maps__libdw_addr_space_dwfl(maps)); -+#endif -+ } else { -+ err = mutate_cb(map, data); -+ } -+ -+ return err; -+} -+ - bool maps__empty(struct maps *maps) - { - bool res; -@@ -601,6 +643,41 @@ int maps__for_each_map(struct maps *maps, int (*cb)(struct map *map, void *data) - return ret; - } - -+int maps__load_maps(struct maps *maps) -+{ -+ struct map **maps_copy; -+ unsigned int nr_maps; -+ int err = 0; -+ -+ if (!maps) -+ return 0; -+ -+ down_read(maps__lock(maps)); -+ nr_maps = maps__nr_maps(maps); -+ if (nr_maps == 0) { -+ up_read(maps__lock(maps)); -+ return 0; -+ } -+ maps_copy = calloc(nr_maps, sizeof(*maps_copy)); -+ if (!maps_copy) { -+ up_read(maps__lock(maps)); -+ return -ENOMEM; -+ } -+ for (unsigned int i = 0; i < nr_maps; i++) -+ maps_copy[i] = map__get(maps__maps_by_address(maps)[i]); -+ up_read(maps__lock(maps)); -+ -+ for (unsigned int i = 0; i < nr_maps; i++) { -+ if (map__load(maps_copy[i]) < 0) { -+ pr_warning("Failed to load map %s\n", dso__name(map__dso(maps_copy[i]))); -+ err = -1; -+ } -+ map__put(maps_copy[i]); -+ } -+ free(maps_copy); -+ return err; -+} -+ - void maps__remove_maps(struct maps *maps, bool (*cb)(struct map *map, void *data), void *data) - { - struct map **maps_by_address; -@@ -635,40 +712,57 @@ struct symbol *maps__find_symbol(struct maps *maps, u64 addr, struct map **mapp) - return result; - } - --struct maps__find_symbol_by_name_args { -- struct map **mapp; -- const char *name; -- struct symbol *sym; --}; -- --static int maps__find_symbol_by_name_cb(struct map *map, void *data) -+struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name, struct map **mapp) - { -- struct maps__find_symbol_by_name_args *args = data; -+ struct map **maps_copy; -+ unsigned int nr_maps; -+ struct symbol *sym = NULL; - -- args->sym = map__find_symbol_by_name(map, args->name); -- if (!args->sym) -- return 0; -+ if (!maps) -+ return NULL; - -- if (!map__contains_symbol(map, args->sym)) { -- args->sym = NULL; -- return 0; -+ /* -+ * First, ensure all maps are loaded. We pre-load them outside of any -+ * read-to-write locks to avoid deadlocks. Even if some fail, we proceed. -+ */ -+ maps__load_maps(maps); -+ -+ /* -+ * Create a local snapshot of the maps while holding the read lock. -+ * This prevents deadlocking if iteration triggers further map insertions. -+ */ -+ down_read(maps__lock(maps)); -+ nr_maps = maps__nr_maps(maps); -+ maps_copy = calloc(nr_maps, sizeof(*maps_copy)); -+ if (maps_copy) { -+ for (unsigned int i = 0; i < nr_maps; i++) { -+ struct map *map = maps__maps_by_address(maps)[i]; -+ -+ maps_copy[i] = map__get(map); -+ } - } -+ up_read(maps__lock(maps)); - -- if (args->mapp != NULL) -- *args->mapp = map__get(map); -- return 1; --} -+ if (!maps_copy) -+ return NULL; - --struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name, struct map **mapp) --{ -- struct maps__find_symbol_by_name_args args = { -- .mapp = mapp, -- .name = name, -- .sym = NULL, -- }; -+ for (unsigned int i = 0; i < nr_maps; i++) { -+ struct map *map = maps_copy[i]; -+ -+ sym = map__find_symbol_by_name(map, name); -+ if (sym && map__contains_symbol(map, sym)) { -+ if (mapp) -+ *mapp = map__get(map); -+ break; -+ } -+ sym = NULL; -+ } -+ -+ for (unsigned int i = 0; i < nr_maps; i++) -+ map__put(maps_copy[i]); - -- maps__for_each_map(maps, maps__find_symbol_by_name_cb, &args); -- return args.sym; -+ free(maps_copy); -+ return sym; - } - - int maps__find_ams(struct maps *maps, struct addr_map_symbol *ams) -diff --git a/tools/perf/util/maps.h b/tools/perf/util/maps.h -index d9aa62ed968ac4..df22f8c1b32bd1 100644 ---- a/tools/perf/util/maps.h -+++ b/tools/perf/util/maps.h -@@ -55,8 +55,11 @@ void maps__set_unwind_libunwind_ops(struct maps *maps, const struct unwind_libun - - size_t maps__fprintf(struct maps *maps, FILE *fp); - -+int maps__load_maps(struct maps *maps); - int maps__insert(struct maps *maps, struct map *map); - void maps__remove(struct maps *maps, struct map *map); -+int maps__mutate_mapping(struct maps *maps, struct map *map, -+ int (*mutate_cb)(struct map *map, void *data), void *data); - - struct map *maps__find(struct maps *maps, u64 addr); - struct symbol *maps__find_symbol(struct maps *maps, u64 addr, struct map **mapp); -diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c -index 107e10006cd1c7..12a4390ba2d267 100644 ---- a/tools/perf/util/symbol-elf.c -+++ b/tools/perf/util/symbol-elf.c -@@ -1369,6 +1369,24 @@ static u64 ref_reloc(struct kmap *kmap) - void __weak arch__sym_update(struct symbol *s __maybe_unused, - GElf_Sym *sym __maybe_unused) { } - -+struct remap_kernel_ctx { -+ u64 sh_addr; -+ u64 sh_size; -+ u64 sh_offset; -+ struct kmap *kmap; -+}; -+ -+static int remap_kernel_cb(struct map *map, void *data) -+{ -+ struct remap_kernel_ctx *ctx = data; -+ -+ map__set_start(map, ctx->sh_addr + ref_reloc(ctx->kmap)); -+ map__set_end(map, map__start(map) + ctx->sh_size); -+ map__set_pgoff(map, ctx->sh_offset); -+ map__set_mapping_type(map, MAPPING_TYPE__DSO); -+ return 0; -+} -+ - static int dso__process_kernel_symbol(struct dso *dso, struct map *map, - GElf_Sym *sym, GElf_Shdr *shdr, - struct maps *kmaps, struct kmap *kmap, -@@ -1399,22 +1417,15 @@ static int dso__process_kernel_symbol(struct dso *dso, struct map *map, - * map to the kernel dso. - */ - if (*remap_kernel && dso__kernel(dso) && !kmodule) { -+ struct remap_kernel_ctx ctx = { -+ .sh_addr = shdr->sh_addr, -+ .sh_size = shdr->sh_size, -+ .sh_offset = shdr->sh_offset, -+ .kmap = kmap -+ }; -+ - *remap_kernel = false; -- map__set_start(map, shdr->sh_addr + ref_reloc(kmap)); -- map__set_end(map, map__start(map) + shdr->sh_size); -- map__set_pgoff(map, shdr->sh_offset); -- map__set_mapping_type(map, MAPPING_TYPE__DSO); -- /* Ensure maps are correctly ordered */ -- if (kmaps) { -- int err; -- struct map *tmp = map__get(map); -- -- maps__remove(kmaps, map); -- err = maps__insert(kmaps, map); -- map__put(tmp); -- if (err) -- return err; -- } -+ maps__mutate_mapping(kmaps, map, remap_kernel_cb, &ctx); - } - - /* -diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c -index f6c268c588a569..f4abe5dbf1a4c5 100644 ---- a/tools/perf/util/symbol.c -+++ b/tools/perf/util/symbol.c -@@ -49,6 +49,13 @@ - #include - #include - -+static int map_fixup_cb(struct map *map, void *data __maybe_unused) -+{ -+ map__fixup_start(map); -+ map__fixup_end(map); -+ return 0; -+} -+ - static int dso__load_kernel_sym(struct dso *dso, struct map *map); - static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map); - static bool symbol__is_idle(const char *name); -@@ -2124,10 +2131,11 @@ static int dso__load_kernel_sym(struct dso *dso, struct map *map) - free(kallsyms_allocated_filename); - - if (err > 0 && !dso__is_kcore(dso)) { -+ struct maps *kmaps = map__kmaps(map); -+ - dso__set_binary_type(dso, DSO_BINARY_TYPE__KALLSYMS); - dso__set_long_name(dso, DSO__NAME_KALLSYMS, false); -- map__fixup_start(map); -- map__fixup_end(map); -+ maps__mutate_mapping(kmaps, map, map_fixup_cb, NULL); - } - - return err; -@@ -2167,10 +2175,11 @@ static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map) - if (err > 0) - pr_debug("Using %s for symbols\n", kallsyms_filename); - if (err > 0 && !dso__is_kcore(dso)) { -+ struct maps *kmaps = map__kmaps(map); -+ - dso__set_binary_type(dso, DSO_BINARY_TYPE__GUEST_KALLSYMS); - dso__set_long_name(dso, machine->mmap_name, false); -- map__fixup_start(map); -- map__fixup_end(map); -+ maps__mutate_mapping(kmaps, map, map_fixup_cb, NULL); - } - - return err; --- -2.53.0 - diff --git a/queue-6.18/perf-sched-bounds-check-prio-before-test_bit-in-time.patch b/queue-6.18/perf-sched-bounds-check-prio-before-test_bit-in-time.patch index 4038edade9..fb84c8ef16 100644 --- a/queue-6.18/perf-sched-bounds-check-prio-before-test_bit-in-time.patch +++ b/queue-6.18/perf-sched-bounds-check-prio-before-test_bit-in-time.patch @@ -33,14 +33,12 @@ Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- - tools/perf/builtin-sched.c | 4 +++- + tools/perf/builtin-sched.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c -index 36c8a018a830f1..074de58c8675b7 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c -@@ -2631,7 +2631,9 @@ static bool timehist_skip_sample(struct perf_sched *sched, +@@ -2613,7 +2613,9 @@ static bool timehist_skip_sample(struct else if (evsel__name_is(evsel, "sched:sched_switch")) prio = evsel__intval(evsel, sample, "prev_prio"); @@ -51,6 +49,3 @@ index 36c8a018a830f1..074de58c8675b7 100644 rc = true; sched->skipped_samples++; } --- -2.53.0 - diff --git a/queue-6.18/perf-sched-cap-max_cpu-at-max_cpus-in-timehist-sampl.patch b/queue-6.18/perf-sched-cap-max_cpu-at-max_cpus-in-timehist-sampl.patch index 0a2a849b65..e2f30d0b54 100644 --- a/queue-6.18/perf-sched-cap-max_cpu-at-max_cpus-in-timehist-sampl.patch +++ b/queue-6.18/perf-sched-cap-max_cpu-at-max_cpus-in-timehist-sampl.patch @@ -27,14 +27,12 @@ Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- - tools/perf/builtin-sched.c | 8 +++++--- + tools/perf/builtin-sched.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) -diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c -index 273a7eadfa8528..2600747b243184 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c -@@ -3206,7 +3206,9 @@ static int perf_timehist__process_sample(const struct perf_tool *tool, +@@ -3188,7 +3188,9 @@ static int perf_timehist__process_sample .cpu = sample->cpu, }; @@ -45,7 +43,7 @@ index 273a7eadfa8528..2600747b243184 100644 sched->max_cpu = this_cpu; if (evsel->handler != NULL) { -@@ -3376,8 +3378,8 @@ static int perf_sched__timehist(struct perf_sched *sched) +@@ -3358,8 +3360,8 @@ static int perf_sched__timehist(struct p perf_session__set_tracepoints_handlers(session, migrate_handlers)) goto out; @@ -56,6 +54,3 @@ index 273a7eadfa8528..2600747b243184 100644 if (sched->max_cpu.cpu == 0) sched->max_cpu.cpu = 4; if (init_idle_threads(sched->max_cpu.cpu)) --- -2.53.0 - diff --git a/queue-6.18/perf-sched-clean-up-idle_threads-entry-on-init-failu.patch b/queue-6.18/perf-sched-clean-up-idle_threads-entry-on-init-failu.patch index 00e778de53..f32b28e196 100644 --- a/queue-6.18/perf-sched-clean-up-idle_threads-entry-on-init-failu.patch +++ b/queue-6.18/perf-sched-clean-up-idle_threads-entry-on-init-failu.patch @@ -29,14 +29,12 @@ Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- - tools/perf/builtin-sched.c | 5 ++++- + tools/perf/builtin-sched.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c -index 0b245e8240f6ec..34e974ef49891b 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c -@@ -2507,8 +2507,11 @@ static struct thread *get_idle_thread(int cpu) +@@ -2489,8 +2489,11 @@ static struct thread *get_idle_thread(in idle_threads[cpu] = thread__new(0, 0); if (idle_threads[cpu]) { @@ -49,6 +47,3 @@ index 0b245e8240f6ec..34e974ef49891b 100644 } } --- -2.53.0 - diff --git a/queue-6.18/perf-sched-fix-idle-hist-callchain-display-using-wro.patch b/queue-6.18/perf-sched-fix-idle-hist-callchain-display-using-wro.patch index 78979cc754..88b91c2a77 100644 --- a/queue-6.18/perf-sched-fix-idle-hist-callchain-display-using-wro.patch +++ b/queue-6.18/perf-sched-fix-idle-hist-callchain-display-using-wro.patch @@ -35,14 +35,12 @@ Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- - tools/perf/builtin-sched.c | 3 ++- + tools/perf/builtin-sched.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c -index 074de58c8675b7..00d52816185f69 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c -@@ -3111,7 +3111,8 @@ static size_t timehist_print_idlehist_callchain(struct rb_root_cached *root) +@@ -3093,7 +3093,8 @@ static size_t timehist_print_idlehist_ca size_t ret = 0; FILE *fp = stdout; struct callchain_node *chain; @@ -52,6 +50,3 @@ index 074de58c8675b7..00d52816185f69 100644 printf(" %16s %8s %s\n", "Idle time (msec)", "Count", "Callchains"); printf(" %.16s %.8s %.50s\n", graph_dotted_line, graph_dotted_line, --- -2.53.0 - diff --git a/queue-6.18/perf-sched-fix-null-dereference-in-latency_runtime_e.patch b/queue-6.18/perf-sched-fix-null-dereference-in-latency_runtime_e.patch deleted file mode 100644 index 39efee7cd2..0000000000 --- a/queue-6.18/perf-sched-fix-null-dereference-in-latency_runtime_e.patch +++ /dev/null @@ -1,56 +0,0 @@ -From ed77af310e6260e639c9f3d5787180a36aea4324 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 4 Jun 2026 12:56:02 -0300 -Subject: perf sched: Fix NULL dereference in latency_runtime_event - -From: Arnaldo Carvalho de Melo - -[ Upstream commit 8cbca8a480e15f6326ce94287570993f27a4b2d5 ] - -latency_runtime_event() passes the return value of -machine__findnew_thread() directly to thread_atoms_search() at line -1216, before checking for NULL at line 1220. thread_atoms_search() -calls pid_cmp() which dereferences the thread pointer via -thread__tid(), causing a NULL pointer dereference if the allocation -fails. - -All other callers of thread_atoms_search() in this file -(latency_switch_event, latency_wakeup_event, -latency_migrate_task_event) correctly check for NULL first. - -Move the atoms assignment after the NULL check to match the pattern -used by the other callers. - -Fixes: b91fc39f4ad7 ("perf machine: Protect the machine->threads with a rwlock") -Reported-by: sashiko-bot -Assisted-by: Claude:claude-opus-4.6 -Signed-off-by: Arnaldo Carvalho de Melo -Signed-off-by: Sasha Levin ---- - tools/perf/builtin-sched.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c -index 1181a2afd273a3..273a7eadfa8528 100644 ---- a/tools/perf/builtin-sched.c -+++ b/tools/perf/builtin-sched.c -@@ -1209,13 +1209,15 @@ static int latency_runtime_event(struct perf_sched *sched, - const u32 pid = evsel__intval(evsel, sample, "pid"); - const u64 runtime = evsel__intval(evsel, sample, "runtime"); - struct thread *thread = machine__findnew_thread(machine, -1, pid); -- struct work_atoms *atoms = thread_atoms_search(&sched->atom_root, thread, &sched->cmp_pid); -+ struct work_atoms *atoms; - u64 timestamp = sample->time; - int cpu = sample->cpu, err = -1; - - if (thread == NULL) - return -1; - -+ atoms = thread_atoms_search(&sched->atom_root, thread, &sched->cmp_pid); -+ - /* perf.data is untrusted input — CPU may be absent or corrupted */ - if (cpu >= MAX_CPUS || cpu < 0) { - pr_warning("WARNING: at offset %#" PRIx64 ": out-of-bound sample CPU %d, skipping sample\n", --- -2.53.0 - diff --git a/queue-6.18/perf-sched-replace-bug_on-on-invalid-cpu-with-gracef.patch b/queue-6.18/perf-sched-replace-bug_on-on-invalid-cpu-with-gracef.patch deleted file mode 100644 index 4de7150b42..0000000000 --- a/queue-6.18/perf-sched-replace-bug_on-on-invalid-cpu-with-gracef.patch +++ /dev/null @@ -1,84 +0,0 @@ -From f316fa5990e41d803aaf887249a73dbc7e798f8f Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 1 Jun 2026 19:53:41 -0300 -Subject: perf sched: Replace BUG_ON on invalid CPU with graceful skip - -From: Arnaldo Carvalho de Melo - -[ Upstream commit 1e2c83f732deb329ebce23e26cbc482f4c4bf194 ] - -latency_switch_event(), latency_runtime_event(), and map_switch_event() -use BUG_ON(cpu >= MAX_CPUS || cpu < 0) to validate the sample CPU. -When PERF_SAMPLE_CPU is absent from the sample type, -evsel__parse_sample() initializes sample->cpu to (u32)-1. Casting -this to int yields -1, which triggers the BUG_ON and aborts perf sched. - -The central CPU validation in perf_session__deliver_event() intentionally -preserves the (u32)-1 sentinel for downstream tools like perf script -and perf inject, so leaf callbacks must handle it themselves. - -Replace the three BUG_ON calls with graceful skips using pr_warning(), -matching the existing pattern in process_sched_switch_event() and -process_sched_runtime_event() earlier in the same file. Include the -file offset for cross-referencing with perf report -D. - -Reported-by: sashiko-bot@kernel.org # Running on a local machine -Reviewed-by: Ian Rogers -Assisted-by: Claude:claude-opus-4.6 -Signed-off-by: Arnaldo Carvalho de Melo -Stable-dep-of: 8cbca8a480e1 ("perf sched: Fix NULL dereference in latency_runtime_event") -Signed-off-by: Sasha Levin ---- - tools/perf/builtin-sched.c | 22 +++++++++++++++++++--- - 1 file changed, 19 insertions(+), 3 deletions(-) - -diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c -index 723a4ca059cc39..1181a2afd273a3 100644 ---- a/tools/perf/builtin-sched.c -+++ b/tools/perf/builtin-sched.c -@@ -1140,7 +1140,12 @@ static int latency_switch_event(struct perf_sched *sched, - int cpu = sample->cpu, err = -1; - s64 delta; - -- BUG_ON(cpu >= MAX_CPUS || cpu < 0); -+ /* perf.data is untrusted input — CPU may be absent or corrupted */ -+ if (cpu >= MAX_CPUS || cpu < 0) { -+ pr_warning("WARNING: at offset %#" PRIx64 ": out-of-bound sample CPU %d, skipping sample\n", -+ sample->file_offset, cpu); -+ return 0; -+ } - - timestamp0 = sched->cpu_last_switched[cpu]; - sched->cpu_last_switched[cpu] = timestamp; -@@ -1211,7 +1216,13 @@ static int latency_runtime_event(struct perf_sched *sched, - if (thread == NULL) - return -1; - -- BUG_ON(cpu >= MAX_CPUS || cpu < 0); -+ /* perf.data is untrusted input — CPU may be absent or corrupted */ -+ if (cpu >= MAX_CPUS || cpu < 0) { -+ pr_warning("WARNING: at offset %#" PRIx64 ": out-of-bound sample CPU %d, skipping sample\n", -+ sample->file_offset, cpu); -+ err = 0; -+ goto out_put; -+ } - if (!atoms) { - if (thread_atoms_insert(sched, thread)) - goto out_put; -@@ -1640,7 +1651,12 @@ static int map_switch_event(struct perf_sched *sched, struct evsel *evsel, - const char *str; - int ret = -1; - -- BUG_ON(this_cpu.cpu >= MAX_CPUS || this_cpu.cpu < 0); -+ /* perf.data is untrusted input — CPU may be absent or corrupted */ -+ if (this_cpu.cpu >= MAX_CPUS || this_cpu.cpu < 0) { -+ pr_warning("WARNING: at offset %#" PRIx64 ": out-of-bound sample CPU %d, skipping sample\n", -+ sample->file_offset, this_cpu.cpu); -+ return 0; -+ } - - if (this_cpu.cpu > sched->max_cpu.cpu) - sched->max_cpu = this_cpu; --- -2.53.0 - diff --git a/queue-6.18/perf-sched-replace-void-1-sentinel-with-proper-runti.patch b/queue-6.18/perf-sched-replace-void-1-sentinel-with-proper-runti.patch index 7783b188d5..83e95f992b 100644 --- a/queue-6.18/perf-sched-replace-void-1-sentinel-with-proper-runti.patch +++ b/queue-6.18/perf-sched-replace-void-1-sentinel-with-proper-runti.patch @@ -34,11 +34,9 @@ Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- - tools/perf/builtin-sched.c | 23 +++++++++++++++++------ + tools/perf/builtin-sched.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) -diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c -index 00d52816185f69..8732b1960687ab 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -267,6 +267,7 @@ struct thread_runtime { @@ -49,7 +47,7 @@ index 00d52816185f69..8732b1960687ab 100644 }; /* per event run time data */ -@@ -1589,22 +1590,32 @@ static int process_sched_wakeup_ignore(const struct perf_tool *tool __maybe_unus +@@ -1576,22 +1577,32 @@ static int process_sched_wakeup_ignore(c static bool thread__has_color(struct thread *thread) { @@ -88,6 +86,3 @@ index 00d52816185f69..8732b1960687ab 100644 return thread; } --- -2.53.0 - diff --git a/queue-6.18/perf-sched-use-thread__put-in-free_idle_threads.patch b/queue-6.18/perf-sched-use-thread__put-in-free_idle_threads.patch index fd6738df7e..2915d9d6e6 100644 --- a/queue-6.18/perf-sched-use-thread__put-in-free_idle_threads.patch +++ b/queue-6.18/perf-sched-use-thread__put-in-free_idle_threads.patch @@ -30,14 +30,12 @@ Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- - tools/perf/builtin-sched.c | 2 +- + tools/perf/builtin-sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c -index 34e974ef49891b..e93606446cc3c6 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c -@@ -2474,7 +2474,7 @@ static void free_idle_threads(void) +@@ -2456,7 +2456,7 @@ static void free_idle_threads(void) if (itr) thread__put(itr->last_thread); @@ -46,6 +44,3 @@ index 34e974ef49891b..e93606446cc3c6 100644 } } --- -2.53.0 - diff --git a/queue-6.18/perf-stat-bounds-check-cpu-index-in-topology-aggrega.patch b/queue-6.18/perf-stat-bounds-check-cpu-index-in-topology-aggrega.patch index 821f93dd3c..a7dbc1ee71 100644 --- a/queue-6.18/perf-stat-bounds-check-cpu-index-in-topology-aggrega.patch +++ b/queue-6.18/perf-stat-bounds-check-cpu-index-in-topology-aggrega.patch @@ -33,14 +33,12 @@ Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- - tools/perf/builtin-stat.c | 13 +++++++------ + tools/perf/builtin-stat.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) -diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c -index 9eb0876633c05e..ae255f6c31e32c 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c -@@ -1565,7 +1565,8 @@ static struct aggr_cpu_id perf_env__get_socket_aggr_by_cpu(struct perf_cpu cpu, +@@ -1564,7 +1564,8 @@ static struct aggr_cpu_id perf_env__get_ struct perf_env *env = data; struct aggr_cpu_id id = aggr_cpu_id__empty(); @@ -50,7 +48,7 @@ index 9eb0876633c05e..ae255f6c31e32c 100644 id.socket = env->cpu[cpu.cpu].socket_id; return id; -@@ -1576,7 +1577,7 @@ static struct aggr_cpu_id perf_env__get_die_aggr_by_cpu(struct perf_cpu cpu, voi +@@ -1575,7 +1576,7 @@ static struct aggr_cpu_id perf_env__get_ struct perf_env *env = data; struct aggr_cpu_id id = aggr_cpu_id__empty(); @@ -59,7 +57,7 @@ index 9eb0876633c05e..ae255f6c31e32c 100644 /* * die_id is relative to socket, so start * with the socket ID and then add die to -@@ -1632,7 +1633,7 @@ static struct aggr_cpu_id perf_env__get_cache_aggr_by_cpu(struct perf_cpu cpu, +@@ -1631,7 +1632,7 @@ static struct aggr_cpu_id perf_env__get_ struct perf_env *env = data; struct aggr_cpu_id id = aggr_cpu_id__empty(); @@ -68,7 +66,7 @@ index 9eb0876633c05e..ae255f6c31e32c 100644 u32 cache_level = (perf_stat.aggr_level) ?: stat_config.aggr_level; id.socket = env->cpu[cpu.cpu].socket_id; -@@ -1649,7 +1650,7 @@ static struct aggr_cpu_id perf_env__get_cluster_aggr_by_cpu(struct perf_cpu cpu, +@@ -1648,7 +1649,7 @@ static struct aggr_cpu_id perf_env__get_ struct perf_env *env = data; struct aggr_cpu_id id = aggr_cpu_id__empty(); @@ -77,7 +75,7 @@ index 9eb0876633c05e..ae255f6c31e32c 100644 id.socket = env->cpu[cpu.cpu].socket_id; id.die = env->cpu[cpu.cpu].die_id; id.cluster = env->cpu[cpu.cpu].cluster_id; -@@ -1663,7 +1664,7 @@ static struct aggr_cpu_id perf_env__get_core_aggr_by_cpu(struct perf_cpu cpu, vo +@@ -1662,7 +1663,7 @@ static struct aggr_cpu_id perf_env__get_ struct perf_env *env = data; struct aggr_cpu_id id = aggr_cpu_id__empty(); @@ -86,7 +84,7 @@ index 9eb0876633c05e..ae255f6c31e32c 100644 /* * core_id is relative to socket, die and cluster, we need a * global id. So we set socket, die id, cluster id and core id. -@@ -1682,7 +1683,7 @@ static struct aggr_cpu_id perf_env__get_cpu_aggr_by_cpu(struct perf_cpu cpu, voi +@@ -1681,7 +1682,7 @@ static struct aggr_cpu_id perf_env__get_ struct perf_env *env = data; struct aggr_cpu_id id = aggr_cpu_id__empty(); @@ -95,6 +93,3 @@ index 9eb0876633c05e..ae255f6c31e32c 100644 /* * core_id is relative to socket and die, * we need a global id. So we set --- -2.53.0 - diff --git a/queue-6.18/perf-stat-introduce-perf_env__get_cpu_topology-to-gu.patch b/queue-6.18/perf-stat-introduce-perf_env__get_cpu_topology-to-gu.patch index 00640dcde6..1a56000479 100644 --- a/queue-6.18/perf-stat-introduce-perf_env__get_cpu_topology-to-gu.patch +++ b/queue-6.18/perf-stat-introduce-perf_env__get_cpu_topology-to-gu.patch @@ -26,15 +26,13 @@ Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- - tools/perf/builtin-stat.c | 51 +++++++++++++++++++++------------------ - tools/perf/util/env.h | 14 +++++++++++ + tools/perf/builtin-stat.c | 51 +++++++++++++++++++++++++--------------------- + tools/perf/util/env.h | 14 ++++++++++++ 2 files changed, 42 insertions(+), 23 deletions(-) -diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c -index ae255f6c31e32c..64341ae6c464d3 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c -@@ -1564,10 +1564,10 @@ static struct aggr_cpu_id perf_env__get_socket_aggr_by_cpu(struct perf_cpu cpu, +@@ -1563,10 +1563,10 @@ static struct aggr_cpu_id perf_env__get_ { struct perf_env *env = data; struct aggr_cpu_id id = aggr_cpu_id__empty(); @@ -48,7 +46,7 @@ index ae255f6c31e32c..64341ae6c464d3 100644 return id; } -@@ -1576,15 +1576,16 @@ static struct aggr_cpu_id perf_env__get_die_aggr_by_cpu(struct perf_cpu cpu, voi +@@ -1575,15 +1575,16 @@ static struct aggr_cpu_id perf_env__get_ { struct perf_env *env = data; struct aggr_cpu_id id = aggr_cpu_id__empty(); @@ -68,7 +66,7 @@ index ae255f6c31e32c..64341ae6c464d3 100644 } return id; -@@ -1632,12 +1633,13 @@ static struct aggr_cpu_id perf_env__get_cache_aggr_by_cpu(struct perf_cpu cpu, +@@ -1631,12 +1632,13 @@ static struct aggr_cpu_id perf_env__get_ { struct perf_env *env = data; struct aggr_cpu_id id = aggr_cpu_id__empty(); @@ -85,7 +83,7 @@ index ae255f6c31e32c..64341ae6c464d3 100644 perf_env__get_cache_id_for_cpu(cpu, env, cache_level, &id); } -@@ -1649,11 +1651,12 @@ static struct aggr_cpu_id perf_env__get_cluster_aggr_by_cpu(struct perf_cpu cpu, +@@ -1648,11 +1650,12 @@ static struct aggr_cpu_id perf_env__get_ { struct perf_env *env = data; struct aggr_cpu_id id = aggr_cpu_id__empty(); @@ -102,7 +100,7 @@ index ae255f6c31e32c..64341ae6c464d3 100644 } return id; -@@ -1663,16 +1666,17 @@ static struct aggr_cpu_id perf_env__get_core_aggr_by_cpu(struct perf_cpu cpu, vo +@@ -1662,16 +1665,17 @@ static struct aggr_cpu_id perf_env__get_ { struct perf_env *env = data; struct aggr_cpu_id id = aggr_cpu_id__empty(); @@ -125,7 +123,7 @@ index ae255f6c31e32c..64341ae6c464d3 100644 } return id; -@@ -1682,18 +1686,19 @@ static struct aggr_cpu_id perf_env__get_cpu_aggr_by_cpu(struct perf_cpu cpu, voi +@@ -1681,18 +1685,19 @@ static struct aggr_cpu_id perf_env__get_ { struct perf_env *env = data; struct aggr_cpu_id id = aggr_cpu_id__empty(); @@ -150,11 +148,9 @@ index ae255f6c31e32c..64341ae6c464d3 100644 return id; } -diff --git a/tools/perf/util/env.h b/tools/perf/util/env.h -index 9977b85523a8c3..6ca0e223ea4050 100644 --- a/tools/perf/util/env.h +++ b/tools/perf/util/env.h -@@ -164,6 +164,20 @@ const char *perf_env__pmu_mappings(struct perf_env *env); +@@ -164,6 +164,20 @@ const char *perf_env__pmu_mappings(struc int perf_env__read_cpu_topology_map(struct perf_env *env); @@ -175,6 +171,3 @@ index 9977b85523a8c3..6ca0e223ea4050 100644 void cpu_cache_level__free(struct cpu_cache_level *cache); const char *perf_env__arch(struct perf_env *env); --- -2.53.0 - diff --git a/queue-6.18/perf-tools-add-o_cloexec-to-open-calls-in-dso-and-el.patch b/queue-6.18/perf-tools-add-o_cloexec-to-open-calls-in-dso-and-el.patch index 3b28e9ffbd..079950f8b0 100644 --- a/queue-6.18/perf-tools-add-o_cloexec-to-open-calls-in-dso-and-el.patch +++ b/queue-6.18/perf-tools-add-o_cloexec-to-open-calls-in-dso-and-el.patch @@ -25,15 +25,13 @@ Signed-off-by: Arnaldo Carvalho de Melo Stable-dep-of: f973e52a9977 ("perf dso: Fix heap overflow in dso__get_filename() on decompressed path") Signed-off-by: Sasha Levin --- - tools/perf/util/dso.c | 4 ++-- - tools/perf/util/symbol-elf.c | 20 ++++++++++---------- + tools/perf/util/dso.c | 4 ++-- + tools/perf/util/symbol-elf.c | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) -diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c -index 3077f2ab3f125a..db0513936cea88 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c -@@ -343,7 +343,7 @@ int filename__decompress(const char *name, char *pathname, +@@ -343,7 +343,7 @@ int filename__decompress(const char *nam * descriptor to the uncompressed file. */ if (!compressions[comp].is_compressed(name)) @@ -42,7 +40,7 @@ index 3077f2ab3f125a..db0513936cea88 100644 fd = mkstemp(tmpbuf); if (fd < 0) { -@@ -1843,7 +1843,7 @@ static const u8 *__dso__read_symbol(struct dso *dso, const char *symfs_filename, +@@ -1836,7 +1836,7 @@ static const u8 *__dso__read_symbol(stru int saved_errno; nsinfo__mountns_enter(dso__nsinfo(dso), &nsc); @@ -51,11 +49,9 @@ index 3077f2ab3f125a..db0513936cea88 100644 saved_errno = errno; nsinfo__mountns_exit(&nsc); if (fd < 0) { -diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c -index 26c842ddaf235b..0dbc3d56a00a1f 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c -@@ -217,7 +217,7 @@ bool filename__has_section(const char *filename, const char *sec) +@@ -217,7 +217,7 @@ bool filename__has_section(const char *f GElf_Shdr shdr; bool found = false; @@ -64,7 +60,7 @@ index 26c842ddaf235b..0dbc3d56a00a1f 100644 if (fd < 0) return false; -@@ -887,7 +887,7 @@ static int read_build_id(const char *filename, struct build_id *bid) +@@ -887,7 +887,7 @@ static int read_build_id(const char *fil if (size < BUILD_ID_SIZE) goto out; @@ -73,7 +69,7 @@ index 26c842ddaf235b..0dbc3d56a00a1f 100644 if (fd < 0) goto out; -@@ -948,7 +948,7 @@ int sysfs__read_build_id(const char *filename, struct build_id *bid) +@@ -948,7 +948,7 @@ int sysfs__read_build_id(const char *fil size_t size = sizeof(bid->data); int fd, err = -1; @@ -82,7 +78,7 @@ index 26c842ddaf235b..0dbc3d56a00a1f 100644 if (fd < 0) goto out; -@@ -1019,7 +1019,7 @@ int filename__read_debuglink(const char *filename, char *debuglink, +@@ -1019,7 +1019,7 @@ int filename__read_debuglink(const char if (err >= 0) goto out; @@ -91,7 +87,7 @@ index 26c842ddaf235b..0dbc3d56a00a1f 100644 if (fd < 0) goto out; -@@ -1184,7 +1184,7 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, +@@ -1184,7 +1184,7 @@ int symsrc__init(struct symsrc *ss, stru type = dso__symtab_type(dso); } else { @@ -100,7 +96,7 @@ index 26c842ddaf235b..0dbc3d56a00a1f 100644 if (fd < 0) { *dso__load_errno(dso) = errno; return -1; -@@ -1985,7 +1985,7 @@ static int kcore__open(struct kcore *kcore, const char *filename) +@@ -1974,7 +1974,7 @@ static int kcore__open(struct kcore *kco { GElf_Ehdr *ehdr; @@ -109,7 +105,7 @@ index 26c842ddaf235b..0dbc3d56a00a1f 100644 if (kcore->fd == -1) return -1; -@@ -2018,7 +2018,7 @@ static int kcore__init(struct kcore *kcore, char *filename, int elfclass, +@@ -2007,7 +2007,7 @@ static int kcore__init(struct kcore *kco if (temp) kcore->fd = mkstemp(filename); else @@ -118,7 +114,7 @@ index 26c842ddaf235b..0dbc3d56a00a1f 100644 if (kcore->fd == -1) return -1; -@@ -2494,11 +2494,11 @@ static int kcore_copy__compare_files(const char *from_filename, +@@ -2483,11 +2483,11 @@ static int kcore_copy__compare_files(con { int from, to, err = -1; @@ -132,7 +128,7 @@ index 26c842ddaf235b..0dbc3d56a00a1f 100644 if (to < 0) goto out_close_from; -@@ -2916,7 +2916,7 @@ int get_sdt_note_list(struct list_head *head, const char *target) +@@ -2905,7 +2905,7 @@ int get_sdt_note_list(struct list_head * Elf *elf; int fd, ret; @@ -141,6 +137,3 @@ index 26c842ddaf235b..0dbc3d56a00a1f 100644 if (fd < 0) return -EBADF; --- -2.53.0 - diff --git a/queue-6.18/perf-tools-don-t-read-build-ids-from-non-regular-fil.patch b/queue-6.18/perf-tools-don-t-read-build-ids-from-non-regular-fil.patch index 8a30ff7da4..127d8434a4 100644 --- a/queue-6.18/perf-tools-don-t-read-build-ids-from-non-regular-fil.patch +++ b/queue-6.18/perf-tools-don-t-read-build-ids-from-non-regular-fil.patch @@ -328,7 +328,7 @@ Signed-off-by: Sasha Levin } --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c -@@ -1755,14 +1755,13 @@ int dso__load(struct dso *dso, struct ma +@@ -1748,14 +1748,13 @@ int dso__load(struct dso *dso, struct ma /* * Read the build id if possible. This is required for diff --git a/queue-6.18/perf-tools-fix-uninitialized-pathname-on-uncompresse.patch b/queue-6.18/perf-tools-fix-uninitialized-pathname-on-uncompresse.patch index c783ba23e1..d7dcb9b833 100644 --- a/queue-6.18/perf-tools-fix-uninitialized-pathname-on-uncompresse.patch +++ b/queue-6.18/perf-tools-fix-uninitialized-pathname-on-uncompresse.patch @@ -30,17 +30,15 @@ Signed-off-by: Arnaldo Carvalho de Melo Stable-dep-of: f973e52a9977 ("perf dso: Fix heap overflow in dso__get_filename() on decompressed path") Signed-off-by: Sasha Levin --- - tools/perf/tests/code-reading.c | 7 +++++-- - tools/perf/util/disasm.c | 7 +++++-- - tools/perf/util/dso.c | 12 +++++++++--- - tools/perf/util/symbol-elf.c | 6 ++++-- + tools/perf/tests/code-reading.c | 7 +++++-- + tools/perf/util/disasm.c | 7 +++++-- + tools/perf/util/dso.c | 12 +++++++++--- + tools/perf/util/symbol-elf.c | 6 ++++-- 4 files changed, 23 insertions(+), 9 deletions(-) -diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c -index 4c9fbf6965c4ad..4e759b8989806a 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c -@@ -465,8 +465,11 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode, +@@ -465,8 +465,11 @@ static int read_object_code(u64 addr, si goto out; } @@ -54,11 +52,9 @@ index 4c9fbf6965c4ad..4e759b8989806a 100644 } /* Read the object code using objdump */ -diff --git a/tools/perf/util/disasm.c b/tools/perf/util/disasm.c -index c513db41137fa4..61a18639903542 100644 --- a/tools/perf/util/disasm.c +++ b/tools/perf/util/disasm.c -@@ -1684,8 +1684,11 @@ int symbol__disassemble(struct symbol *sym, struct annotate_args *args) +@@ -1684,8 +1684,11 @@ int symbol__disassemble(struct symbol *s if (dso__decompress_kmodule_path(dso, symfs_filename, tmp, sizeof(tmp)) < 0) return -1; @@ -72,11 +68,9 @@ index c513db41137fa4..61a18639903542 100644 } /* -diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c -index db0513936cea88..1205224e110375 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c -@@ -342,8 +342,11 @@ int filename__decompress(const char *name, char *pathname, +@@ -342,8 +342,11 @@ int filename__decompress(const char *nam * To keep this transparent, we detect this and return the file * descriptor to the uncompressed file. */ @@ -89,7 +83,7 @@ index db0513936cea88..1205224e110375 100644 fd = mkstemp(tmpbuf); if (fd < 0) { -@@ -600,8 +603,11 @@ static char *dso__get_filename(struct dso *dso, const char *root_dir, +@@ -597,8 +600,11 @@ static char *dso__get_filename(struct ds goto out; } @@ -103,11 +97,9 @@ index db0513936cea88..1205224e110375 100644 } return name; -diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c -index 0dbc3d56a00a1f..491f43a68540dd 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c -@@ -933,12 +933,14 @@ int filename__read_build_id(const char *filename, struct build_id *bid) +@@ -933,12 +933,14 @@ int filename__read_build_id(const char * return -1; } close(fd); @@ -124,6 +116,3 @@ index 0dbc3d56a00a1f..491f43a68540dd 100644 unlink(filename); return err; } --- -2.53.0 - diff --git a/queue-6.18/perf-tools-guard-test_bit-from-out-of-bounds-sample-.patch b/queue-6.18/perf-tools-guard-test_bit-from-out-of-bounds-sample-.patch index cd393f8106..e30283fdd2 100644 --- a/queue-6.18/perf-tools-guard-test_bit-from-out-of-bounds-sample-.patch +++ b/queue-6.18/perf-tools-guard-test_bit-from-out-of-bounds-sample-.patch @@ -25,17 +25,15 @@ Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- - tools/perf/builtin-annotate.c | 3 ++- - tools/perf/builtin-diff.c | 3 ++- - tools/perf/builtin-report.c | 3 ++- - tools/perf/builtin-sched.c | 6 ++++-- + tools/perf/builtin-annotate.c | 3 ++- + tools/perf/builtin-diff.c | 3 ++- + tools/perf/builtin-report.c | 3 ++- + tools/perf/builtin-sched.c | 6 ++++-- 4 files changed, 10 insertions(+), 5 deletions(-) -diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c -index 646f43b0f7c4c9..0485bddb024644 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c -@@ -299,7 +299,8 @@ static int process_sample_event(const struct perf_tool *tool, +@@ -299,7 +299,8 @@ static int process_sample_event(const st goto out_put; } @@ -45,11 +43,9 @@ index 646f43b0f7c4c9..0485bddb024644 100644 goto out_put; if (!al.filtered && -diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c -index 53d5ea4a6a4f7b..a41568b0b8d812 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c -@@ -418,7 +418,8 @@ static int diff__process_sample_event(const struct perf_tool *tool, +@@ -416,7 +416,8 @@ static int diff__process_sample_event(co goto out; } @@ -59,11 +55,9 @@ index 53d5ea4a6a4f7b..a41568b0b8d812 100644 ret = 0; goto out; } -diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c -index 35df04dad2fd08..fd5bd3d9768626 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c -@@ -303,7 +303,8 @@ static int process_sample_event(const struct perf_tool *tool, +@@ -303,7 +303,8 @@ static int process_sample_event(const st if (symbol_conf.hide_unresolved && al.sym == NULL) goto out_put; @@ -73,11 +67,9 @@ index 35df04dad2fd08..fd5bd3d9768626 100644 goto out_put; if (sort__mode == SORT_MODE__BRANCH) { -diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c -index ce0858f309e164..8310aa23cbb3c5 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c -@@ -2168,7 +2168,8 @@ static void timehist_print_sample(struct perf_sched *sched, +@@ -2168,7 +2168,8 @@ static void timehist_print_sample(struct char nstr[30]; u64 wait_time; @@ -87,7 +79,7 @@ index ce0858f309e164..8310aa23cbb3c5 100644 return; timestamp__scnprintf_usec(t, tstr, sizeof(tstr)); -@@ -2850,7 +2851,8 @@ static int timehist_sched_change_event(const struct perf_tool *tool, +@@ -2850,7 +2851,8 @@ static int timehist_sched_change_event(c } if (!sched->idle_hist || thread__tid(thread) == 0) { @@ -97,6 +89,3 @@ index ce0858f309e164..8310aa23cbb3c5 100644 timehist_update_runtime_stats(tr, t, tprev); if (sched->idle_hist) { --- -2.53.0 - diff --git a/queue-6.18/perf-tools-use-snprintf-for-root_dir-path-constructi.patch b/queue-6.18/perf-tools-use-snprintf-for-root_dir-path-constructi.patch index 7f8a664e17..f2f292ec70 100644 --- a/queue-6.18/perf-tools-use-snprintf-for-root_dir-path-constructi.patch +++ b/queue-6.18/perf-tools-use-snprintf-for-root_dir-path-constructi.patch @@ -23,15 +23,13 @@ Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- - tools/perf/util/machine.c | 2 +- - tools/perf/util/symbol.c | 2 +- + tools/perf/util/machine.c | 2 +- + tools/perf/util/symbol.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c -index 1de644fe91a873..50f5f2b2ae530c 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c -@@ -1319,7 +1319,7 @@ static char *get_kernel_version(const char *root_dir) +@@ -1319,7 +1319,7 @@ static char *get_kernel_version(const ch char *name, *tmp; const char *prefix = "Linux version "; @@ -40,11 +38,9 @@ index 1de644fe91a873..50f5f2b2ae530c 100644 file = fopen(version, "r"); if (!file) return NULL; -diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c -index 7535a78b7fd235..7d4c6d7cdc60d7 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c -@@ -2166,7 +2166,7 @@ static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map) +@@ -2158,7 +2158,7 @@ static int dso__load_guest_kernel_sym(st if (!kallsyms_filename) return -1; } else { @@ -53,6 +49,3 @@ index 7535a78b7fd235..7d4c6d7cdc60d7 100644 kallsyms_filename = path; } --- -2.53.0 - diff --git a/queue-6.18/perf-tools-use-snprintf-in-dso__read_running_kernel_.patch b/queue-6.18/perf-tools-use-snprintf-in-dso__read_running_kernel_.patch index 1a4accb6a6..f6ac2394dd 100644 --- a/queue-6.18/perf-tools-use-snprintf-in-dso__read_running_kernel_.patch +++ b/queue-6.18/perf-tools-use-snprintf-in-dso__read_running_kernel_.patch @@ -21,14 +21,12 @@ Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- - tools/perf/util/dso.c | 2 +- + tools/perf/util/dso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c -index dc202d49437217..3077f2ab3f125a 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c -@@ -1703,7 +1703,7 @@ void dso__read_running_kernel_build_id(struct dso *dso, struct machine *machine) +@@ -1698,7 +1698,7 @@ void dso__read_running_kernel_build_id(s if (machine__is_default_guest(machine)) return; @@ -37,6 +35,3 @@ index dc202d49437217..3077f2ab3f125a 100644 sysfs__read_build_id(path, &bid); dso__set_build_id(dso, &bid); } --- -2.53.0 - diff --git a/queue-6.18/series b/queue-6.18/series index 84412a87fd..59fa3ac432 100644 --- a/queue-6.18/series +++ b/queue-6.18/series @@ -653,8 +653,6 @@ perf-fix-off-by-one-stack-buffer-overflow-in-kallsym.patch perf-annotate-fix-crashes-on-empty-annotate-windows.patch perf-tools-guard-test_bit-from-out-of-bounds-sample-.patch perf-sched-fix-thread-reference-leak-in-latency_swit.patch -perf-sched-replace-bug_on-on-invalid-cpu-with-gracef.patch -perf-sched-fix-null-dereference-in-latency_runtime_e.patch perf-tools-add-bounds-check-to-cpu__get_node.patch perf-sched-cap-max_cpu-at-max_cpus-in-timehist-sampl.patch perf-sched-fix-register_pid-overflow-strcpy-and-bug_.patch @@ -783,7 +781,6 @@ i3c-master-prevent-reuse-of-dynamic-address-on-devic.patch apparmor-fix-label-can-not-be-immediately-before-a-d.patch accel-ivpu-fix-hws-command-queue-leak-on-registratio.patch sparc-led-avoid-trimming-a-newline-from-empty-writes.patch -perf-maps-add-maps__mutate_mapping.patch perf-symbols-fix-bswap-copy-paste-error-for-32-bit-e.patch perf-symbols-validate-p_filesz-before-use-in-filenam.patch perf-symbols-break-infinite-loop-on-zero-filled-note.patch diff --git a/queue-6.18/sparc-led-avoid-trimming-a-newline-from-empty-writes.patch b/queue-6.18/sparc-led-avoid-trimming-a-newline-from-empty-writes.patch index f8b74e053c..3c03850463 100644 --- a/queue-6.18/sparc-led-avoid-trimming-a-newline-from-empty-writes.patch +++ b/queue-6.18/sparc-led-avoid-trimming-a-newline-from-empty-writes.patch @@ -23,14 +23,12 @@ Signed-off-by: Pengpeng Hou Signed-off-by: Andreas Larsson Signed-off-by: Sasha Levin --- - arch/sparc/kernel/led.c | 2 +- + arch/sparc/kernel/led.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/arch/sparc/kernel/led.c b/arch/sparc/kernel/led.c -index f4fb82b019bb93..9b53ac1fe533df 100644 --- a/arch/sparc/kernel/led.c +++ b/arch/sparc/kernel/led.c -@@ -78,7 +78,7 @@ static ssize_t led_proc_write(struct file *file, const char __user *buffer, +@@ -78,7 +78,7 @@ static ssize_t led_proc_write(struct fil return PTR_ERR(buf); /* work around \n when echo'ing into proc */ @@ -39,6 +37,3 @@ index f4fb82b019bb93..9b53ac1fe533df 100644 buf[count - 1] = '\0'; /* before we change anything we want to stop any running timers, --- -2.53.0 -