From: Greg Kroah-Hartman Date: Wed, 22 Jul 2026 12:33:14 +0000 (+0200) Subject: 6.18-stable patches X-Git-Tag: v5.10.261~20 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=473d90d053dd14b02b82c13aa975801b20d7a17a;p=thirdparty%2Fkernel%2Fstable-queue.git 6.18-stable patches added patches: perf-bpf-event-constify-variables-storing-the-result-of-strchr-on-const-tables.patch perf-demangle-java-constify-variables-storing-the-result-of-strchr-on-const-tables.patch perf-diff-constify-strchr-return-variables.patch perf-hwmon_pmu-constify-the-variables-returning-bsearch-on-const-tables.patch perf-jitdump-constify-variables-storing-the-result-of-strchr-on-const-tables.patch perf-list-don-t-write-to-const-memory.patch perf-list-remove-unused-sep-variable.patch perf-list-signal-changing-const-memory-is-ok.patch perf-metricgroup-constify-variables-storing-the-result-of-strchr-on-const-tables.patch perf-session-don-t-write-to-memory-pointed-to-a-const-pointer.patch perf-strlist-don-t-write-to-const-memory.patch perf-strlist-remove-dont_dupstr-logic-used-only-once.patch perf-time-utils-constify-variables-storing-the-result-of-strchr-on-const-tables.patch perf-tools-switch-printf-...-s-strerror-errno-to-printf-...-m.patch perf-tools-use-const-for-variables-receiving-str-str-r-chr-returns.patch perf-tp_pmu-address-const-correctness-errors-in-recent-glibcs.patch perf-trace-deal-with-compiler-const-checks.patch perf-trace-don-t-change-const-char-strings.patch perf-trace-event-constify-variables-storing-the-result-of-strchr-on-const-tables.patch perf-units-constify-variables-storing-the-result-of-strchr-on-const-tables.patch --- diff --git a/queue-6.18/perf-bpf-event-constify-variables-storing-the-result-of-strchr-on-const-tables.patch b/queue-6.18/perf-bpf-event-constify-variables-storing-the-result-of-strchr-on-const-tables.patch new file mode 100644 index 0000000000..c94ed587b6 --- /dev/null +++ b/queue-6.18/perf-bpf-event-constify-variables-storing-the-result-of-strchr-on-const-tables.patch @@ -0,0 +1,30 @@ +From 8bf093acb3f1f07d846c86e32308f9f9954ed579 Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Tue, 27 Jan 2026 01:15:47 -0300 +Subject: perf bpf-event: Constify variables storing the result of strchr() on const tables + +From: Arnaldo Carvalho de Melo + +commit 8bf093acb3f1f07d846c86e32308f9f9954ed579 upstream. + +As newer glibcs will propagate the const attribute of the searched table +to its return. + +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/bpf-event.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/tools/perf/util/bpf-event.c ++++ b/tools/perf/util/bpf-event.c +@@ -733,7 +733,8 @@ kallsyms_process_symbol(void *data, cons + char type __maybe_unused, u64 start) + { + char disp[KSYM_NAME_LEN]; +- char *module, *name; ++ const char *module; ++ char *name; + unsigned long id; + int err = 0; + diff --git a/queue-6.18/perf-demangle-java-constify-variables-storing-the-result-of-strchr-on-const-tables.patch b/queue-6.18/perf-demangle-java-constify-variables-storing-the-result-of-strchr-on-const-tables.patch new file mode 100644 index 0000000000..80673dca28 --- /dev/null +++ b/queue-6.18/perf-demangle-java-constify-variables-storing-the-result-of-strchr-on-const-tables.patch @@ -0,0 +1,29 @@ +From 79bba3a1834e7ba6c437674582cc9f3ae6fb638c Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Tue, 27 Jan 2026 01:15:47 -0300 +Subject: perf demangle-java: Constify variables storing the result of strchr() on const tables + +From: Arnaldo Carvalho de Melo + +commit 79bba3a1834e7ba6c437674582cc9f3ae6fb638c upstream. + +As newer glibcs will propagate the const attribute of the searched table +to its return. + +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/demangle-java.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/perf/util/demangle-java.c ++++ b/tools/perf/util/demangle-java.c +@@ -158,7 +158,7 @@ char * + java_demangle_sym(const char *str, int flags) + { + char *buf, *ptr; +- char *p; ++ const char *p; + size_t len, l1 = 0; + + if (!str) diff --git a/queue-6.18/perf-diff-constify-strchr-return-variables.patch b/queue-6.18/perf-diff-constify-strchr-return-variables.patch new file mode 100644 index 0000000000..f81e64ff8e --- /dev/null +++ b/queue-6.18/perf-diff-constify-strchr-return-variables.patch @@ -0,0 +1,68 @@ +From f6f41aef53761517391b6192fe5b4bc30b2d717a Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Thu, 11 Dec 2025 19:17:54 -0300 +Subject: perf diff: Constify strchr() return variables + +From: Arnaldo Carvalho de Melo + +commit f6f41aef53761517391b6192fe5b4bc30b2d717a upstream. + +Newer glibc versions return const char for strchr() when the 's' arg is +const, change the return variable to const to match that. + +Also we don't need to turn that ',' into a '\0', as strtol() will stop +in the first invalid char. No need to touch read only memory. + +First noticed with fedora 44. + +Reviewed-by: Ian Rogers +Link: https://lore.kernel.org/r/20251211221756.96294-3-acme@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/builtin-diff.c | 12 +++++------- + 1 file changed, 5 insertions(+), 7 deletions(-) + +--- a/tools/perf/builtin-diff.c ++++ b/tools/perf/builtin-diff.c +@@ -178,10 +178,9 @@ static struct header_column { + } + }; + +-static int setup_compute_opt_wdiff(char *opt) ++static int setup_compute_opt_wdiff(const char *opt) + { +- char *w1_str = opt; +- char *w2_str; ++ const char *w1_str = opt, *w2_str; + + int ret = -EINVAL; + +@@ -192,8 +191,7 @@ static int setup_compute_opt_wdiff(char + if (!w2_str) + goto out; + +- *w2_str++ = 0x0; +- if (!*w2_str) ++ if (!*++w2_str) + goto out; + + compute_wdiff_w1 = strtol(w1_str, NULL, 10); +@@ -214,7 +212,7 @@ static int setup_compute_opt_wdiff(char + return ret; + } + +-static int setup_compute_opt(char *opt) ++static int setup_compute_opt(const char *opt) + { + if (compute == COMPUTE_WEIGHTED_DIFF) + return setup_compute_opt_wdiff(opt); +@@ -234,7 +232,7 @@ static int setup_compute(const struct op + char *cstr = (char *) str; + char buf[50]; + unsigned i; +- char *option; ++ const char *option; + + if (!str) { + *cp = COMPUTE_DELTA; diff --git a/queue-6.18/perf-hwmon_pmu-constify-the-variables-returning-bsearch-on-const-tables.patch b/queue-6.18/perf-hwmon_pmu-constify-the-variables-returning-bsearch-on-const-tables.patch new file mode 100644 index 0000000000..627e27a453 --- /dev/null +++ b/queue-6.18/perf-hwmon_pmu-constify-the-variables-returning-bsearch-on-const-tables.patch @@ -0,0 +1,28 @@ +From 0e47251e8cc438d5b59fcd86d27efade01976fe1 Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Tue, 27 Jan 2026 02:15:30 -0300 +Subject: perf hwmon_pmu: Constify the variables returning bsearch() on const tables + +From: Arnaldo Carvalho de Melo + +commit 0e47251e8cc438d5b59fcd86d27efade01976fe1 upstream. + +To address const-correctness errors on newer glibcs (-Werror=discarded-qualifiers). + +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/hwmon_pmu.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/perf/util/hwmon_pmu.c ++++ b/tools/perf/util/hwmon_pmu.c +@@ -161,7 +161,7 @@ bool parse_hwmon_filename(const char *fi + bool *alarm) + { + char fn_type[24]; +- const char **elem; ++ const char * const *elem; + const char *fn_item = NULL; + size_t fn_item_len; + diff --git a/queue-6.18/perf-jitdump-constify-variables-storing-the-result-of-strchr-on-const-tables.patch b/queue-6.18/perf-jitdump-constify-variables-storing-the-result-of-strchr-on-const-tables.patch new file mode 100644 index 0000000000..ed8a5873b2 --- /dev/null +++ b/queue-6.18/perf-jitdump-constify-variables-storing-the-result-of-strchr-on-const-tables.patch @@ -0,0 +1,29 @@ +From 68abacb0686651dd3f0bbce2fa94b438afeb2fc4 Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Tue, 27 Jan 2026 01:15:47 -0300 +Subject: perf jitdump: Constify variables storing the result of strchr() on const tables + +From: Arnaldo Carvalho de Melo + +commit 68abacb0686651dd3f0bbce2fa94b438afeb2fc4 upstream. + +As newer glibcs will propagate the const attribute of the searched table +to its return. + +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/jitdump.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/perf/util/jitdump.c ++++ b/tools/perf/util/jitdump.c +@@ -754,7 +754,7 @@ jit_inject(struct jit_buf_desc *jd, cons + static int + jit_detect(const char *mmap_name, pid_t pid, struct nsinfo *nsi, bool *in_pidns) + { +- char *p; ++ const char *p; + char *end = NULL; + pid_t pid2; + diff --git a/queue-6.18/perf-list-don-t-write-to-const-memory.patch b/queue-6.18/perf-list-don-t-write-to-const-memory.patch new file mode 100644 index 0000000000..fe1015a41b --- /dev/null +++ b/queue-6.18/perf-list-don-t-write-to-const-memory.patch @@ -0,0 +1,48 @@ +From 29132d16965e66fed0bf7b38242e7e57df294ba0 Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Tue, 20 Jan 2026 18:16:09 -0300 +Subject: perf list: Don't write to const memory + +From: Arnaldo Carvalho de Melo + +commit 29132d16965e66fed0bf7b38242e7e57df294ba0 upstream. + +Something now detected on fedora 44, where strchr() returns const if it +is passed a const pointer: + + util/print-events.c: In function 'print_sdt_events': + util/print-events.c:89:29: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] + 89 | char *bid = strchr(sdt_name->s, '@'); + | ^~~~~~ + +Fix it by using strchrnul() + strncmp() instead of temporarily scrubbing +it with '\0'. + +Reviewed-by: Ian Rogers +Suggested-by: David Laight +Link: https://lore.kernel.org/r/20260121112536.27fd5d11@pumpkin +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/print-events.c | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) + +--- a/tools/perf/util/print-events.c ++++ b/tools/perf/util/print-events.c +@@ -97,14 +97,9 @@ void print_sdt_events(const struct print + } else { + next_sdt_name = strlist__next(sdt_name); + if (next_sdt_name) { +- char *bid2 = strchr(next_sdt_name->s, '@'); ++ const char *bid2 = strchrnul(next_sdt_name->s, '@'); + +- if (bid2) +- *bid2 = '\0'; +- if (strcmp(sdt_name->s, next_sdt_name->s) == 0) +- show_detail = true; +- if (bid2) +- *bid2 = '@'; ++ show_detail = strncmp(sdt_name->s, next_sdt_name->s, bid2 - next_sdt_name->s) == 0; + } + } + last_sdt_name = sdt_name->s; diff --git a/queue-6.18/perf-list-remove-unused-sep-variable.patch b/queue-6.18/perf-list-remove-unused-sep-variable.patch new file mode 100644 index 0000000000..d2c8297852 --- /dev/null +++ b/queue-6.18/perf-list-remove-unused-sep-variable.patch @@ -0,0 +1,41 @@ +From d311783bc68b011c77a4ef81321de2c94d7deffc Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Thu, 11 Dec 2025 19:17:53 -0300 +Subject: perf list: Remove unused 'sep' variable + +From: Arnaldo Carvalho de Melo + +commit d311783bc68b011c77a4ef81321de2c94d7deffc upstream. + +It is just being set to the return of strchr() but never used, just +ditch it and with it get rid of a warning about it not being const on +fedora 44. + +Reviewed-by: Ian Rogers +Link: https://lore.kernel.org/r/20251211221756.96294-2-acme@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/builtin-list.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/tools/perf/builtin-list.c ++++ b/tools/perf/builtin-list.c +@@ -619,7 +619,7 @@ int cmd_list(int argc, const char **argv + } + + for (i = 0; i < argc; ++i) { +- char *sep, *s; ++ char *s; + + if (strcmp(argv[i], "tracepoint") == 0) { + char *old_pmu_glob = default_ps.pmu_glob; +@@ -674,7 +674,7 @@ int cmd_list(int argc, const char **argv + else if (strcmp(argv[i], "pfm") == 0) + print_libpfm_events(&print_cb, ps); + #endif +- else if ((sep = strchr(argv[i], ':')) != NULL) { ++ else if (strchr(argv[i], ':') != NULL) { + char *old_pmu_glob = default_ps.pmu_glob; + char *old_event_glob = default_ps.event_glob; + diff --git a/queue-6.18/perf-list-signal-changing-const-memory-is-ok.patch b/queue-6.18/perf-list-signal-changing-const-memory-is-ok.patch new file mode 100644 index 0000000000..4244405263 --- /dev/null +++ b/queue-6.18/perf-list-signal-changing-const-memory-is-ok.patch @@ -0,0 +1,41 @@ +From 9a0a5b5ac4372da84394dc329f763d6b7d384a86 Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Tue, 20 Jan 2026 18:26:44 -0300 +Subject: perf list: Signal changing const memory is ok + +From: Arnaldo Carvalho de Melo + +commit 9a0a5b5ac4372da84394dc329f763d6b7d384a86 upstream. + +In this case its a temp list that is created just for listing events and +will be deleted at the end, so just cast it to get rid of the compiler +warning. + +Reviewed-by: Ian Rogers +Signed-off-by: Arnaldo Carvalho de Melo +[ Also do it for print_symbol_events() - gregkh ] +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/print-events.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/tools/perf/util/print-events.c ++++ b/tools/perf/util/print-events.c +@@ -86,7 +86,7 @@ void print_sdt_events(const struct print + + strlist__for_each_entry(sdt_name, sdtlist) { + bool show_detail = false; +- char *bid = strchr(sdt_name->s, '@'); ++ char *bid = (char *)strchr(sdt_name->s, '@'); + char *evt_name = NULL; + + if (bid) +@@ -271,7 +271,7 @@ void print_symbol_events(const struct pr + } + + strlist__for_each_entry(nd, evt_name_list) { +- char *alias = strstr(nd->s, " OR "); ++ char *alias = (char *)strstr(nd->s, " OR "); + + if (alias) { + *alias = '\0'; diff --git a/queue-6.18/perf-metricgroup-constify-variables-storing-the-result-of-strchr-on-const-tables.patch b/queue-6.18/perf-metricgroup-constify-variables-storing-the-result-of-strchr-on-const-tables.patch new file mode 100644 index 0000000000..26c154d795 --- /dev/null +++ b/queue-6.18/perf-metricgroup-constify-variables-storing-the-result-of-strchr-on-const-tables.patch @@ -0,0 +1,42 @@ +From b42868624c7d00206f77d19a6fbfea73a44ff6f2 Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Tue, 27 Jan 2026 01:15:47 -0300 +Subject: perf metricgroup: Constify variables storing the result of strchr() on const tables + +From: Arnaldo Carvalho de Melo + +commit b42868624c7d00206f77d19a6fbfea73a44ff6f2 upstream. + +As newer glibcs will propagate the const attribute of the searched table +to its return. + +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/metricgroup.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +--- a/tools/perf/util/metricgroup.c ++++ b/tools/perf/util/metricgroup.c +@@ -364,7 +364,7 @@ static int setup_metric_events(const cha + static bool match_metric_or_groups(const char *metric_or_groups, const char *sought) + { + int len; +- char *m; ++ const char *m; + + if (!sought) + return false; +@@ -439,11 +439,10 @@ static const char *code_characters = ",- + + static int encode_metric_id(struct strbuf *sb, const char *x) + { +- char *c; + int ret = 0; + + for (; *x; x++) { +- c = strchr(code_characters, *x); ++ const char *c = strchr(code_characters, *x); + if (c) { + ret = strbuf_addch(sb, '!'); + if (ret) diff --git a/queue-6.18/perf-session-don-t-write-to-memory-pointed-to-a-const-pointer.patch b/queue-6.18/perf-session-don-t-write-to-memory-pointed-to-a-const-pointer.patch new file mode 100644 index 0000000000..f798cf044a --- /dev/null +++ b/queue-6.18/perf-session-don-t-write-to-memory-pointed-to-a-const-pointer.patch @@ -0,0 +1,47 @@ +From f1321cce848c558fde4c0c6bcd5e53f3cefd3af2 Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Tue, 27 Jan 2026 02:09:37 -0300 +Subject: perf session: Don't write to memory pointed to a const pointer + +From: Arnaldo Carvalho de Melo + +commit f1321cce848c558fde4c0c6bcd5e53f3cefd3af2 upstream. + +Since it is freshly allocated just attribute it to a non-const pointer +and then change it via that pointer. + +That way we avoid const-correctness warnings in recent glibc versions. + +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/session.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/tools/perf/util/session.c ++++ b/tools/perf/util/session.c +@@ -2474,7 +2474,7 @@ bool perf_session__has_switch_events(str + + int map__set_kallsyms_ref_reloc_sym(struct map *map, const char *symbol_name, u64 addr) + { +- char *bracket; ++ char *bracket, *name; + struct ref_reloc_sym *ref; + struct kmap *kmap; + +@@ -2482,13 +2482,13 @@ int map__set_kallsyms_ref_reloc_sym(stru + if (ref == NULL) + return -ENOMEM; + +- ref->name = strdup(symbol_name); ++ ref->name = name = strdup(symbol_name); + if (ref->name == NULL) { + free(ref); + return -ENOMEM; + } + +- bracket = strchr(ref->name, ']'); ++ bracket = strchr(name, ']'); + if (bracket) + *bracket = '\0'; + diff --git a/queue-6.18/perf-strlist-don-t-write-to-const-memory.patch b/queue-6.18/perf-strlist-don-t-write-to-const-memory.patch new file mode 100644 index 0000000000..807dce6e70 --- /dev/null +++ b/queue-6.18/perf-strlist-don-t-write-to-const-memory.patch @@ -0,0 +1,51 @@ +From 678ed6b707e4b2db250f255d2f959322896dae65 Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Tue, 27 Jan 2026 02:03:01 -0300 +Subject: perf strlist: Don't write to const memory + +From: Arnaldo Carvalho de Melo + +commit 678ed6b707e4b2db250f255d2f959322896dae65 upstream. + +Do a strdup to the list string and parse from it, free at the end. + +This is to deal with newer glibcs const-correctness. + +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/strlist.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +--- a/tools/perf/util/strlist.c ++++ b/tools/perf/util/strlist.c +@@ -139,21 +139,25 @@ out: + return err; + } + +-static int strlist__parse_list(struct strlist *slist, const char *s, const char *subst_dir) ++static int strlist__parse_list(struct strlist *slist, const char *list, const char *subst_dir) + { +- char *sep; ++ char *sep, *s = strdup(list), *sdup = s; + int err; + ++ if (s == NULL) ++ return -ENOMEM; ++ + while ((sep = strchr(s, ',')) != NULL) { + *sep = '\0'; + err = strlist__parse_list_entry(slist, s, subst_dir); +- *sep = ','; + if (err != 0) + return err; + s = sep + 1; + } + +- return *s ? strlist__parse_list_entry(slist, s, subst_dir) : 0; ++ err = *s ? strlist__parse_list_entry(slist, s, subst_dir) : 0; ++ free(sdup); ++ return err; + } + + struct strlist *strlist__new(const char *list, const struct strlist_config *config) diff --git a/queue-6.18/perf-strlist-remove-dont_dupstr-logic-used-only-once.patch b/queue-6.18/perf-strlist-remove-dont_dupstr-logic-used-only-once.patch new file mode 100644 index 0000000000..0fe12b56e8 --- /dev/null +++ b/queue-6.18/perf-strlist-remove-dont_dupstr-logic-used-only-once.patch @@ -0,0 +1,182 @@ +From 612e4022c616eba66ed15e6b7a9924251e0298e8 Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Tue, 27 Jan 2026 12:43:43 -0300 +Subject: perf strlist: Remove dont_dupstr logic, used only once + +From: Arnaldo Carvalho de Melo + +commit 612e4022c616eba66ed15e6b7a9924251e0298e8 upstream. + +Ian Rogers noticed that 678ed6b707e4b2db ("perf strlist: Don't write to +const memory") breaks the 'Remove thread map' 'perf test' entry, because +it keeps pointers to the temporary string introduced to avoid touching +the const memory. + +This is because the thread_map__new_by_[pt]id_str() were the only +methods using the slist->dont_dupstr knob to keep pointers to the +original const string list, as it uses strtol to parse numbers and it +stops at the comma. + +As this is the only case of dont_dupstr use, dupstr being the default, +and it gets in the way of getting rid of the last const-correctness, +remove this knob, with it: + + $ perf test 37 + 37: Remove thread map : Ok + $ + +Fixes: 678ed6b707e4b2db ("perf strlist: Don't write to const memory") +Reported-by: Ian Rogers +Tested-by: Ian Rogers +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/strlist.c | 25 ++++++++----------------- + tools/perf/util/strlist.h | 2 -- + tools/perf/util/thread_map.c | 18 ++++++------------ + 3 files changed, 14 insertions(+), 31 deletions(-) + +--- a/tools/perf/util/strlist.c ++++ b/tools/perf/util/strlist.c +@@ -12,20 +12,16 @@ + #include + + static +-struct rb_node *strlist__node_new(struct rblist *rblist, const void *entry) ++struct rb_node *strlist__node_new(struct rblist *rblist __maybe_unused, const void *entry) + { + const char *s = entry; + struct rb_node *rc = NULL; +- struct strlist *strlist = container_of(rblist, struct strlist, rblist); + struct str_node *snode = malloc(sizeof(*snode)); + + if (snode != NULL) { +- if (strlist->dupstr) { +- s = strdup(s); +- if (s == NULL) +- goto out_delete; +- } +- snode->s = s; ++ snode->s = strdup(s); ++ if (snode->s == NULL) ++ goto out_delete; + rc = &snode->rb_node; + } + +@@ -36,20 +32,18 @@ out_delete: + return NULL; + } + +-static void str_node__delete(struct str_node *snode, bool dupstr) ++static void str_node__delete(struct str_node *snode) + { +- if (dupstr) +- zfree((char **)&snode->s); ++ zfree((char **)&snode->s); + free(snode); + } + + static +-void strlist__node_delete(struct rblist *rblist, struct rb_node *rb_node) ++void strlist__node_delete(struct rblist *rblist __maybe_unused, struct rb_node *rb_node) + { +- struct strlist *slist = container_of(rblist, struct strlist, rblist); + struct str_node *snode = container_of(rb_node, struct str_node, rb_node); + +- str_node__delete(snode, slist->dupstr); ++ str_node__delete(snode); + } + + static int strlist__node_cmp(struct rb_node *rb_node, const void *entry) +@@ -165,12 +159,10 @@ struct strlist *strlist__new(const char + struct strlist *slist = malloc(sizeof(*slist)); + + if (slist != NULL) { +- bool dupstr = true; + bool file_only = false; + const char *dirname = NULL; + + if (config) { +- dupstr = !config->dont_dupstr; + dirname = config->dirname; + file_only = config->file_only; + } +@@ -180,7 +172,6 @@ struct strlist *strlist__new(const char + slist->rblist.node_new = strlist__node_new; + slist->rblist.node_delete = strlist__node_delete; + +- slist->dupstr = dupstr; + slist->file_only = file_only; + + if (list && strlist__parse_list(slist, list, dirname) != 0) +--- a/tools/perf/util/strlist.h ++++ b/tools/perf/util/strlist.h +@@ -14,7 +14,6 @@ struct str_node { + + struct strlist { + struct rblist rblist; +- bool dupstr; + bool file_only; + }; + +@@ -24,7 +23,6 @@ struct strlist { + * found + */ + struct strlist_config { +- bool dont_dupstr; + bool file_only; + const char *dirname; + }; +--- a/tools/perf/util/thread_map.c ++++ b/tools/perf/util/thread_map.c +@@ -164,19 +164,16 @@ static struct perf_thread_map *thread_ma + struct dirent **namelist = NULL; + int i, j = 0; + pid_t pid, prev_pid = INT_MAX; +- char *end_ptr; + struct str_node *pos; +- struct strlist_config slist_config = { .dont_dupstr = true, }; +- struct strlist *slist = strlist__new(pid_str, &slist_config); ++ struct strlist *slist = strlist__new(pid_str, NULL); + + if (!slist) + return NULL; + + strlist__for_each_entry(pos, slist) { +- pid = strtol(pos->s, &end_ptr, 10); ++ pid = strtol(pos->s, NULL, 10); + +- if (pid == INT_MIN || pid == INT_MAX || +- (*end_ptr != '\0' && *end_ptr != ',')) ++ if (pid == INT_MIN || pid == INT_MAX) + goto out_free_threads; + + if (pid == prev_pid) +@@ -223,24 +220,21 @@ struct perf_thread_map *thread_map__new_ + struct perf_thread_map *threads = NULL, *nt; + int ntasks = 0; + pid_t tid, prev_tid = INT_MAX; +- char *end_ptr; + struct str_node *pos; +- struct strlist_config slist_config = { .dont_dupstr = true, }; + struct strlist *slist; + + /* perf-stat expects threads to be generated even if tid not given */ + if (!tid_str) + return perf_thread_map__new_dummy(); + +- slist = strlist__new(tid_str, &slist_config); ++ slist = strlist__new(tid_str, NULL); + if (!slist) + return NULL; + + strlist__for_each_entry(pos, slist) { +- tid = strtol(pos->s, &end_ptr, 10); ++ tid = strtol(pos->s, NULL, 10); + +- if (tid == INT_MIN || tid == INT_MAX || +- (*end_ptr != '\0' && *end_ptr != ',')) ++ if (tid == INT_MIN || tid == INT_MAX) + goto out_free_threads; + + if (tid == prev_tid) diff --git a/queue-6.18/perf-time-utils-constify-variables-storing-the-result-of-strchr-on-const-tables.patch b/queue-6.18/perf-time-utils-constify-variables-storing-the-result-of-strchr-on-const-tables.patch new file mode 100644 index 0000000000..94460c2aef --- /dev/null +++ b/queue-6.18/perf-time-utils-constify-variables-storing-the-result-of-strchr-on-const-tables.patch @@ -0,0 +1,38 @@ +From 21c0bc9144834e39762dd6fddbb255ebb80cf079 Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Tue, 27 Jan 2026 01:15:47 -0300 +Subject: perf time-utils: Constify variables storing the result of strchr() on const tables + +From: Arnaldo Carvalho de Melo + +commit 21c0bc9144834e39762dd6fddbb255ebb80cf079 upstream. + +As newer glibcs will propagate the const attribute of the searched table +to its return. + +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/time-utils.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/tools/perf/util/time-utils.c ++++ b/tools/perf/util/time-utils.c +@@ -325,7 +325,7 @@ static int percent_comma_split(struct pe + } + + static int one_percent_convert(struct perf_time_interval *ptime_buf, +- const char *ostr, u64 start, u64 end, char *c) ++ const char *ostr, u64 start, u64 end, const char *c) + { + char *str; + int len = strlen(ostr), ret; +@@ -358,7 +358,7 @@ static int one_percent_convert(struct pe + int perf_time__percent_parse_str(struct perf_time_interval *ptime_buf, int num, + const char *ostr, u64 start, u64 end) + { +- char *c; ++ const char *c; + + /* + * ostr example: diff --git a/queue-6.18/perf-tools-switch-printf-...-s-strerror-errno-to-printf-...-m.patch b/queue-6.18/perf-tools-switch-printf-...-s-strerror-errno-to-printf-...-m.patch new file mode 100644 index 0000000000..30629c3604 --- /dev/null +++ b/queue-6.18/perf-tools-switch-printf-...-s-strerror-errno-to-printf-...-m.patch @@ -0,0 +1,859 @@ +From bac74dcbd48b5b441e47841fd0fe507c7b0bcbaf Mon Sep 17 00:00:00 2001 +From: Ian Rogers +Date: Wed, 19 Nov 2025 15:36:21 -0800 +Subject: perf tools: Switch printf("...%s", strerror(errno)) to printf("...%m") + +From: Ian Rogers + +commit bac74dcbd48b5b441e47841fd0fe507c7b0bcbaf upstream. + +strerror() has thread safety issues, strerror_r() requires stack +allocated buffers. + +Code in perf has already been using the "%m" formatting flag that is a +widely support glibc extension to print the current errno's description. + +Expand the usage of this formatting flag and remove usage of +strerror()/strerror_r(). + +Signed-off-by: Ian Rogers +Acked-by: Namhyung Kim +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Alexandre Ghiti +Cc: Blake Jones +Cc: Chun-Tse Shao +Cc: Dmitriy Vyukov +Cc: Dr. David Alan Gilbert +Cc: Haibo Xu +Cc: Howard Chu +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Leo Yan +Cc: Peter Zijlstra +Cc: Stephen Brennan +Cc: Thomas Falcon +Cc: Yunseong Kim +Cc: Zhongqiu Han +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/arch/x86/tests/bp-modify.c | 30 ++++++++++++------------------ + tools/perf/bench/uprobe.c | 2 +- + tools/perf/builtin-daemon.c | 8 +++----- + tools/perf/builtin-probe.c | 3 +-- + tools/perf/builtin-record.c | 24 ++++++++++-------------- + tools/perf/builtin-stat.c | 9 ++++----- + tools/perf/builtin-trace.c | 15 ++++++--------- + tools/perf/perf.c | 18 +++++++----------- + tools/perf/util/bpf-event.c | 11 ++++------- + tools/perf/util/bpf-utils.c | 4 ++-- + tools/perf/util/bpf_lock_contention.c | 2 +- + tools/perf/util/cap.c | 3 +-- + tools/perf/util/data.c | 29 ++++++++++------------------- + tools/perf/util/dso.c | 19 ++++++------------- + tools/perf/util/evlist.c | 31 +++++++++++++++++-------------- + tools/perf/util/evsel.c | 17 +++++++++-------- + tools/perf/util/jitdump.c | 3 ++- + tools/perf/util/lzma.c | 6 +++--- + tools/perf/util/session.c | 5 +++-- + tools/perf/util/symbol-elf.c | 4 ++-- + 20 files changed, 104 insertions(+), 139 deletions(-) + +--- a/tools/perf/arch/x86/tests/bp-modify.c ++++ b/tools/perf/arch/x86/tests/bp-modify.c +@@ -80,26 +80,24 @@ static int bp_modify1(void) + */ + if (ptrace(PTRACE_POKEUSER, child, + offsetof(struct user, u_debugreg[0]), bp_2)) { +- pr_debug("failed to set breakpoint, 1st time: %s\n", +- strerror(errno)); ++ pr_debug("failed to set breakpoint, 1st time: %m\n"); + goto out; + } + + if (ptrace(PTRACE_POKEUSER, child, + offsetof(struct user, u_debugreg[0]), bp_1)) { +- pr_debug("failed to set breakpoint, 2nd time: %s\n", +- strerror(errno)); ++ pr_debug("failed to set breakpoint, 2nd time: %m\n"); + goto out; + } + + if (ptrace(PTRACE_POKEUSER, child, + offsetof(struct user, u_debugreg[7]), dr7)) { +- pr_debug("failed to set dr7: %s\n", strerror(errno)); ++ pr_debug("failed to set dr7: %m\n"); + goto out; + } + + if (ptrace(PTRACE_CONT, child, NULL, NULL)) { +- pr_debug("failed to PTRACE_CONT: %s\n", strerror(errno)); ++ pr_debug("failed to PTRACE_CONT: %m\n"); + goto out; + } + +@@ -112,19 +110,17 @@ static int bp_modify1(void) + rip = ptrace(PTRACE_PEEKUSER, child, + offsetof(struct user_regs_struct, rip), NULL); + if (rip == (unsigned long) -1) { +- pr_debug("failed to PTRACE_PEEKUSER: %s\n", +- strerror(errno)); ++ pr_debug("failed to PTRACE_PEEKUSER: %m\n"); + goto out; + } + + pr_debug("rip %lx, bp_1 %p\n", rip, bp_1); +- + out: + if (ptrace(PTRACE_DETACH, child, NULL, NULL)) { +- pr_debug("failed to PTRACE_DETACH: %s", strerror(errno)); ++ pr_debug("failed to PTRACE_DETACH: %m\n"); + return TEST_FAIL; +- } + ++ } + return rip == (unsigned long) bp_1 ? TEST_OK : TEST_FAIL; + } + +@@ -157,14 +153,13 @@ static int bp_modify2(void) + */ + if (ptrace(PTRACE_POKEUSER, child, + offsetof(struct user, u_debugreg[0]), bp_1)) { +- pr_debug("failed to set breakpoint: %s\n", +- strerror(errno)); ++ pr_debug("failed to set breakpoint: %m\n"); + goto out; + } + + if (ptrace(PTRACE_POKEUSER, child, + offsetof(struct user, u_debugreg[7]), dr7)) { +- pr_debug("failed to set dr7: %s\n", strerror(errno)); ++ pr_debug("failed to set dr7: %m\n"); + goto out; + } + +@@ -175,7 +170,7 @@ static int bp_modify2(void) + } + + if (ptrace(PTRACE_CONT, child, NULL, NULL)) { +- pr_debug("failed to PTRACE_CONT: %s\n", strerror(errno)); ++ pr_debug("failed to PTRACE_CONT: %m\n"); + goto out; + } + +@@ -188,8 +183,7 @@ static int bp_modify2(void) + rip = ptrace(PTRACE_PEEKUSER, child, + offsetof(struct user_regs_struct, rip), NULL); + if (rip == (unsigned long) -1) { +- pr_debug("failed to PTRACE_PEEKUSER: %s\n", +- strerror(errno)); ++ pr_debug("failed to PTRACE_PEEKUSER: %m\n"); + goto out; + } + +@@ -197,7 +191,7 @@ static int bp_modify2(void) + + out: + if (ptrace(PTRACE_DETACH, child, NULL, NULL)) { +- pr_debug("failed to PTRACE_DETACH: %s", strerror(errno)); ++ pr_debug("failed to PTRACE_DETACH: %m\n"); + return TEST_FAIL; + } + +--- a/tools/perf/bench/uprobe.c ++++ b/tools/perf/bench/uprobe.c +@@ -54,7 +54,7 @@ static const char * const bench_uprobe_u + /*opts=*/&uprobe_opts); \ + if (!skel->links.prog) { \ + err = -errno; \ +- fprintf(stderr, "Failed to attach bench uprobe \"%s\": %s\n", #prog, strerror(errno)); \ ++ fprintf(stderr, "Failed to attach bench uprobe \"%s\": %m\n", #prog); \ + goto cleanup; \ + } + +--- a/tools/perf/builtin-daemon.c ++++ b/tools/perf/builtin-daemon.c +@@ -265,8 +265,7 @@ static int check_base(struct daemon *dae + daemon->base); + return -EACCES; + default: +- pr_err("failed: can't access base '%s': %s\n", +- daemon->base, strerror(errno)); ++ pr_err("failed: can't access base '%s': %m\n", daemon->base); + return -errno; + } + } +@@ -544,8 +543,7 @@ static int daemon_session__control(struc + + err = writen(control, msg, len); + if (err != len) { +- pr_err("failed: write to control pipe: %d (%s)\n", +- errno, control_path); ++ pr_err("failed: write to control pipe: %m (%s)\n", control_path); + goto out; + } + +@@ -586,7 +584,7 @@ static int setup_server_socket(struct da + int fd = socket(AF_UNIX, SOCK_STREAM, 0); + + if (fd < 0) { +- fprintf(stderr, "socket: %s\n", strerror(errno)); ++ fprintf(stderr, "socket: %m\n"); + return -1; + } + +--- a/tools/perf/builtin-probe.c ++++ b/tools/perf/builtin-probe.c +@@ -211,8 +211,7 @@ static int opt_set_target_ns(const struc + ns_pid = (pid_t)strtol(str, NULL, 10); + if (errno != 0) { + ret = -errno; +- pr_warning("Failed to parse %s as a pid: %s\n", str, +- strerror(errno)); ++ pr_warning("Failed to parse %s as a pid: %m\n", str); + return ret; + } + nsip = nsinfo__new(ns_pid); +--- a/tools/perf/builtin-record.c ++++ b/tools/perf/builtin-record.c +@@ -1323,7 +1323,6 @@ static int record__mmap_evlist(struct re + struct record_opts *opts = &rec->opts; + bool auxtrace_overwrite = opts->auxtrace_snapshot_mode || + opts->auxtrace_sample_mode; +- char msg[512]; + + if (opts->affinity != PERF_AFFINITY_SYS) + cpu__setup_cpunode_map(); +@@ -1342,8 +1341,7 @@ static int record__mmap_evlist(struct re + opts->mmap_pages, opts->auxtrace_mmap_pages); + return -errno; + } else { +- pr_err("failed to mmap with %d (%s)\n", errno, +- str_error_r(errno, msg, sizeof(msg))); ++ pr_err("failed to mmap: %m\n"); + if (errno) + return -errno; + else +@@ -1361,7 +1359,8 @@ static int record__mmap_evlist(struct re + if (record__threads_enabled(rec)) { + ret = perf_data__create_dir(&rec->data, evlist->core.nr_mmaps); + if (ret) { +- pr_err("Failed to create data directory: %s\n", strerror(-ret)); ++ errno = -ret; ++ pr_err("Failed to create data directory: %m\n"); + return ret; + } + for (i = 0; i < evlist->core.nr_mmaps; i++) { +@@ -1422,9 +1421,8 @@ try_again: + } + + if (evlist__apply_filters(evlist, &pos, &opts->target)) { +- pr_err("failed to set filter \"%s\" on event %s with %d (%s)\n", +- pos->filter ?: "BPF", evsel__name(pos), errno, +- str_error_r(errno, msg, sizeof(msg))); ++ pr_err("failed to set filter \"%s\" on event %s: %m\n", ++ pos->filter ?: "BPF", evsel__name(pos)); + rc = -1; + goto out; + } +@@ -1709,8 +1707,7 @@ static void *record__thread(void *arg) + + err = write(thread->pipes.ack[1], &msg, sizeof(msg)); + if (err == -1) +- pr_warning("threads[%d]: failed to notify on start: %s\n", +- thread->tid, strerror(errno)); ++ pr_warning("threads[%d]: failed to notify on start: %m\n", thread->tid); + + pr_debug("threads[%d]: started on cpu%d\n", thread->tid, sched_getcpu()); + +@@ -1753,8 +1750,7 @@ static void *record__thread(void *arg) + + err = write(thread->pipes.ack[1], &msg, sizeof(msg)); + if (err == -1) +- pr_warning("threads[%d]: failed to notify on termination: %s\n", +- thread->tid, strerror(errno)); ++ pr_warning("threads[%d]: failed to notify on termination: %m\n", thread->tid); + + return NULL; + } +@@ -2300,7 +2296,7 @@ static int record__start_threads(struct + + sigfillset(&full); + if (sigprocmask(SIG_SETMASK, &full, &mask)) { +- pr_err("Failed to block signals on threads start: %s\n", strerror(errno)); ++ pr_err("Failed to block signals on threads start: %m\n"); + return -1; + } + +@@ -2318,7 +2314,7 @@ static int record__start_threads(struct + if (pthread_create(&handle, &attrs, record__thread, &thread_data[t])) { + for (tt = 1; tt < t; tt++) + record__terminate_thread(&thread_data[t]); +- pr_err("Failed to start threads: %s\n", strerror(errno)); ++ pr_err("Failed to start threads: %m\n"); + ret = -1; + goto out_err; + } +@@ -2341,7 +2337,7 @@ out_err: + pthread_attr_destroy(&attrs); + + if (sigprocmask(SIG_SETMASK, &mask, NULL)) { +- pr_err("Failed to unblock signals on threads start: %s\n", strerror(errno)); ++ pr_err("Failed to unblock signals on threads start: %m\n"); + ret = -1; + } + +--- a/tools/perf/builtin-stat.c ++++ b/tools/perf/builtin-stat.c +@@ -868,9 +868,8 @@ static int __run_perf_stat(int argc, con + } + + if (evlist__apply_filters(evsel_list, &counter, &target)) { +- pr_err("failed to set filter \"%s\" on event %s with %d (%s)\n", +- counter->filter, evsel__name(counter), errno, +- str_error_r(errno, msg, sizeof(msg))); ++ pr_err("failed to set filter \"%s\" on event %s: %m\n", ++ counter->filter, evsel__name(counter)); + return -1; + } + +@@ -932,8 +931,8 @@ static int __run_perf_stat(int argc, con + } + + if (workload_exec_errno) { +- const char *emsg = str_error_r(workload_exec_errno, msg, sizeof(msg)); +- pr_err("Workload failed: %s\n", emsg); ++ errno = workload_exec_errno; ++ pr_err("Workload failed: %m\n"); + err = -1; + goto err_out; + } +--- a/tools/perf/builtin-trace.c ++++ b/tools/perf/builtin-trace.c +@@ -2595,12 +2595,10 @@ static struct syscall *trace__syscall_in + err = syscall__read_info(sc, trace); + + if (err && verbose > 0) { +- char sbuf[STRERR_BUFSIZE]; +- +- fprintf(trace->output, "Problems reading syscall %d: %d (%s)", id, -err, +- str_error_r(-err, sbuf, sizeof(sbuf))); ++ errno = -err; ++ fprintf(trace->output, "Problems reading syscall %d: %m", id); + if (sc && sc->name) +- fprintf(trace->output, "(%s)", sc->name); ++ fprintf(trace->output, " (%s)", sc->name); + fputs(" information\n", trace->output); + } + return err ? NULL : sc; +@@ -4652,9 +4650,8 @@ out_error: + + out_error_apply_filters: + fprintf(trace->output, +- "Failed to set filter \"%s\" on event %s with %d (%s)\n", +- evsel->filter, evsel__name(evsel), errno, +- str_error_r(errno, errbuf, sizeof(errbuf))); ++ "Failed to set filter \"%s\" on event %s: %m\n", ++ evsel->filter, evsel__name(evsel)); + goto out_delete_evlist; + } + out_error_mem: +@@ -4662,7 +4659,7 @@ out_error_mem: + goto out_delete_evlist; + + out_errno: +- fprintf(trace->output, "errno=%d,%s\n", errno, strerror(errno)); ++ fprintf(trace->output, "%m\n"); + goto out_delete_evlist; + } + +--- a/tools/perf/perf.c ++++ b/tools/perf/perf.c +@@ -169,8 +169,8 @@ static int set_debug_file(const char *pa + { + debug_fp = fopen(path, "w"); + if (!debug_fp) { +- fprintf(stderr, "Open debug file '%s' failed: %s\n", +- path, strerror(errno)); ++ fprintf(stderr, "Open debug file '%s' failed: %m\n", ++ path); + return -1; + } + +@@ -335,7 +335,6 @@ static int run_builtin(struct cmd_struct + { + int status; + struct stat st; +- char sbuf[STRERR_BUFSIZE]; + + if (use_browser == -1) + use_browser = check_browser_config(p->cmd); +@@ -363,17 +362,15 @@ static int run_builtin(struct cmd_struct + status = 1; + /* Check for ENOSPC and EIO errors.. */ + if (fflush(stdout)) { +- fprintf(stderr, "write failure on standard output: %s", +- str_error_r(errno, sbuf, sizeof(sbuf))); ++ fprintf(stderr, "write failure on standard output: %m\n"); + goto out; + } + if (ferror(stdout)) { +- fprintf(stderr, "unknown write failure on standard output"); ++ fprintf(stderr, "unknown write failure on standard output\n"); + goto out; + } + if (fclose(stdout)) { +- fprintf(stderr, "close failed on standard output: %s", +- str_error_r(errno, sbuf, sizeof(sbuf))); ++ fprintf(stderr, "close failed on standard output: %m\n"); + goto out; + } + status = 0; +@@ -459,7 +456,6 @@ int main(int argc, const char **argv) + { + int err, done_help = 0; + const char *cmd; +- char sbuf[STRERR_BUFSIZE]; + + perf_debug_setup(); + +@@ -573,8 +569,8 @@ int main(int argc, const char **argv) + } + + if (cmd) { +- fprintf(stderr, "Failed to run command '%s': %s\n", +- cmd, str_error_r(errno, sbuf, sizeof(sbuf))); ++ fprintf(stderr, "Failed to run command '%s': %m\n", ++ cmd); + } + out: + if (debug_fp) +--- a/tools/perf/util/bpf-event.c ++++ b/tools/perf/util/bpf-event.c +@@ -787,11 +787,10 @@ int perf_event__synthesize_bpf_events(st + err = 0; + break; + } +- pr_debug("%s: can't get next program: %s%s\n", +- __func__, strerror(errno), +- errno == EINVAL ? " -- kernel too old?" : ""); + /* don't report error on old kernel or EPERM */ + err = (errno == EINVAL || errno == EPERM) ? 0 : -1; ++ pr_debug("%s: can\'t get next program: %m%s\n", ++ __func__, errno == EINVAL ? " -- kernel too old?" : ""); + break; + } + fd = bpf_prog_get_fd_by_id(id); +@@ -824,10 +823,8 @@ int perf_event__synthesize_bpf_events(st + .tool = session->tool, + }; + +- if (kallsyms__parse(kallsyms_filename, &arg, kallsyms_process_symbol)) { +- pr_err("%s: failed to synthesize bpf images: %s\n", +- __func__, strerror(errno)); +- } ++ if (kallsyms__parse(kallsyms_filename, &arg, kallsyms_process_symbol)) ++ pr_err("%s: failed to synthesize bpf images: %m\n", __func__); + + free(event); + return err; +--- a/tools/perf/util/bpf-utils.c ++++ b/tools/perf/util/bpf-utils.c +@@ -123,7 +123,7 @@ get_bpf_prog_info_linear(int fd, __u64 a + /* step 1: get array dimensions */ + err = bpf_obj_get_info_by_fd(fd, &info, &info_len); + if (err) { +- pr_debug("can't get prog info: %s", strerror(errno)); ++ pr_debug("can't get prog info: %m\n"); + return ERR_PTR(-EFAULT); + } + if (info.type >= __MAX_BPF_PROG_TYPE) +@@ -186,7 +186,7 @@ get_bpf_prog_info_linear(int fd, __u64 a + /* step 5: call syscall again to get required arrays */ + err = bpf_obj_get_info_by_fd(fd, &info_linear->info, &info_len); + if (err) { +- pr_debug("can't get prog info: %s", strerror(errno)); ++ pr_debug("can't get prog info: %m\n"); + free(info_linear); + return ERR_PTR(-EFAULT); + } +--- a/tools/perf/util/bpf_lock_contention.c ++++ b/tools/perf/util/bpf_lock_contention.c +@@ -42,7 +42,7 @@ static void check_slab_cache_iter(struct + + con->btf = btf__load_vmlinux_btf(); + if (con->btf == NULL) { +- pr_debug("BTF loading failed: %s\n", strerror(errno)); ++ pr_debug("BTF loading failed: %m\n"); + return; + } + +--- a/tools/perf/util/cap.c ++++ b/tools/perf/util/cap.c +@@ -28,8 +28,7 @@ bool perf_cap__capable(int cap, bool *us + header.version == _LINUX_CAPABILITY_VERSION_1) + continue; + +- pr_debug2("capget syscall failed (%s - %d) fall back on root check\n", +- strerror(errno), errno); ++ pr_debug2("capget syscall failed (%m) fall back on root check\n"); + *used_root = true; + return geteuid() == 0; + } +--- a/tools/perf/util/data.c ++++ b/tools/perf/util/data.c +@@ -213,17 +213,15 @@ static int check_backup(struct perf_data + + ret = rm_rf_perf_data(oldname); + if (ret) { +- pr_err("Can't remove old data: %s (%s)\n", +- ret == -2 ? +- "Unknown file found" : strerror(errno), +- oldname); ++ if (ret == -2) ++ pr_err("Can't remove old data: Unknown file found (%s)\n", oldname); ++ else ++ pr_err("Can't remove old data: %m (%s)\n", oldname); + return -1; + } + + if (rename(data->path, oldname)) { +- pr_err("Can't move data: %s (%s to %s)\n", +- strerror(errno), +- data->path, oldname); ++ pr_err("Can't move data: %m (%s to %s)\n", data->path, oldname); + return -1; + } + } +@@ -246,14 +244,12 @@ static int open_file_read(struct perf_da + int flags = data->in_place_update ? O_RDWR : O_RDONLY; + struct stat st; + int fd; +- char sbuf[STRERR_BUFSIZE]; + + fd = open(data->file.path, flags); + if (fd < 0) { + int err = errno; + +- pr_err("failed to open %s: %s", data->file.path, +- str_error_r(err, sbuf, sizeof(sbuf))); ++ pr_err("failed to open %s: %m", data->file.path); + if (err == ENOENT && !strcmp(data->file.path, "perf.data")) + pr_err(" (try 'perf record' first)"); + pr_err("\n"); +@@ -285,15 +281,10 @@ static int open_file_read(struct perf_da + + static int open_file_write(struct perf_data *data) + { +- int fd; +- char sbuf[STRERR_BUFSIZE]; +- +- fd = open(data->file.path, O_CREAT|O_RDWR|O_TRUNC|O_CLOEXEC, +- S_IRUSR|S_IWUSR); ++ int fd = open(data->file.path, O_CREAT|O_RDWR|O_TRUNC|O_CLOEXEC, S_IRUSR|S_IWUSR); + + if (fd < 0) +- pr_err("failed to open %s : %s\n", data->file.path, +- str_error_r(errno, sbuf, sizeof(sbuf))); ++ pr_err("failed to open %s : %m\n", data->file.path); + + return fd; + } +@@ -436,8 +427,8 @@ int perf_data__switch(struct perf_data * + + if (lseek(data->file.fd, pos, SEEK_SET) == (off_t)-1) { + ret = -errno; +- pr_debug("Failed to lseek to %zu: %s", +- pos, strerror(errno)); ++ pr_debug("Failed to lseek to %zu: %m\n", ++ pos); + goto out; + } + } +--- a/tools/perf/util/dso.c ++++ b/tools/perf/util/dso.c +@@ -539,16 +539,13 @@ static void close_first_dso(void); + + static int do_open(char *name) EXCLUSIVE_LOCKS_REQUIRED(_dso__data_open_lock) + { +- int fd; +- char sbuf[STRERR_BUFSIZE]; +- + do { +- fd = open(name, O_RDONLY|O_CLOEXEC); ++ int fd = open(name, O_RDONLY|O_CLOEXEC); ++ + if (fd >= 0) + return fd; + +- pr_debug("dso open failed: %s\n", +- str_error_r(errno, sbuf, sizeof(sbuf))); ++ pr_debug("dso open failed: %m\n"); + if (!dso__data_open_cnt || errno != EMFILE) + break; + +@@ -1110,7 +1107,6 @@ static int file_size(struct dso *dso, st + { + int ret = 0; + struct stat st; +- char sbuf[STRERR_BUFSIZE]; + + mutex_lock(dso__data_open_lock()); + +@@ -1128,8 +1124,7 @@ static int file_size(struct dso *dso, st + + if (fstat(dso__data(dso)->fd, &st) < 0) { + ret = -errno; +- pr_err("dso cache fstat failed: %s\n", +- str_error_r(errno, sbuf, sizeof(sbuf))); ++ pr_err("dso cache fstat failed: %m\n"); + dso__data(dso)->status = DSO_DATA_STATUS_ERROR; + goto out; + } +@@ -1784,10 +1779,8 @@ int dso__strerror_load(struct dso *dso, + BUG_ON(buflen == 0); + + if (errnum >= 0) { +- const char *err = str_error_r(errnum, buf, buflen); +- +- if (err != buf) +- scnprintf(buf, buflen, "%s", err); ++ errno = errnum; ++ scnprintf(buf, buflen, "%m"); + + return 0; + } +--- a/tools/perf/util/evlist.c ++++ b/tools/perf/util/evlist.c +@@ -1605,14 +1605,14 @@ int evlist__parse_sample_timestamp(struc + int evlist__strerror_open(struct evlist *evlist, int err, char *buf, size_t size) + { + int printed, value; +- char sbuf[STRERR_BUFSIZE], *emsg = str_error_r(err, sbuf, sizeof(sbuf)); + + switch (err) { + case EACCES: + case EPERM: ++ errno = err; + printed = scnprintf(buf, size, +- "Error:\t%s.\n" +- "Hint:\tCheck /proc/sys/kernel/perf_event_paranoid setting.", emsg); ++ "Error:\t%m.\n" ++ "Hint:\tCheck /proc/sys/kernel/perf_event_paranoid setting."); + + value = perf_event_paranoid(); + +@@ -1639,16 +1639,18 @@ int evlist__strerror_open(struct evlist + if (first->core.attr.sample_freq < (u64)max_freq) + goto out_default; + ++ errno = err; + printed = scnprintf(buf, size, +- "Error:\t%s.\n" ++ "Error:\t%m.\n" + "Hint:\tCheck /proc/sys/kernel/perf_event_max_sample_rate.\n" + "Hint:\tThe current value is %d and %" PRIu64 " is being requested.", +- emsg, max_freq, first->core.attr.sample_freq); ++ max_freq, first->core.attr.sample_freq); + break; + } + default: + out_default: +- scnprintf(buf, size, "%s", emsg); ++ errno = err; ++ scnprintf(buf, size, "%m"); + break; + } + +@@ -1657,17 +1659,17 @@ out_default: + + int evlist__strerror_mmap(struct evlist *evlist, int err, char *buf, size_t size) + { +- char sbuf[STRERR_BUFSIZE], *emsg = str_error_r(err, sbuf, sizeof(sbuf)); + int pages_attempted = evlist->core.mmap_len / 1024, pages_max_per_user, printed = 0; + + switch (err) { + case EPERM: + sysctl__read_int("kernel/perf_event_mlock_kb", &pages_max_per_user); ++ errno = err; + printed += scnprintf(buf + printed, size - printed, +- "Error:\t%s.\n" ++ "Error:\t%m.\n" + "Hint:\tCheck /proc/sys/kernel/perf_event_mlock_kb (%d kB) setting.\n" + "Hint:\tTried using %zd kB.\n", +- emsg, pages_max_per_user, pages_attempted); ++ pages_max_per_user, pages_attempted); + + if (pages_attempted >= pages_max_per_user) { + printed += scnprintf(buf + printed, size - printed, +@@ -1679,7 +1681,8 @@ int evlist__strerror_mmap(struct evlist + "Hint:\tTry using a smaller -m/--mmap-pages value."); + break; + default: +- scnprintf(buf, size, "%s", emsg); ++ errno = err; ++ scnprintf(buf, size, "%m"); + break; + } + +@@ -1911,8 +1914,8 @@ static int evlist__parse_control_fifo(co + */ + fd = open(s, O_RDWR | O_NONBLOCK | O_CLOEXEC); + if (fd < 0) { +- pr_err("Failed to open '%s'\n", s); + ret = -errno; ++ pr_err("Failed to open '%s': %m\n", s); + goto out_free; + } + *ctl_fd = fd; +@@ -1922,7 +1925,7 @@ static int evlist__parse_control_fifo(co + /* O_RDWR | O_NONBLOCK means the other end need not be open */ + fd = open(p, O_RDWR | O_NONBLOCK | O_CLOEXEC); + if (fd < 0) { +- pr_err("Failed to open '%s'\n", p); ++ pr_err("Failed to open '%s': %m\n", p); + ret = -errno; + goto out_free; + } +@@ -2354,7 +2357,7 @@ int evlist__parse_event_enable_time(stru + eet->timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC); + if (eet->timerfd == -1) { + err = -errno; +- pr_err("timerfd_create failed: %s\n", strerror(errno)); ++ pr_err("timerfd_create failed: %m\n"); + goto free_eet_times; + } + +@@ -2389,7 +2392,7 @@ static int event_enable_timer__set_timer + + if (timerfd_settime(eet->timerfd, 0, &its, NULL) < 0) { + err = -errno; +- pr_err("timerfd_settime failed: %s\n", strerror(errno)); ++ pr_err("timerfd_settime failed: %m\n"); + } + return err; + } +--- a/tools/perf/util/evsel.c ++++ b/tools/perf/util/evsel.c +@@ -648,8 +648,9 @@ struct tep_event *evsel__tp_format(struc + if (IS_ERR(tp_format)) { + int err = -PTR_ERR(evsel->tp_format); + +- pr_err("Error getting tracepoint format '%s' '%s'(%d)\n", +- evsel__name(evsel), strerror(err), err); ++ errno = err; ++ pr_err("Error getting tracepoint format '%s': %m\n", ++ evsel__name(evsel)); + return NULL; + } + evsel->tp_format = tp_format; +@@ -2750,8 +2751,8 @@ retry_open: + PERF_EVENT_IOC_SET_BPF, + bpf_fd); + if (err && errno != EEXIST) { +- pr_err("failed to attach bpf fd %d: %s\n", +- bpf_fd, strerror(errno)); ++ pr_err("failed to attach bpf fd %d: %m\n", ++ bpf_fd); + err = -EINVAL; + goto out_close; + } +@@ -3815,7 +3816,6 @@ int evsel__open_strerror(struct evsel *e + int err, char *msg, size_t size) + { + struct perf_pmu *pmu; +- char sbuf[STRERR_BUFSIZE]; + int printed = 0, enforced = 0; + int ret; + +@@ -3948,10 +3948,11 @@ int evsel__open_strerror(struct evsel *e + if (ret) + return ret; + ++ errno = err; + return scnprintf(msg, size, +- "The sys_perf_event_open() syscall returned with %d (%s) for event (%s).\n" +- "\"dmesg | grep -i perf\" may provide additional information.\n", +- err, str_error_r(err, sbuf, sizeof(sbuf)), evsel__name(evsel)); ++ "The sys_perf_event_open() syscall failed for event (%s): %m\n" ++ "\"dmesg | grep -i perf\" may provide additional information.\n", ++ evsel__name(evsel)); + } + + struct perf_session *evsel__session(struct evsel *evsel) +--- a/tools/perf/util/jitdump.c ++++ b/tools/perf/util/jitdump.c +@@ -90,7 +90,8 @@ jit_emit_elf(struct jit_buf_desc *jd, + saved_errno = errno; + nsinfo__mountns_exit(&nsc); + if (fd == -1) { +- pr_warning("cannot create jit ELF %s: %s\n", filename, strerror(saved_errno)); ++ errno = saved_errno; ++ pr_warning("cannot create jit ELF %s: %m\n", filename); + return -1; + } + +--- a/tools/perf/util/lzma.c ++++ b/tools/perf/util/lzma.c +@@ -59,7 +59,7 @@ int lzma_decompress_stream_to_file(FILE + strm.avail_in = fread(buf_in, 1, sizeof(buf_in), infile); + + if (ferror(infile)) { +- pr_debug("lzma: read error: %s\n", strerror(errno)); ++ pr_debug("lzma: read error: %m\n"); + goto err_lzma_end; + } + +@@ -73,7 +73,7 @@ int lzma_decompress_stream_to_file(FILE + ssize_t write_size = sizeof(buf_out) - strm.avail_out; + + if (writen(output_fd, buf_out, write_size) != write_size) { +- pr_debug("lzma: write error: %s\n", strerror(errno)); ++ pr_debug("lzma: write error: %m\n"); + goto err_lzma_end; + } + +@@ -103,7 +103,7 @@ int lzma_decompress_to_file(const char * + + infile = fopen(input, "rb"); + if (!infile) { +- pr_debug("lzma: fopen failed on %s: '%s'\n", input, strerror(errno)); ++ pr_debug("lzma: fopen failed on %s: '%m'\n", input); + return -1; + } + +--- a/tools/perf/util/session.c ++++ b/tools/perf/util/session.c +@@ -2186,9 +2186,10 @@ reader__read_event(struct reader *rd, st + + if (size < sizeof(struct perf_event_header) || + (skip = rd->process(session, event, rd->file_pos, rd->path)) < 0) { +- pr_err("%#" PRIx64 " [%#x]: failed to process type: %d [%s]\n", ++ errno = -skip; ++ pr_err("%#" PRIx64 " [%#x]: failed to process type: %d [%m]\n", + rd->file_offset + rd->head, event->header.size, +- event->header.type, strerror(-skip)); ++ event->header.type); + err = skip; + goto out; + } +--- a/tools/perf/util/symbol-elf.c ++++ b/tools/perf/util/symbol-elf.c +@@ -1102,14 +1102,14 @@ static Elf *read_gnu_debugdata(struct ds + + wrapped = fmemopen(scn_data->d_buf, scn_data->d_size, "r"); + if (!wrapped) { +- pr_debug("%s: fmemopen: %s\n", __func__, strerror(errno)); ++ pr_debug("%s: fmemopen: %m\n", __func__); + *dso__load_errno(dso) = -errno; + return NULL; + } + + temp_fd = mkstemp(temp_filename); + if (temp_fd < 0) { +- pr_debug("%s: mkstemp: %s\n", __func__, strerror(errno)); ++ pr_debug("%s: mkstemp: %m\n", __func__); + *dso__load_errno(dso) = -errno; + fclose(wrapped); + return NULL; diff --git a/queue-6.18/perf-tools-use-const-for-variables-receiving-str-str-r-chr-returns.patch b/queue-6.18/perf-tools-use-const-for-variables-receiving-str-str-r-chr-returns.patch new file mode 100644 index 0000000000..ea6a4b4eb5 --- /dev/null +++ b/queue-6.18/perf-tools-use-const-for-variables-receiving-str-str-r-chr-returns.patch @@ -0,0 +1,50 @@ +From 45718bce7daf39c618188b70a52644bb5a2f968a Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Thu, 11 Dec 2025 19:17:55 -0300 +Subject: perf tools: Use const for variables receiving str{str,r?chr}() returns + +From: Arnaldo Carvalho de Melo + +commit 45718bce7daf39c618188b70a52644bb5a2f968a upstream. + +Newer glibc versions return const char for str{str,chr}() where the +haystack/s is const so to avoid warnings like these on fedora 44 change +some variables to const: + + 36 8.17 fedora:44 : FAIL gcc version 15.2.1 20251111 (Red Hat 15.2.1-4) (GCC) + libbpf.c: In function 'kallsyms_cb': + libbpf.c:8489:13: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] + 8489 | res = strstr(sym_name, ".llvm."); + +Reviewed-by: Ian Rogers +Link: https://lore.kernel.org/r/20251211221756.96294-4-acme@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/jvmti/libjvmti.c | 2 +- + tools/perf/util/evlist.c | 3 ++- + 2 files changed, 3 insertions(+), 2 deletions(-) + +--- a/tools/perf/jvmti/libjvmti.c ++++ b/tools/perf/jvmti/libjvmti.c +@@ -142,7 +142,7 @@ copy_class_filename(const char * class_s + */ + if (*class_sign == 'L') { + size_t j, i = 0; +- char *p = strrchr(class_sign, '/'); ++ const char *p = strrchr(class_sign, '/'); + if (p) { + /* drop the 'L' prefix and copy up to the final '/' */ + for (i = 0; i < (size_t)(p - class_sign); i++) +--- a/tools/perf/util/evlist.c ++++ b/tools/perf/util/evlist.c +@@ -1939,7 +1939,8 @@ out_free: + + int evlist__parse_control(const char *str, int *ctl_fd, int *ctl_fd_ack, bool *ctl_fd_close) + { +- char *comma = NULL, *endptr = NULL; ++ const char *comma = NULL; ++ char *endptr = NULL; + + *ctl_fd_close = false; + diff --git a/queue-6.18/perf-tp_pmu-address-const-correctness-errors-in-recent-glibcs.patch b/queue-6.18/perf-tp_pmu-address-const-correctness-errors-in-recent-glibcs.patch new file mode 100644 index 0000000000..d27ecf029f --- /dev/null +++ b/queue-6.18/perf-tp_pmu-address-const-correctness-errors-in-recent-glibcs.patch @@ -0,0 +1,31 @@ +From 0341eab66ba03a1f439db91f03bccd5b0a360842 Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Tue, 27 Jan 2026 02:22:00 -0300 +Subject: perf tp_pmu: Address const-correctness errors in recent glibcs + +From: Arnaldo Carvalho de Melo + +commit 0341eab66ba03a1f439db91f03bccd5b0a360842 upstream. + +To avoid having more variables, just cast the const variable searched to +non-const since the result will not be modified, its only later that +that variable will be used to modify something, but then its non-const +memory being modified, so using a cast is the cheapest thing here. + +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/tp_pmu.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/perf/util/tp_pmu.c ++++ b/tools/perf/util/tp_pmu.c +@@ -192,7 +192,7 @@ bool tp_pmu__have_event(struct perf_pmu + char *dup_name, *colon; + int id; + +- colon = strchr(name, ':'); ++ colon = strchr((char *)name, ':'); + if (colon == NULL) + return false; + diff --git a/queue-6.18/perf-trace-deal-with-compiler-const-checks.patch b/queue-6.18/perf-trace-deal-with-compiler-const-checks.patch new file mode 100644 index 0000000000..810fd11832 --- /dev/null +++ b/queue-6.18/perf-trace-deal-with-compiler-const-checks.patch @@ -0,0 +1,34 @@ +From 2c850606a46b319d5128bda59f67b1fc642d94ef Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Tue, 20 Jan 2026 17:57:43 -0300 +Subject: perf trace: Deal with compiler const checks + +From: Arnaldo Carvalho de Melo + +commit 2c850606a46b319d5128bda59f67b1fc642d94ef upstream. + +The strchr() function these days return const/non-const based on the arg +it receives, and sometimes we need to use casts when we're dealing with +variables that are used in code that needs to safely change the returned +value and sometimes not (as it points to really const areas). + +Tweak one such case. + +Reviewed-by: Ian Rogers +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/builtin-trace.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/perf/builtin-trace.c ++++ b/tools/perf/builtin-trace.c +@@ -5169,7 +5169,7 @@ static int trace__parse_events_option(co + } + + while (1) { +- if ((sep = strchr(s, ',')) != NULL) ++ if ((sep = strchr((char *)s, ',')) != NULL) + *sep = '\0'; + + list = 0; diff --git a/queue-6.18/perf-trace-don-t-change-const-char-strings.patch b/queue-6.18/perf-trace-don-t-change-const-char-strings.patch new file mode 100644 index 0000000000..68e0a0fc3f --- /dev/null +++ b/queue-6.18/perf-trace-don-t-change-const-char-strings.patch @@ -0,0 +1,54 @@ +From c85eff00cf296c146a2b189166eaf85188cd1487 Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Thu, 11 Dec 2025 19:17:56 -0300 +Subject: perf trace: Don't change const char strings + +From: Arnaldo Carvalho de Melo + +commit c85eff00cf296c146a2b189166eaf85188cd1487 upstream. + +We got away with this so far but now with fedora 44 complaining about +the return value of strchr et all, lets use strdup for good measure. + +Reviewed-by: Ian Rogers +Link: https://lore.kernel.org/r/20251211221756.96294-5-acme@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/builtin-trace.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +--- a/tools/perf/builtin-trace.c ++++ b/tools/perf/builtin-trace.c +@@ -5149,8 +5149,8 @@ static int trace__parse_events_option(co + int unset __maybe_unused) + { + struct trace *trace = (struct trace *)opt->value; +- const char *s = str; +- char *sep = NULL, *lists[2] = { NULL, NULL, }; ++ const char *s; ++ char *strd, *sep = NULL, *lists[2] = { NULL, NULL, }; + int len = strlen(str) + 1, err = -1, list, idx; + char *strace_groups_dir = system_path(STRACE_GROUPS_DIR); + char group_name[PATH_MAX]; +@@ -5159,6 +5159,10 @@ static int trace__parse_events_option(co + if (strace_groups_dir == NULL) + return -1; + ++ s = strd = strdup(str); ++ if (strd == NULL) ++ return -1; ++ + if (*s == '!') { + ++s; + trace->not_ev_qualifier = true; +@@ -5233,8 +5237,7 @@ out: + free(strace_groups_dir); + free(lists[0]); + free(lists[1]); +- if (sep) +- *sep = ','; ++ free(strd); + + return err; + } diff --git a/queue-6.18/perf-trace-event-constify-variables-storing-the-result-of-strchr-on-const-tables.patch b/queue-6.18/perf-trace-event-constify-variables-storing-the-result-of-strchr-on-const-tables.patch new file mode 100644 index 0000000000..b858471b26 --- /dev/null +++ b/queue-6.18/perf-trace-event-constify-variables-storing-the-result-of-strchr-on-const-tables.patch @@ -0,0 +1,29 @@ +From 97b81df7225830c4db3c17ed1235d2f3eb613d3d Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Tue, 27 Jan 2026 01:15:47 -0300 +Subject: perf trace-event: Constify variables storing the result of strchr() on const tables + +From: Arnaldo Carvalho de Melo + +commit 97b81df7225830c4db3c17ed1235d2f3eb613d3d upstream. + +As newer glibcs will propagate the const attribute of the searched table +to its return. + +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/trace-event-info.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/perf/util/trace-event-info.c ++++ b/tools/perf/util/trace-event-info.c +@@ -482,7 +482,7 @@ char *tracepoint_id_to_name(u64 config) + static struct tracepoint_path *tracepoint_name_to_path(const char *name) + { + struct tracepoint_path *path = zalloc(sizeof(*path)); +- char *str = strchr(name, ':'); ++ const char *str = strchr(name, ':'); + + if (path == NULL || str == NULL) { + free(path); diff --git a/queue-6.18/perf-units-constify-variables-storing-the-result-of-strchr-on-const-tables.patch b/queue-6.18/perf-units-constify-variables-storing-the-result-of-strchr-on-const-tables.patch new file mode 100644 index 0000000000..bc17d76586 --- /dev/null +++ b/queue-6.18/perf-units-constify-variables-storing-the-result-of-strchr-on-const-tables.patch @@ -0,0 +1,29 @@ +From 0e14cb3b24f8f301cf6490a4493afc98321ed5bb Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Tue, 27 Jan 2026 01:15:47 -0300 +Subject: perf units: Constify variables storing the result of strchr() on const tables + +From: Arnaldo Carvalho de Melo + +commit 0e14cb3b24f8f301cf6490a4493afc98321ed5bb upstream. + +As newer glibcs will propagate the const attribute of the searched table +to its return. + +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/units.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/perf/util/units.c ++++ b/tools/perf/util/units.c +@@ -12,7 +12,7 @@ unsigned long parse_tag_value(const char + struct parse_tag *i = tags; + + while (i->tag) { +- char *s = strchr(str, i->tag); ++ const char *s = strchr(str, i->tag); + + if (s) { + unsigned long int value; diff --git a/queue-6.18/series b/queue-6.18/series index f83022cbb9..84412a87fd 100644 --- a/queue-6.18/series +++ b/queue-6.18/series @@ -1,3 +1,23 @@ +perf-strlist-don-t-write-to-const-memory.patch +perf-strlist-remove-dont_dupstr-logic-used-only-once.patch +perf-time-utils-constify-variables-storing-the-result-of-strchr-on-const-tables.patch +perf-jitdump-constify-variables-storing-the-result-of-strchr-on-const-tables.patch +perf-list-remove-unused-sep-variable.patch +perf-tools-switch-printf-...-s-strerror-errno-to-printf-...-m.patch +perf-bpf-event-constify-variables-storing-the-result-of-strchr-on-const-tables.patch +perf-session-don-t-write-to-memory-pointed-to-a-const-pointer.patch +perf-demangle-java-constify-variables-storing-the-result-of-strchr-on-const-tables.patch +perf-trace-event-constify-variables-storing-the-result-of-strchr-on-const-tables.patch +perf-metricgroup-constify-variables-storing-the-result-of-strchr-on-const-tables.patch +perf-tools-use-const-for-variables-receiving-str-str-r-chr-returns.patch +perf-hwmon_pmu-constify-the-variables-returning-bsearch-on-const-tables.patch +perf-units-constify-variables-storing-the-result-of-strchr-on-const-tables.patch +perf-tp_pmu-address-const-correctness-errors-in-recent-glibcs.patch +perf-list-signal-changing-const-memory-is-ok.patch +perf-list-don-t-write-to-const-memory.patch +perf-diff-constify-strchr-return-variables.patch +perf-trace-don-t-change-const-char-strings.patch +perf-trace-deal-with-compiler-const-checks.patch nvme-pci-dma-unmap-the-correct-regions-in-nvme_free_.patch smb-server-do-not-require-delete-access-for-non-repl.patch tcp-add-preempt_-disable-enable-_nested-in-reqsk_que.patch