From d3dd531213296b59fb59629a430bde300c1d094f Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Thu, 21 May 2026 08:47:51 -0400 Subject: [PATCH] drop 7 patches based on RC review feedback Dropped patches: - "rtla: Use str_has_prefix() for prefix checks" Queues: 7.0 Reason: build break -- str_has_prefix() helper (upstream 0f4bc9d67a64) not backported to 7.0; reported by RTLA co-maintainer Tomas Glozar. Report: https://lore.kernel.org/stable/CAP4=nvTUdVQN8j_qJnfytGOJMa4LaX2h3Z9-cmDopBhKE87_nA@mail.gmail.com/ - "rtla/trace: Fix write loop in trace_event_save_hist()" [dependency] Queues: 7.0 Reason: queued atop the dropped str_has_prefix conversion; Tomas offered to send a rebased version. - "rtla: Simplify code by caching string lengths" [dependency] Queues: 7.0 Reason: sibling Stable-dep-of 4bf4ef5292b9; dropped together with the other two rtla patches per Sasha's expanded DROP_WITH_DEPS. - "libbpf: Stringify errno in log messages in libbpf.c" Queues: 6.12 Reason: build break -- errstr() helper not declared in 6.12 (would require c68b6fdc3600 plus a chain of refactors that don't apply cleanly). Reported by Salvatore Bonaccorso and Florian Fainelli. Reports: https://lore.kernel.org/stable/ag4vSWzIUCsRlpKv@eldamar.lan/ https://lore.kernel.org/stable/54f12da1-32e2-48dc-bf84-3bdaf8ef0f6a@gmail.com/ - "libbpf: Prevent double close and leak of btf objects" [dependency] Queues: 6.12 Reason: adds additional errstr() call sites; cannot stay without the stringify patch. - "libbpf: Change log level of btf loading error message" [dependency] Queues: 6.12 Reason: only queued as Stable-dep-of 380044c40b16; loses purpose once that target is dropped. - "erofs: verify metadata accesses for file-backed mounts" Queues: 7.0, 6.18, 6.12 Reason: EROFS maintainer / patch author Gao Xiang requested drop across all three trees -- introduces an Android SELinux/permission regression and the upstream follow-up fix is still under discussion. Reports: https://lore.kernel.org/stable/75e6d1c8-e989-4eb7-aca3-37a40318e888@linux.alibaba.com/ https://lore.kernel.org/stable/5a4afec4-fe39-419e-8b2b-4e9901eb93be@linux.alibaba.com/ https://lore.kernel.org/stable/ag3qlMOcTYM2FBUQ@debian/ https://lore.kernel.org/stable/ag3txj1lJNTGZQjp@debian/ https://lore.kernel.org/stable/ag37lbajmtyv9xBd@debian/ - "sched: Make class_schedulers avoid pushing current, and get rid of proxy_tag_curr()" Queues: 6.18 Reason: patch author John Stultz asked to drop from 6.18-stable -- it only matters for the EXPERT-gated, still-in-development proxy-exec feature, and the downside of not taking it is non-ideal balancing. Keeping it queued in 7.0 per Stultz's literal request scope. Report: https://lore.kernel.org/stable/CANDhNCpZWMk6GWubK8+E0rxKUqtuhOtrjqxunS=Kmho-UbR0UA@mail.gmail.com/ - "riscv: misaligned: Make enabling delegation depend on NONPORTABLE" Queues: 7.0, 6.18 Reason: patch author Vivian Wang retracts her Cc: stable request -- boot-time crashes seen on 7.1-rc / linux-next on some hardware / firmware combinations; asks for time to investigate before re-submitting. Report: https://lore.kernel.org/stable/99c8c715-b37f-4f2a-8100-5ea4970ff34d@iscas.ac.cn/ - "perf tools: Fix module symbol resolution for non-zero .text sh_addr" Queues: 6.6, 6.1, 5.15, 5.10 Reason: build break -- patch calls dso__rel() inline which doesn't exist on these versions (the underlying dso refcount refactor was never backported). 7.0/6.18/6.12 have the inline and remain queued. Reported by Florian Fainelli. Report: https://lore.kernel.org/stable/fbe52f15-5b34-4e03-88e0-005ae6200a60@gmail.com/ Signed-off-by: Sasha Levin --- ...odule-symbol-resolution-for-non-zero.patch | 77 - queue-5.10/series | 1 - ...odule-symbol-resolution-for-non-zero.patch | 77 - queue-5.15/series | 1 - ...odule-symbol-resolution-for-non-zero.patch | 77 - queue-6.1/series | 1 - ...adata-accesses-for-file-backed-mount.patch | 58 - ...g-level-of-btf-loading-error-message.patch | 59 - ...double-close-and-leak-of-btf-objects.patch | 98 -- ...fy-errno-in-log-messages-in-libbpf.c.patch | 1324 ----------------- queue-6.12/series | 4 - ...adata-accesses-for-file-backed-mount.patch | 58 - ...ing-delegation-depend-on-nonportable.patch | 83 -- ..._schedulers-avoid-pushing-current-an.patch | 168 --- queue-6.18/series | 3 - ...odule-symbol-resolution-for-non-zero.patch | 77 - queue-6.6/series | 1 - ...adata-accesses-for-file-backed-mount.patch | 58 - ...ing-delegation-depend-on-nonportable.patch | 83 -- ...plify-code-by-caching-string-lengths.patch | 99 -- ...-write-loop-in-trace_event_save_hist.patch | 71 - ...use-str_has_prefix-for-prefix-checks.patch | 71 - queue-7.0/series | 5 - 23 files changed, 2554 deletions(-) delete mode 100644 queue-5.10/perf-tools-fix-module-symbol-resolution-for-non-zero.patch delete mode 100644 queue-5.15/perf-tools-fix-module-symbol-resolution-for-non-zero.patch delete mode 100644 queue-6.1/perf-tools-fix-module-symbol-resolution-for-non-zero.patch delete mode 100644 queue-6.12/erofs-verify-metadata-accesses-for-file-backed-mount.patch delete mode 100644 queue-6.12/libbpf-change-log-level-of-btf-loading-error-message.patch delete mode 100644 queue-6.12/libbpf-prevent-double-close-and-leak-of-btf-objects.patch delete mode 100644 queue-6.12/libbpf-stringify-errno-in-log-messages-in-libbpf.c.patch delete mode 100644 queue-6.18/erofs-verify-metadata-accesses-for-file-backed-mount.patch delete mode 100644 queue-6.18/riscv-misaligned-make-enabling-delegation-depend-on-nonportable.patch delete mode 100644 queue-6.18/sched-make-class_schedulers-avoid-pushing-current-an.patch delete mode 100644 queue-6.6/perf-tools-fix-module-symbol-resolution-for-non-zero.patch delete mode 100644 queue-7.0/erofs-verify-metadata-accesses-for-file-backed-mount.patch delete mode 100644 queue-7.0/riscv-misaligned-make-enabling-delegation-depend-on-nonportable.patch delete mode 100644 queue-7.0/rtla-simplify-code-by-caching-string-lengths.patch delete mode 100644 queue-7.0/rtla-trace-fix-write-loop-in-trace_event_save_hist.patch delete mode 100644 queue-7.0/rtla-use-str_has_prefix-for-prefix-checks.patch diff --git a/queue-5.10/perf-tools-fix-module-symbol-resolution-for-non-zero.patch b/queue-5.10/perf-tools-fix-module-symbol-resolution-for-non-zero.patch deleted file mode 100644 index 60415936b7..0000000000 --- a/queue-5.10/perf-tools-fix-module-symbol-resolution-for-non-zero.patch +++ /dev/null @@ -1,77 +0,0 @@ -From fde2b963b6b822403ef86c2a87053084a770fb80 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 23 Mar 2026 11:58:04 -0400 -Subject: perf tools: Fix module symbol resolution for non-zero .text sh_addr - -From: Chuck Lever - -[ Upstream commit 9a82bfde4775b7a87cd1a7e791f46f83ae442848 ] - -When perf resolves symbols from kernel module ELF files (ET_REL), -it converts symbol addresses to file offsets so that sample IPs -can be matched to the correct symbol. The conversion adjusts each -symbol's st_value: - - sym->st_value -= shdr->sh_addr - shdr->sh_offset; - -For vmlinux (ET_EXEC), st_value is a virtual address and sh_addr -is the section's virtual base, so subtracting sh_addr and adding -sh_offset correctly yields a file offset. - -For kernel modules (ET_REL), st_value is a section-relative -offset. The module loader ignores sh_addr entirely and places -symbols at module_base + st_value. Converting to file offset -requires only adding sh_offset; subtracting sh_addr introduces an -error equal to sh_addr bytes. - -When .text has sh_addr == 0 -- the historical norm for simple -modules -- both formulas produce the same result and the bug is -latent. As modules gain more metadata sections before .text (.note, -.static_call.text, etc.), the linker assigns .text a non-zero -sh_addr, exposing the defect. For example, nfsd.ko on this kernel -has sh_addr=0xa80, kvm-intel.ko has sh_addr=0x1e90. - -The effect is that all .text symbols in affected modules -shift by sh_addr bytes relative to sample IPs, causing perf -report to attribute samples to incorrect, nearby symbols. This -was observed as 13% of LLC-load-miss samples misattributed -to nfsd_file_get_dio_attrs when the actual hot function was -nfsd_cache_lookup, approximately 0xa80 bytes away in the symbol -table. - -Use the existing dso__rel() flag (already set for ET_REL modules) -to select the correct adjustment: add sh_offset for ET_REL, -subtract (sh_addr - sh_offset) for ET_EXEC/ET_DYN. - -Fixes: 0131c4ec794a ("perf tools: Make it possible to read object code from kernel modules") -Signed-off-by: Chuck Lever -Reviewed-by: Ian Rogers -Tested-by: Thomas Richter -Signed-off-by: Namhyung Kim -Signed-off-by: Sasha Levin ---- - tools/perf/util/symbol-elf.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c -index b171d134ce87a..608dca7b58c57 100644 ---- a/tools/perf/util/symbol-elf.c -+++ b/tools/perf/util/symbol-elf.c -@@ -968,8 +968,12 @@ static int dso__process_kernel_symbol(struct dso *dso, struct map *map, - char dso_name[PATH_MAX]; - - /* Adjust symbol to map to file offset */ -- if (adjust_kernel_syms) -- sym->st_value -= shdr->sh_addr - shdr->sh_offset; -+ if (adjust_kernel_syms) { -+ if (dso__rel(dso)) -+ sym->st_value += shdr->sh_offset; -+ else -+ sym->st_value -= shdr->sh_addr - shdr->sh_offset; -+ } - - if (strcmp(section_name, (curr_dso->short_name + dso->short_name_len)) == 0) - return 0; --- -2.53.0 - diff --git a/queue-5.10/series b/queue-5.10/series index 428ad74377..f1397069dd 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -388,7 +388,6 @@ bpf-arm32-reject-bpf-to-bpf-calls-and-callbacks-in-t.patch pinctrl-pinctrl-pic32-fix-resource-leak.patch perf-branch-avoid-incrementing-null.patch pinctrl-abx500-fix-type-of-argument-variable.patch -perf-tools-fix-module-symbol-resolution-for-non-zero.patch perf-expr-return-einval-for-syntax-error-in-expr__fi.patch perf-util-kill-die-prototype-dead-for-a-long-time.patch i3c-master-fix-error-codes-at-send_ccc_cmd.patch diff --git a/queue-5.15/perf-tools-fix-module-symbol-resolution-for-non-zero.patch b/queue-5.15/perf-tools-fix-module-symbol-resolution-for-non-zero.patch deleted file mode 100644 index c56094ce9b..0000000000 --- a/queue-5.15/perf-tools-fix-module-symbol-resolution-for-non-zero.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 3e6da609775b8e57a3f9cbf57b2d2ee59e707c1b Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 23 Mar 2026 11:58:04 -0400 -Subject: perf tools: Fix module symbol resolution for non-zero .text sh_addr - -From: Chuck Lever - -[ Upstream commit 9a82bfde4775b7a87cd1a7e791f46f83ae442848 ] - -When perf resolves symbols from kernel module ELF files (ET_REL), -it converts symbol addresses to file offsets so that sample IPs -can be matched to the correct symbol. The conversion adjusts each -symbol's st_value: - - sym->st_value -= shdr->sh_addr - shdr->sh_offset; - -For vmlinux (ET_EXEC), st_value is a virtual address and sh_addr -is the section's virtual base, so subtracting sh_addr and adding -sh_offset correctly yields a file offset. - -For kernel modules (ET_REL), st_value is a section-relative -offset. The module loader ignores sh_addr entirely and places -symbols at module_base + st_value. Converting to file offset -requires only adding sh_offset; subtracting sh_addr introduces an -error equal to sh_addr bytes. - -When .text has sh_addr == 0 -- the historical norm for simple -modules -- both formulas produce the same result and the bug is -latent. As modules gain more metadata sections before .text (.note, -.static_call.text, etc.), the linker assigns .text a non-zero -sh_addr, exposing the defect. For example, nfsd.ko on this kernel -has sh_addr=0xa80, kvm-intel.ko has sh_addr=0x1e90. - -The effect is that all .text symbols in affected modules -shift by sh_addr bytes relative to sample IPs, causing perf -report to attribute samples to incorrect, nearby symbols. This -was observed as 13% of LLC-load-miss samples misattributed -to nfsd_file_get_dio_attrs when the actual hot function was -nfsd_cache_lookup, approximately 0xa80 bytes away in the symbol -table. - -Use the existing dso__rel() flag (already set for ET_REL modules) -to select the correct adjustment: add sh_offset for ET_REL, -subtract (sh_addr - sh_offset) for ET_EXEC/ET_DYN. - -Fixes: 0131c4ec794a ("perf tools: Make it possible to read object code from kernel modules") -Signed-off-by: Chuck Lever -Reviewed-by: Ian Rogers -Tested-by: Thomas Richter -Signed-off-by: Namhyung Kim -Signed-off-by: Sasha Levin ---- - tools/perf/util/symbol-elf.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c -index bbc3a150597a4..43fee6493035d 100644 ---- a/tools/perf/util/symbol-elf.c -+++ b/tools/perf/util/symbol-elf.c -@@ -1006,8 +1006,12 @@ static int dso__process_kernel_symbol(struct dso *dso, struct map *map, - char dso_name[PATH_MAX]; - - /* Adjust symbol to map to file offset */ -- if (adjust_kernel_syms) -- sym->st_value -= shdr->sh_addr - shdr->sh_offset; -+ if (adjust_kernel_syms) { -+ if (dso__rel(dso)) -+ sym->st_value += shdr->sh_offset; -+ else -+ sym->st_value -= shdr->sh_addr - shdr->sh_offset; -+ } - - if (strcmp(section_name, (curr_dso->short_name + dso->short_name_len)) == 0) - return 0; --- -2.53.0 - diff --git a/queue-5.15/series b/queue-5.15/series index 5aeb9eea68..a77268f9c6 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -520,7 +520,6 @@ pinctrl-pinctrl-pic32-fix-resource-leak.patch perf-branch-avoid-incrementing-null.patch perf-tools-cs-etm-fix-print-issue-for-coresight-debu.patch pinctrl-abx500-fix-type-of-argument-variable.patch -perf-tools-fix-module-symbol-resolution-for-non-zero.patch perf-expr-return-einval-for-syntax-error-in-expr__fi.patch perf-util-kill-die-prototype-dead-for-a-long-time.patch i3c-master-fix-error-codes-at-send_ccc_cmd.patch diff --git a/queue-6.1/perf-tools-fix-module-symbol-resolution-for-non-zero.patch b/queue-6.1/perf-tools-fix-module-symbol-resolution-for-non-zero.patch deleted file mode 100644 index 5650e58a1d..0000000000 --- a/queue-6.1/perf-tools-fix-module-symbol-resolution-for-non-zero.patch +++ /dev/null @@ -1,77 +0,0 @@ -From a382bd249ce349cd5e171cfb5e54b1ce26e95d86 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 23 Mar 2026 11:58:04 -0400 -Subject: perf tools: Fix module symbol resolution for non-zero .text sh_addr - -From: Chuck Lever - -[ Upstream commit 9a82bfde4775b7a87cd1a7e791f46f83ae442848 ] - -When perf resolves symbols from kernel module ELF files (ET_REL), -it converts symbol addresses to file offsets so that sample IPs -can be matched to the correct symbol. The conversion adjusts each -symbol's st_value: - - sym->st_value -= shdr->sh_addr - shdr->sh_offset; - -For vmlinux (ET_EXEC), st_value is a virtual address and sh_addr -is the section's virtual base, so subtracting sh_addr and adding -sh_offset correctly yields a file offset. - -For kernel modules (ET_REL), st_value is a section-relative -offset. The module loader ignores sh_addr entirely and places -symbols at module_base + st_value. Converting to file offset -requires only adding sh_offset; subtracting sh_addr introduces an -error equal to sh_addr bytes. - -When .text has sh_addr == 0 -- the historical norm for simple -modules -- both formulas produce the same result and the bug is -latent. As modules gain more metadata sections before .text (.note, -.static_call.text, etc.), the linker assigns .text a non-zero -sh_addr, exposing the defect. For example, nfsd.ko on this kernel -has sh_addr=0xa80, kvm-intel.ko has sh_addr=0x1e90. - -The effect is that all .text symbols in affected modules -shift by sh_addr bytes relative to sample IPs, causing perf -report to attribute samples to incorrect, nearby symbols. This -was observed as 13% of LLC-load-miss samples misattributed -to nfsd_file_get_dio_attrs when the actual hot function was -nfsd_cache_lookup, approximately 0xa80 bytes away in the symbol -table. - -Use the existing dso__rel() flag (already set for ET_REL modules) -to select the correct adjustment: add sh_offset for ET_REL, -subtract (sh_addr - sh_offset) for ET_EXEC/ET_DYN. - -Fixes: 0131c4ec794a ("perf tools: Make it possible to read object code from kernel modules") -Signed-off-by: Chuck Lever -Reviewed-by: Ian Rogers -Tested-by: Thomas Richter -Signed-off-by: Namhyung Kim -Signed-off-by: Sasha Levin ---- - tools/perf/util/symbol-elf.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c -index 29c9348c30f00..34bcce60e9ca3 100644 ---- a/tools/perf/util/symbol-elf.c -+++ b/tools/perf/util/symbol-elf.c -@@ -1006,8 +1006,12 @@ static int dso__process_kernel_symbol(struct dso *dso, struct map *map, - char dso_name[PATH_MAX]; - - /* Adjust symbol to map to file offset */ -- if (adjust_kernel_syms) -- sym->st_value -= shdr->sh_addr - shdr->sh_offset; -+ if (adjust_kernel_syms) { -+ if (dso__rel(dso)) -+ sym->st_value += shdr->sh_offset; -+ else -+ sym->st_value -= shdr->sh_addr - shdr->sh_offset; -+ } - - if (strcmp(section_name, (curr_dso->short_name + dso->short_name_len)) == 0) - return 0; --- -2.53.0 - diff --git a/queue-6.1/series b/queue-6.1/series index 66d8c6f5ef..901eda07cf 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -630,7 +630,6 @@ pinctrl-cy8c95x0-avoid-returning-positive-values-to-.patch perf-branch-avoid-incrementing-null.patch perf-tools-cs-etm-fix-print-issue-for-coresight-debu.patch pinctrl-abx500-fix-type-of-argument-variable.patch -perf-tools-fix-module-symbol-resolution-for-non-zero.patch perf-expr-return-einval-for-syntax-error-in-expr__fi.patch perf-util-kill-die-prototype-dead-for-a-long-time.patch i3c-master-fix-error-codes-at-send_ccc_cmd.patch diff --git a/queue-6.12/erofs-verify-metadata-accesses-for-file-backed-mount.patch b/queue-6.12/erofs-verify-metadata-accesses-for-file-backed-mount.patch deleted file mode 100644 index 5e0f0016a0..0000000000 --- a/queue-6.12/erofs-verify-metadata-accesses-for-file-backed-mount.patch +++ /dev/null @@ -1,58 +0,0 @@ -From acb734a6d4755ca07d000ba691b3121bc5575014 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 30 Mar 2026 10:29:29 +0800 -Subject: erofs: verify metadata accesses for file-backed mounts - -From: Gao Xiang - -[ Upstream commit 307210c262a29f41d7177851295ea1703bd04175 ] - -For file-backed mounts, metadata is fetched via the page cache of -backing inodes to avoid double caching and redundant copy ops out -of RO uptodate folios, which is used by Android APEXes, ComposeFS, -containerd. However, rw_verify_area() was missing prior to -metadata accesses. - -Similar to vfs_iocb_iter_read(), fix this by: - - Enabling fanotify pre-content hooks on metadata accesses; - - security_file_permission() for security modules. - -Verified that fanotify pre-content hooks now works correctly. - -Fixes: fb176750266a ("erofs: add file-backed mount support") -Acked-by: Amir Goldstein -Reviewed-by: Chunhai Guo -Signed-off-by: Gao Xiang -Signed-off-by: Sasha Levin ---- - fs/erofs/data.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/fs/erofs/data.c b/fs/erofs/data.c -index 91182d5e3a66c..192c7ed885acd 100644 ---- a/fs/erofs/data.c -+++ b/fs/erofs/data.c -@@ -30,6 +30,20 @@ void *erofs_bread(struct erofs_buf *buf, erofs_off_t offset, - { - pgoff_t index = offset >> PAGE_SHIFT; - struct folio *folio = NULL; -+ loff_t fpos; -+ int err; -+ -+ /* -+ * Metadata access for file-backed mounts reuses page cache of backing -+ * fs inodes (only folio data will be needed) to prevent double caching. -+ * However, the data access range must be verified here in advance. -+ */ -+ if (buf->file) { -+ fpos = index << PAGE_SHIFT; -+ err = rw_verify_area(READ, buf->file, &fpos, PAGE_SIZE); -+ if (err < 0) -+ return ERR_PTR(err); -+ } - - if (buf->page) { - folio = page_folio(buf->page); --- -2.53.0 - diff --git a/queue-6.12/libbpf-change-log-level-of-btf-loading-error-message.patch b/queue-6.12/libbpf-change-log-level-of-btf-loading-error-message.patch deleted file mode 100644 index aeb4a32066..0000000000 --- a/queue-6.12/libbpf-change-log-level-of-btf-loading-error-message.patch +++ /dev/null @@ -1,59 +0,0 @@ -From f26edbaefab81102ef713c13df4b688429b8abf6 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 18 Sep 2024 19:33:22 +0000 -Subject: libbpf: Change log level of BTF loading error message - -From: Ihor Solodrai - -[ Upstream commit 8b334d91834666dbc4c1c0b0abed3f855ed16cf3 ] - -Reduce log level of BTF loading error to INFO if BTF is not required. - -Andrii says: - - Nowadays the expectation is that the BPF program will have a valid - .BTF section, so even though .BTF is "optional", I think it's fine - to emit a warning for that case (any reasonably recent Clang will - produce valid BTF). - - Ihor's patch is fixing the situation with an outdated host kernel - that doesn't understand BTF. libbpf will try to "upload" the - program's BTF, but if that fails and the BPF object doesn't use - any features that require having BTF uploaded, then it's just an - information message to the user, but otherwise can be ignored. - -Suggested-by: Andrii Nakryiko -Signed-off-by: Ihor Solodrai -Acked-by: Andrii Nakryiko -Signed-off-by: Daniel Borkmann -Signed-off-by: Alexei Starovoitov -Stable-dep-of: 380044c40b16 ("libbpf: Prevent double close and leak of btf objects") -Signed-off-by: Sasha Levin ---- - tools/lib/bpf/libbpf.c | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c -index 7d496f0a9a30d..791488efec27d 100644 ---- a/tools/lib/bpf/libbpf.c -+++ b/tools/lib/bpf/libbpf.c -@@ -3582,11 +3582,12 @@ static int bpf_object__sanitize_and_load_btf(struct bpf_object *obj) - report: - if (err) { - btf_mandatory = kernel_needs_btf(obj); -- pr_warn("Error loading .BTF into kernel: %d. %s\n", err, -- btf_mandatory ? "BTF is mandatory, can't proceed." -- : "BTF is optional, ignoring."); -- if (!btf_mandatory) -+ if (btf_mandatory) { -+ pr_warn("Error loading .BTF into kernel: %d. BTF is mandatory, can't proceed.\n", err); -+ } else { -+ pr_info("Error loading .BTF into kernel: %d. BTF is optional, ignoring.\n", err); - err = 0; -+ } - } - return err; - } --- -2.53.0 - diff --git a/queue-6.12/libbpf-prevent-double-close-and-leak-of-btf-objects.patch b/queue-6.12/libbpf-prevent-double-close-and-leak-of-btf-objects.patch deleted file mode 100644 index 9324d31f37..0000000000 --- a/queue-6.12/libbpf-prevent-double-close-and-leak-of-btf-objects.patch +++ /dev/null @@ -1,98 +0,0 @@ -From ed5aef910da2bd56d4b04e6ed6c07c6110acb9b8 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 16 Apr 2026 12:00:34 +0200 -Subject: libbpf: Prevent double close and leak of btf objects - -From: Jiri Olsa - -[ Upstream commit 380044c40b1636a72fd8f188b5806be6ae564279 ] - -Sashiko found possible double close of btf object fd [1], -which happens when strdup in load_module_btfs fails at which -point the obj->btf_module_cnt is already incremented. - -The error path close btf fd and so does later cleanup code in -bpf_object_post_load_cleanup function. - -Also libbpf_ensure_mem failure leaves btf object not assigned -and it's leaked. - -Replacing the err_out label with break to make the error path -less confusing as suggested by Alan. - -Incrementing obj->btf_module_cnt only if there's no failure -and releasing btf object in error path. - -Fixes: 91abb4a6d79d ("libbpf: Support attachment of BPF tracing programs to kernel modules") -[1] https://sashiko.dev/#/patchset/20260324081846.2334094-1-jolsa%40kernel.org -Signed-off-by: Jiri Olsa -Link: https://lore.kernel.org/r/20260416100034.1610852-1-jolsa@kernel.org -Signed-off-by: Alexei Starovoitov -Signed-off-by: Sasha Levin ---- - tools/lib/bpf/libbpf.c | 21 +++++++++++---------- - 1 file changed, 11 insertions(+), 10 deletions(-) - -diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c -index 9c94d56e79764..c7b7a15b9901c 100644 ---- a/tools/lib/bpf/libbpf.c -+++ b/tools/lib/bpf/libbpf.c -@@ -5664,11 +5664,12 @@ static int load_module_btfs(struct bpf_object *obj) - info.name = ptr_to_u64(name); - info.name_len = sizeof(name); - -+ btf = NULL; - err = bpf_btf_get_info_by_fd(fd, &info, &len); - if (err) { - err = -errno; - pr_warn("failed to get BTF object #%d info: %s\n", id, errstr(err)); -- goto err_out; -+ break; - } - - /* ignore non-module BTFs */ -@@ -5682,15 +5683,15 @@ static int load_module_btfs(struct bpf_object *obj) - if (err) { - pr_warn("failed to load module [%s]'s BTF object #%d: %s\n", - name, id, errstr(err)); -- goto err_out; -+ break; - } - - err = libbpf_ensure_mem((void **)&obj->btf_modules, &obj->btf_module_cap, - sizeof(*obj->btf_modules), obj->btf_module_cnt + 1); - if (err) -- goto err_out; -+ break; - -- mod_btf = &obj->btf_modules[obj->btf_module_cnt++]; -+ mod_btf = &obj->btf_modules[obj->btf_module_cnt]; - - mod_btf->btf = btf; - mod_btf->id = id; -@@ -5698,16 +5699,16 @@ static int load_module_btfs(struct bpf_object *obj) - mod_btf->name = strdup(name); - if (!mod_btf->name) { - err = -ENOMEM; -- goto err_out; -+ break; - } -- continue; -+ obj->btf_module_cnt++; -+ } - --err_out: -+ if (err) { -+ btf__free(btf); - close(fd); -- return err; - } -- -- return 0; -+ return err; - } - - static struct bpf_core_cand_list * --- -2.53.0 - diff --git a/queue-6.12/libbpf-stringify-errno-in-log-messages-in-libbpf.c.patch b/queue-6.12/libbpf-stringify-errno-in-log-messages-in-libbpf.c.patch deleted file mode 100644 index d9e4313111..0000000000 --- a/queue-6.12/libbpf-stringify-errno-in-log-messages-in-libbpf.c.patch +++ /dev/null @@ -1,1324 +0,0 @@ -From 60faff684bdf676de5b464d9b8b3402759052ebb Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 11 Nov 2024 21:29:17 +0000 -Subject: libbpf: Stringify errno in log messages in libbpf.c - -From: Mykyta Yatsenko - -[ Upstream commit 271abf041cb354ce99df33ce1f99db79faf90477 ] - -Convert numeric error codes into the string representations in log -messages in libbpf.c. - -Signed-off-by: Mykyta Yatsenko -Signed-off-by: Andrii Nakryiko -Link: https://lore.kernel.org/bpf/20241111212919.368971-3-mykyta.yatsenko5@gmail.com -Stable-dep-of: 380044c40b16 ("libbpf: Prevent double close and leak of btf objects") -Signed-off-by: Sasha Levin ---- - tools/lib/bpf/libbpf.c | 356 ++++++++++++++++++----------------------- - 1 file changed, 156 insertions(+), 200 deletions(-) - -diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c -index 791488efec27d..9c94d56e79764 100644 ---- a/tools/lib/bpf/libbpf.c -+++ b/tools/lib/bpf/libbpf.c -@@ -1534,11 +1534,8 @@ static int bpf_object__elf_init(struct bpf_object *obj) - } else { - obj->efile.fd = open(obj->path, O_RDONLY | O_CLOEXEC); - if (obj->efile.fd < 0) { -- char errmsg[STRERR_BUFSIZE], *cp; -- - err = -errno; -- cp = libbpf_strerror_r(err, errmsg, sizeof(errmsg)); -- pr_warn("elf: failed to open %s: %s\n", obj->path, cp); -+ pr_warn("elf: failed to open %s: %s\n", obj->path, errstr(err)); - return err; - } - -@@ -1938,8 +1935,7 @@ bpf_object__init_internal_map(struct bpf_object *obj, enum libbpf_map_type type, - if (map->mmaped == MAP_FAILED) { - err = -errno; - map->mmaped = NULL; -- pr_warn("failed to alloc map '%s' content buffer: %d\n", -- map->name, err); -+ pr_warn("failed to alloc map '%s' content buffer: %s\n", map->name, errstr(err)); - zfree(&map->real_name); - zfree(&map->name); - return err; -@@ -2103,7 +2099,7 @@ static int parse_u64(const char *value, __u64 *res) - *res = strtoull(value, &value_end, 0); - if (errno) { - err = -errno; -- pr_warn("failed to parse '%s' as integer: %d\n", value, err); -+ pr_warn("failed to parse '%s': %s\n", value, errstr(err)); - return err; - } - if (*value_end) { -@@ -2269,8 +2265,8 @@ static int bpf_object__read_kconfig_file(struct bpf_object *obj, void *data) - while (gzgets(file, buf, sizeof(buf))) { - err = bpf_object__process_kconfig_line(obj, buf, data); - if (err) { -- pr_warn("error parsing system Kconfig line '%s': %d\n", -- buf, err); -+ pr_warn("error parsing system Kconfig line '%s': %s\n", -+ buf, errstr(err)); - goto out; - } - } -@@ -2290,15 +2286,15 @@ static int bpf_object__read_kconfig_mem(struct bpf_object *obj, - file = fmemopen((void *)config, strlen(config), "r"); - if (!file) { - err = -errno; -- pr_warn("failed to open in-memory Kconfig: %d\n", err); -+ pr_warn("failed to open in-memory Kconfig: %s\n", errstr(err)); - return err; - } - - while (fgets(buf, sizeof(buf), file)) { - err = bpf_object__process_kconfig_line(obj, buf, data); - if (err) { -- pr_warn("error parsing in-memory Kconfig line '%s': %d\n", -- buf, err); -+ pr_warn("error parsing in-memory Kconfig line '%s': %s\n", -+ buf, errstr(err)); - break; - } - } -@@ -3213,7 +3209,7 @@ static int bpf_object__init_btf(struct bpf_object *obj, - err = libbpf_get_error(obj->btf); - if (err) { - obj->btf = NULL; -- pr_warn("Error loading ELF section %s: %d.\n", BTF_ELF_SEC, err); -+ pr_warn("Error loading ELF section %s: %s.\n", BTF_ELF_SEC, errstr(err)); - goto out; - } - /* enforce 8-byte pointers for BPF-targeted BTFs */ -@@ -3231,8 +3227,8 @@ static int bpf_object__init_btf(struct bpf_object *obj, - obj->btf_ext = btf_ext__new(btf_ext_data->d_buf, btf_ext_data->d_size); - err = libbpf_get_error(obj->btf_ext); - if (err) { -- pr_warn("Error loading ELF section %s: %d. Ignored and continue.\n", -- BTF_EXT_ELF_SEC, err); -+ pr_warn("Error loading ELF section %s: %s. Ignored and continue.\n", -+ BTF_EXT_ELF_SEC, errstr(err)); - obj->btf_ext = NULL; - goto out; - } -@@ -3324,8 +3320,8 @@ static int btf_fixup_datasec(struct bpf_object *obj, struct btf *btf, - if (t->size == 0) { - err = find_elf_sec_sz(obj, sec_name, &size); - if (err || !size) { -- pr_debug("sec '%s': failed to determine size from ELF: size %u, err %d\n", -- sec_name, size, err); -+ pr_debug("sec '%s': failed to determine size from ELF: size %u, err %s\n", -+ sec_name, size, errstr(err)); - return -ENOENT; - } - -@@ -3479,7 +3475,7 @@ static int bpf_object__load_vmlinux_btf(struct bpf_object *obj, bool force) - obj->btf_vmlinux = btf__load_vmlinux_btf(); - err = libbpf_get_error(obj->btf_vmlinux); - if (err) { -- pr_warn("Error loading vmlinux BTF: %d\n", err); -+ pr_warn("Error loading vmlinux BTF: %s\n", errstr(err)); - obj->btf_vmlinux = NULL; - return err; - } -@@ -3583,9 +3579,11 @@ static int bpf_object__sanitize_and_load_btf(struct bpf_object *obj) - if (err) { - btf_mandatory = kernel_needs_btf(obj); - if (btf_mandatory) { -- pr_warn("Error loading .BTF into kernel: %d. BTF is mandatory, can't proceed.\n", err); -+ pr_warn("Error loading .BTF into kernel: %s. BTF is mandatory, can't proceed.\n", -+ errstr(err)); - } else { -- pr_info("Error loading .BTF into kernel: %d. BTF is optional, ignoring.\n", err); -+ pr_info("Error loading .BTF into kernel: %s. BTF is optional, ignoring.\n", -+ errstr(err)); - err = 0; - } - } -@@ -4797,8 +4795,8 @@ static int bpf_get_map_info_from_fdinfo(int fd, struct bpf_map_info *info) - fp = fopen(file, "re"); - if (!fp) { - err = -errno; -- pr_warn("failed to open %s: %d. No procfs support?\n", file, -- err); -+ pr_warn("failed to open %s: %s. No procfs support?\n", file, -+ errstr(err)); - return err; - } - -@@ -4953,8 +4951,8 @@ static int bpf_object_prepare_token(struct bpf_object *obj) - bpffs_fd = open(bpffs_path, O_DIRECTORY, O_RDWR); - if (bpffs_fd < 0) { - err = -errno; -- __pr(level, "object '%s': failed (%d) to open BPF FS mount at '%s'%s\n", -- obj->name, err, bpffs_path, -+ __pr(level, "object '%s': failed (%s) to open BPF FS mount at '%s'%s\n", -+ obj->name, errstr(err), bpffs_path, - mandatory ? "" : ", skipping optional step..."); - return mandatory ? err : 0; - } -@@ -4988,7 +4986,6 @@ static int bpf_object_prepare_token(struct bpf_object *obj) - static int - bpf_object__probe_loading(struct bpf_object *obj) - { -- char *cp, errmsg[STRERR_BUFSIZE]; - struct bpf_insn insns[] = { - BPF_MOV64_IMM(BPF_REG_0, 0), - BPF_EXIT_INSN(), -@@ -5004,7 +5001,8 @@ bpf_object__probe_loading(struct bpf_object *obj) - - ret = bump_rlimit_memlock(); - if (ret) -- pr_warn("Failed to bump RLIMIT_MEMLOCK (err = %d), you might need to do it explicitly!\n", ret); -+ pr_warn("Failed to bump RLIMIT_MEMLOCK (err = %s), you might need to do it explicitly!\n", -+ errstr(ret)); - - /* make sure basic loading works */ - ret = bpf_prog_load(BPF_PROG_TYPE_SOCKET_FILTER, NULL, "GPL", insns, insn_cnt, &opts); -@@ -5012,11 +5010,8 @@ bpf_object__probe_loading(struct bpf_object *obj) - ret = bpf_prog_load(BPF_PROG_TYPE_TRACEPOINT, NULL, "GPL", insns, insn_cnt, &opts); - if (ret < 0) { - ret = errno; -- cp = libbpf_strerror_r(ret, errmsg, sizeof(errmsg)); -- pr_warn("Error in %s():%s(%d). Couldn't load trivial BPF " -- "program. Make sure your kernel supports BPF " -- "(CONFIG_BPF_SYSCALL=y) and/or that RLIMIT_MEMLOCK is " -- "set to big enough value.\n", __func__, cp, ret); -+ pr_warn("Error in %s(): %s. Couldn't load trivial BPF program. Make sure your kernel supports BPF (CONFIG_BPF_SYSCALL=y) and/or that RLIMIT_MEMLOCK is set to big enough value.\n", -+ __func__, errstr(ret)); - return -ret; - } - close(ret); -@@ -5041,7 +5036,6 @@ bool kernel_supports(const struct bpf_object *obj, enum kern_feature_id feat_id) - static bool map_is_reuse_compat(const struct bpf_map *map, int map_fd) - { - struct bpf_map_info map_info; -- char msg[STRERR_BUFSIZE]; - __u32 map_info_len = sizeof(map_info); - int err; - -@@ -5051,7 +5045,7 @@ static bool map_is_reuse_compat(const struct bpf_map *map, int map_fd) - err = bpf_get_map_info_from_fdinfo(map_fd, &map_info); - if (err) { - pr_warn("failed to get map info for map FD %d: %s\n", map_fd, -- libbpf_strerror_r(errno, msg, sizeof(msg))); -+ errstr(err)); - return false; - } - -@@ -5076,7 +5070,6 @@ static bool map_is_reuse_compat(const struct bpf_map *map, int map_fd) - static int - bpf_object__reuse_map(struct bpf_map *map) - { -- char *cp, errmsg[STRERR_BUFSIZE]; - int err, pin_fd; - - pin_fd = bpf_obj_get(map->pin_path); -@@ -5088,9 +5081,8 @@ bpf_object__reuse_map(struct bpf_map *map) - return 0; - } - -- cp = libbpf_strerror_r(-err, errmsg, sizeof(errmsg)); - pr_warn("couldn't retrieve pinned map '%s': %s\n", -- map->pin_path, cp); -+ map->pin_path, errstr(err)); - return err; - } - -@@ -5116,7 +5108,6 @@ static int - bpf_object__populate_internal_map(struct bpf_object *obj, struct bpf_map *map) - { - enum libbpf_map_type map_type = map->libbpf_type; -- char *cp, errmsg[STRERR_BUFSIZE]; - int err, zero = 0; - size_t mmap_sz; - -@@ -5131,9 +5122,8 @@ bpf_object__populate_internal_map(struct bpf_object *obj, struct bpf_map *map) - err = bpf_map_update_elem(map->fd, &zero, map->mmaped, 0); - if (err) { - err = -errno; -- cp = libbpf_strerror_r(err, errmsg, sizeof(errmsg)); - pr_warn("map '%s': failed to set initial contents: %s\n", -- bpf_map__name(map), cp); -+ bpf_map__name(map), errstr(err)); - return err; - } - -@@ -5142,9 +5132,8 @@ bpf_object__populate_internal_map(struct bpf_object *obj, struct bpf_map *map) - err = bpf_map_freeze(map->fd); - if (err) { - err = -errno; -- cp = libbpf_strerror_r(err, errmsg, sizeof(errmsg)); - pr_warn("map '%s': failed to freeze as read-only: %s\n", -- bpf_map__name(map), cp); -+ bpf_map__name(map), errstr(err)); - return err; - } - } -@@ -5170,8 +5159,8 @@ bpf_object__populate_internal_map(struct bpf_object *obj, struct bpf_map *map) - mmaped = mmap(map->mmaped, mmap_sz, prot, MAP_SHARED | MAP_FIXED, map->fd, 0); - if (mmaped == MAP_FAILED) { - err = -errno; -- pr_warn("map '%s': failed to re-mmap() contents: %d\n", -- bpf_map__name(map), err); -+ pr_warn("map '%s': failed to re-mmap() contents: %s\n", -+ bpf_map__name(map), errstr(err)); - return err; - } - map->mmaped = mmaped; -@@ -5228,8 +5217,8 @@ static int bpf_object__create_map(struct bpf_object *obj, struct bpf_map *map, b - return err; - err = bpf_object__create_map(obj, map->inner_map, true); - if (err) { -- pr_warn("map '%s': failed to create inner map: %d\n", -- map->name, err); -+ pr_warn("map '%s': failed to create inner map: %s\n", -+ map->name, errstr(err)); - return err; - } - map->inner_map_fd = map->inner_map->fd; -@@ -5283,12 +5272,9 @@ static int bpf_object__create_map(struct bpf_object *obj, struct bpf_map *map, b - def->max_entries, &create_attr); - } - if (map_fd < 0 && (create_attr.btf_key_type_id || create_attr.btf_value_type_id)) { -- char *cp, errmsg[STRERR_BUFSIZE]; -- - err = -errno; -- cp = libbpf_strerror_r(err, errmsg, sizeof(errmsg)); -- pr_warn("Error in bpf_create_map_xattr(%s):%s(%d). Retrying without BTF.\n", -- map->name, cp, err); -+ pr_warn("Error in bpf_create_map_xattr(%s): %s. Retrying without BTF.\n", -+ map->name, errstr(err)); - create_attr.btf_fd = 0; - create_attr.btf_key_type_id = 0; - create_attr.btf_value_type_id = 0; -@@ -5343,8 +5329,8 @@ static int init_map_in_map_slots(struct bpf_object *obj, struct bpf_map *map) - } - if (err) { - err = -errno; -- pr_warn("map '%s': failed to initialize slot [%d] to map '%s' fd=%d: %d\n", -- map->name, i, targ_map->name, fd, err); -+ pr_warn("map '%s': failed to initialize slot [%d] to map '%s' fd=%d: %s\n", -+ map->name, i, targ_map->name, fd, errstr(err)); - return err; - } - pr_debug("map '%s': slot [%d] set to map '%s' fd=%d\n", -@@ -5376,8 +5362,8 @@ static int init_prog_array_slots(struct bpf_object *obj, struct bpf_map *map) - err = bpf_map_update_elem(map->fd, &i, &fd, 0); - if (err) { - err = -errno; -- pr_warn("map '%s': failed to initialize slot [%d] to prog '%s' fd=%d: %d\n", -- map->name, i, targ_prog->name, fd, err); -+ pr_warn("map '%s': failed to initialize slot [%d] to prog '%s' fd=%d: %s\n", -+ map->name, i, targ_prog->name, fd, errstr(err)); - return err; - } - pr_debug("map '%s': slot [%d] set to prog '%s' fd=%d\n", -@@ -5430,7 +5416,6 @@ static int - bpf_object__create_maps(struct bpf_object *obj) - { - struct bpf_map *map; -- char *cp, errmsg[STRERR_BUFSIZE]; - unsigned int i, j; - int err; - bool retried; -@@ -5504,8 +5489,8 @@ bpf_object__create_maps(struct bpf_object *obj) - if (map->mmaped == MAP_FAILED) { - err = -errno; - map->mmaped = NULL; -- pr_warn("map '%s': failed to mmap arena: %d\n", -- map->name, err); -+ pr_warn("map '%s': failed to mmap arena: %s\n", -+ map->name, errstr(err)); - return err; - } - if (obj->arena_data) { -@@ -5527,8 +5512,8 @@ bpf_object__create_maps(struct bpf_object *obj) - retried = true; - goto retry; - } -- pr_warn("map '%s': failed to auto-pin at '%s': %d\n", -- map->name, map->pin_path, err); -+ pr_warn("map '%s': failed to auto-pin at '%s': %s\n", -+ map->name, map->pin_path, errstr(err)); - goto err_out; - } - } -@@ -5537,8 +5522,7 @@ bpf_object__create_maps(struct bpf_object *obj) - return 0; - - err_out: -- cp = libbpf_strerror_r(err, errmsg, sizeof(errmsg)); -- pr_warn("map '%s': failed to create: %s(%d)\n", map->name, cp, err); -+ pr_warn("map '%s': failed to create: %s\n", map->name, errstr(err)); - pr_perm_msg(err); - for (j = 0; j < i; j++) - zclose(obj->maps[j].fd); -@@ -5662,7 +5646,7 @@ static int load_module_btfs(struct bpf_object *obj) - } - if (err) { - err = -errno; -- pr_warn("failed to iterate BTF objects: %d\n", err); -+ pr_warn("failed to iterate BTF objects: %s\n", errstr(err)); - return err; - } - -@@ -5671,7 +5655,7 @@ static int load_module_btfs(struct bpf_object *obj) - if (errno == ENOENT) - continue; /* expected race: BTF was unloaded */ - err = -errno; -- pr_warn("failed to get BTF object #%d FD: %d\n", id, err); -+ pr_warn("failed to get BTF object #%d FD: %s\n", id, errstr(err)); - return err; - } - -@@ -5683,7 +5667,7 @@ static int load_module_btfs(struct bpf_object *obj) - err = bpf_btf_get_info_by_fd(fd, &info, &len); - if (err) { - err = -errno; -- pr_warn("failed to get BTF object #%d info: %d\n", id, err); -+ pr_warn("failed to get BTF object #%d info: %s\n", id, errstr(err)); - goto err_out; - } - -@@ -5696,8 +5680,8 @@ static int load_module_btfs(struct bpf_object *obj) - btf = btf_get_from_fd(fd, obj->btf_vmlinux); - err = libbpf_get_error(btf); - if (err) { -- pr_warn("failed to load module [%s]'s BTF object #%d: %d\n", -- name, id, err); -+ pr_warn("failed to load module [%s]'s BTF object #%d: %s\n", -+ name, id, errstr(err)); - goto err_out; - } - -@@ -5926,7 +5910,7 @@ bpf_object__relocate_core(struct bpf_object *obj, const char *targ_btf_path) - obj->btf_vmlinux_override = btf__parse(targ_btf_path, NULL); - err = libbpf_get_error(obj->btf_vmlinux_override); - if (err) { -- pr_warn("failed to parse target BTF: %d\n", err); -+ pr_warn("failed to parse target BTF: %s\n", errstr(err)); - return err; - } - } -@@ -5986,8 +5970,8 @@ bpf_object__relocate_core(struct bpf_object *obj, const char *targ_btf_path) - - err = record_relo_core(prog, rec, insn_idx); - if (err) { -- pr_warn("prog '%s': relo #%d: failed to record relocation: %d\n", -- prog->name, i, err); -+ pr_warn("prog '%s': relo #%d: failed to record relocation: %s\n", -+ prog->name, i, errstr(err)); - goto out; - } - -@@ -5996,15 +5980,15 @@ bpf_object__relocate_core(struct bpf_object *obj, const char *targ_btf_path) - - err = bpf_core_resolve_relo(prog, rec, i, obj->btf, cand_cache, &targ_res); - if (err) { -- pr_warn("prog '%s': relo #%d: failed to relocate: %d\n", -- prog->name, i, err); -+ pr_warn("prog '%s': relo #%d: failed to relocate: %s\n", -+ prog->name, i, errstr(err)); - goto out; - } - - err = bpf_core_patch_insn(prog->name, insn, insn_idx, rec, i, &targ_res); - if (err) { -- pr_warn("prog '%s': relo #%d: failed to patch insn #%u: %d\n", -- prog->name, i, insn_idx, err); -+ pr_warn("prog '%s': relo #%d: failed to patch insn #%u: %s\n", -+ prog->name, i, insn_idx, errstr(err)); - goto out; - } - } -@@ -6272,8 +6256,8 @@ reloc_prog_func_and_line_info(const struct bpf_object *obj, - &main_prog->func_info_rec_size); - if (err) { - if (err != -ENOENT) { -- pr_warn("prog '%s': error relocating .BTF.ext function info: %d\n", -- prog->name, err); -+ pr_warn("prog '%s': error relocating .BTF.ext function info: %s\n", -+ prog->name, errstr(err)); - return err; - } - if (main_prog->func_info) { -@@ -6300,8 +6284,8 @@ reloc_prog_func_and_line_info(const struct bpf_object *obj, - &main_prog->line_info_rec_size); - if (err) { - if (err != -ENOENT) { -- pr_warn("prog '%s': error relocating .BTF.ext line info: %d\n", -- prog->name, err); -+ pr_warn("prog '%s': error relocating .BTF.ext line info: %s\n", -+ prog->name, errstr(err)); - return err; - } - if (main_prog->line_info) { -@@ -7065,8 +7049,8 @@ static int bpf_object__relocate(struct bpf_object *obj, const char *targ_btf_pat - if (obj->btf_ext) { - err = bpf_object__relocate_core(obj, targ_btf_path); - if (err) { -- pr_warn("failed to perform CO-RE relocations: %d\n", -- err); -+ pr_warn("failed to perform CO-RE relocations: %s\n", -+ errstr(err)); - return err; - } - bpf_object__sort_relos(obj); -@@ -7110,8 +7094,8 @@ static int bpf_object__relocate(struct bpf_object *obj, const char *targ_btf_pat - - err = bpf_object__relocate_calls(obj, prog); - if (err) { -- pr_warn("prog '%s': failed to relocate calls: %d\n", -- prog->name, err); -+ pr_warn("prog '%s': failed to relocate calls: %s\n", -+ prog->name, errstr(err)); - return err; - } - -@@ -7147,16 +7131,16 @@ static int bpf_object__relocate(struct bpf_object *obj, const char *targ_btf_pat - /* Process data relos for main programs */ - err = bpf_object__relocate_data(obj, prog); - if (err) { -- pr_warn("prog '%s': failed to relocate data references: %d\n", -- prog->name, err); -+ pr_warn("prog '%s': failed to relocate data references: %s\n", -+ prog->name, errstr(err)); - return err; - } - - /* Fix up .BTF.ext information, if necessary */ - err = bpf_program_fixup_func_info(obj, prog); - if (err) { -- pr_warn("prog '%s': failed to perform .BTF.ext fix ups: %d\n", -- prog->name, err); -+ pr_warn("prog '%s': failed to perform .BTF.ext fix ups: %s\n", -+ prog->name, errstr(err)); - return err; - } - } -@@ -7465,7 +7449,6 @@ static int bpf_object_load_prog(struct bpf_object *obj, struct bpf_program *prog - { - LIBBPF_OPTS(bpf_prog_load_opts, load_attr); - const char *prog_name = NULL; -- char *cp, errmsg[STRERR_BUFSIZE]; - size_t log_buf_size = 0; - char *log_buf = NULL, *tmp; - bool own_log_buf = true; -@@ -7529,8 +7512,8 @@ static int bpf_object_load_prog(struct bpf_object *obj, struct bpf_program *prog - if (prog->sec_def && prog->sec_def->prog_prepare_load_fn) { - err = prog->sec_def->prog_prepare_load_fn(prog, &load_attr, prog->sec_def->cookie); - if (err < 0) { -- pr_warn("prog '%s': failed to prepare load attributes: %d\n", -- prog->name, err); -+ pr_warn("prog '%s': failed to prepare load attributes: %s\n", -+ prog->name, errstr(err)); - return err; - } - insns = prog->insns; -@@ -7594,9 +7577,8 @@ static int bpf_object_load_prog(struct bpf_object *obj, struct bpf_program *prog - continue; - - if (bpf_prog_bind_map(ret, map->fd, NULL)) { -- cp = libbpf_strerror_r(errno, errmsg, sizeof(errmsg)); - pr_warn("prog '%s': failed to bind map '%s': %s\n", -- prog->name, map->real_name, cp); -+ prog->name, map->real_name, errstr(errno)); - /* Don't fail hard if can't bind rodata. */ - } - } -@@ -7626,8 +7608,7 @@ static int bpf_object_load_prog(struct bpf_object *obj, struct bpf_program *prog - /* post-process verifier log to improve error descriptions */ - fixup_verifier_log(prog, log_buf, log_buf_size); - -- cp = libbpf_strerror_r(errno, errmsg, sizeof(errmsg)); -- pr_warn("prog '%s': BPF program load failed: %s\n", prog->name, cp); -+ pr_warn("prog '%s': BPF program load failed: %s\n", prog->name, errstr(errno)); - pr_perm_msg(ret); - - if (own_log_buf && log_buf && log_buf[0] != '\0') { -@@ -7920,7 +7901,7 @@ bpf_object__load_progs(struct bpf_object *obj, int log_level) - err = bpf_object_load_prog(obj, prog, prog->insns, prog->insns_cnt, - obj->license, obj->kern_version, &prog->fd); - if (err) { -- pr_warn("prog '%s': failed to load: %d\n", prog->name, err); -+ pr_warn("prog '%s': failed to load: %s\n", prog->name, errstr(err)); - return err; - } - } -@@ -7954,8 +7935,8 @@ static int bpf_object_init_progs(struct bpf_object *obj, const struct bpf_object - if (prog->sec_def->prog_setup_fn) { - err = prog->sec_def->prog_setup_fn(prog, prog->sec_def->cookie); - if (err < 0) { -- pr_warn("prog '%s': failed to initialize: %d\n", -- prog->name, err); -+ pr_warn("prog '%s': failed to initialize: %s\n", -+ prog->name, errstr(err)); - return err; - } - } -@@ -8145,7 +8126,7 @@ static int libbpf_kallsyms_parse(kallsyms_cb_t cb, void *ctx) - f = fopen("/proc/kallsyms", "re"); - if (!f) { - err = -errno; -- pr_warn("failed to open /proc/kallsyms: %d\n", err); -+ pr_warn("failed to open /proc/kallsyms: %s\n", errstr(err)); - return err; - } - -@@ -8622,7 +8603,6 @@ int bpf_object__load(struct bpf_object *obj) - - static int make_parent_dir(const char *path) - { -- char *cp, errmsg[STRERR_BUFSIZE]; - char *dname, *dir; - int err = 0; - -@@ -8636,15 +8616,13 @@ static int make_parent_dir(const char *path) - - free(dname); - if (err) { -- cp = libbpf_strerror_r(-err, errmsg, sizeof(errmsg)); -- pr_warn("failed to mkdir %s: %s\n", path, cp); -+ pr_warn("failed to mkdir %s: %s\n", path, errstr(err)); - } - return err; - } - - static int check_path(const char *path) - { -- char *cp, errmsg[STRERR_BUFSIZE]; - struct statfs st_fs; - char *dname, *dir; - int err = 0; -@@ -8658,8 +8636,7 @@ static int check_path(const char *path) - - dir = dirname(dname); - if (statfs(dir, &st_fs)) { -- cp = libbpf_strerror_r(errno, errmsg, sizeof(errmsg)); -- pr_warn("failed to statfs %s: %s\n", dir, cp); -+ pr_warn("failed to statfs %s: %s\n", dir, errstr(errno)); - err = -errno; - } - free(dname); -@@ -8674,7 +8651,6 @@ static int check_path(const char *path) - - int bpf_program__pin(struct bpf_program *prog, const char *path) - { -- char *cp, errmsg[STRERR_BUFSIZE]; - int err; - - if (prog->fd < 0) { -@@ -8692,8 +8668,7 @@ int bpf_program__pin(struct bpf_program *prog, const char *path) - - if (bpf_obj_pin(prog->fd, path)) { - err = -errno; -- cp = libbpf_strerror_r(err, errmsg, sizeof(errmsg)); -- pr_warn("prog '%s': failed to pin at '%s': %s\n", prog->name, path, cp); -+ pr_warn("prog '%s': failed to pin at '%s': %s\n", prog->name, path, errstr(err)); - return libbpf_err(err); - } - -@@ -8724,7 +8699,6 @@ int bpf_program__unpin(struct bpf_program *prog, const char *path) - - int bpf_map__pin(struct bpf_map *map, const char *path) - { -- char *cp, errmsg[STRERR_BUFSIZE]; - int err; - - if (map == NULL) { -@@ -8783,8 +8757,7 @@ int bpf_map__pin(struct bpf_map *map, const char *path) - return 0; - - out_err: -- cp = libbpf_strerror_r(-err, errmsg, sizeof(errmsg)); -- pr_warn("failed to pin map: %s\n", cp); -+ pr_warn("failed to pin map: %s\n", errstr(err)); - return libbpf_err(err); - } - -@@ -9972,8 +9945,8 @@ static int libbpf_find_prog_btf_id(const char *name, __u32 attach_prog_fd) - memset(&info, 0, info_len); - err = bpf_prog_get_info_by_fd(attach_prog_fd, &info, &info_len); - if (err) { -- pr_warn("failed bpf_prog_get_info_by_fd for FD %d: %d\n", -- attach_prog_fd, err); -+ pr_warn("failed bpf_prog_get_info_by_fd for FD %d: %s\n", -+ attach_prog_fd, errstr(err)); - return err; - } - -@@ -9985,7 +9958,7 @@ static int libbpf_find_prog_btf_id(const char *name, __u32 attach_prog_fd) - btf = btf__load_from_kernel_by_id(info.btf_id); - err = libbpf_get_error(btf); - if (err) { -- pr_warn("Failed to get BTF %d of the program: %d\n", info.btf_id, err); -+ pr_warn("Failed to get BTF %d of the program: %s\n", info.btf_id, errstr(err)); - goto out; - } - err = btf__find_by_name_kind(btf, name, BTF_KIND_FUNC); -@@ -10067,8 +10040,8 @@ static int libbpf_find_attach_btf_id(struct bpf_program *prog, const char *attac - } - err = libbpf_find_prog_btf_id(attach_name, attach_prog_fd); - if (err < 0) { -- pr_warn("prog '%s': failed to find BPF program (FD %d) BTF ID for '%s': %d\n", -- prog->name, attach_prog_fd, attach_name, err); -+ pr_warn("prog '%s': failed to find BPF program (FD %d) BTF ID for '%s': %s\n", -+ prog->name, attach_prog_fd, attach_name, errstr(err)); - return err; - } - *btf_obj_fd = 0; -@@ -10087,8 +10060,8 @@ static int libbpf_find_attach_btf_id(struct bpf_program *prog, const char *attac - btf_type_id); - } - if (err) { -- pr_warn("prog '%s': failed to find kernel BTF type ID of '%s': %d\n", -- prog->name, attach_name, err); -+ pr_warn("prog '%s': failed to find kernel BTF type ID of '%s': %s\n", -+ prog->name, attach_name, errstr(err)); - return err; - } - return 0; -@@ -10316,14 +10289,14 @@ int bpf_map__set_value_size(struct bpf_map *map, __u32 size) - mmap_new_sz = array_map_mmap_sz(size, map->def.max_entries); - err = bpf_map_mmap_resize(map, mmap_old_sz, mmap_new_sz); - if (err) { -- pr_warn("map '%s': failed to resize memory-mapped region: %d\n", -- bpf_map__name(map), err); -+ pr_warn("map '%s': failed to resize memory-mapped region: %s\n", -+ bpf_map__name(map), errstr(err)); - return err; - } - err = map_btf_datasec_resize(map, size); - if (err && err != -ENOENT) { -- pr_warn("map '%s': failed to adjust resized BTF, clearing BTF key/value info: %d\n", -- bpf_map__name(map), err); -+ pr_warn("map '%s': failed to adjust resized BTF, clearing BTF key/value info: %s\n", -+ bpf_map__name(map), errstr(err)); - map->btf_value_type_id = 0; - map->btf_key_type_id = 0; - } -@@ -10814,7 +10787,6 @@ static void bpf_link_perf_dealloc(struct bpf_link *link) - struct bpf_link *bpf_program__attach_perf_event_opts(const struct bpf_program *prog, int pfd, - const struct bpf_perf_event_opts *opts) - { -- char errmsg[STRERR_BUFSIZE]; - struct bpf_link_perf *link; - int prog_fd, link_fd = -1, err; - bool force_ioctl_attach; -@@ -10849,9 +10821,8 @@ struct bpf_link *bpf_program__attach_perf_event_opts(const struct bpf_program *p - link_fd = bpf_link_create(prog_fd, pfd, BPF_PERF_EVENT, &link_opts); - if (link_fd < 0) { - err = -errno; -- pr_warn("prog '%s': failed to create BPF link for perf_event FD %d: %d (%s)\n", -- prog->name, pfd, -- err, libbpf_strerror_r(err, errmsg, sizeof(errmsg))); -+ pr_warn("prog '%s': failed to create BPF link for perf_event FD %d: %s\n", -+ prog->name, pfd, errstr(err)); - goto err_out; - } - link->link.fd = link_fd; -@@ -10865,7 +10836,7 @@ struct bpf_link *bpf_program__attach_perf_event_opts(const struct bpf_program *p - if (ioctl(pfd, PERF_EVENT_IOC_SET_BPF, prog_fd) < 0) { - err = -errno; - pr_warn("prog '%s': failed to attach to perf_event FD %d: %s\n", -- prog->name, pfd, libbpf_strerror_r(err, errmsg, sizeof(errmsg))); -+ prog->name, pfd, errstr(err)); - if (err == -EPROTO) - pr_warn("prog '%s': try add PERF_SAMPLE_CALLCHAIN to or remove exclude_callchain_[kernel|user] from pfd %d\n", - prog->name, pfd); -@@ -10876,7 +10847,7 @@ struct bpf_link *bpf_program__attach_perf_event_opts(const struct bpf_program *p - if (ioctl(pfd, PERF_EVENT_IOC_ENABLE, 0) < 0) { - err = -errno; - pr_warn("prog '%s': failed to enable perf_event FD %d: %s\n", -- prog->name, pfd, libbpf_strerror_r(err, errmsg, sizeof(errmsg))); -+ prog->name, pfd, errstr(err)); - goto err_out; - } - -@@ -10900,22 +10871,19 @@ struct bpf_link *bpf_program__attach_perf_event(const struct bpf_program *prog, - */ - static int parse_uint_from_file(const char *file, const char *fmt) - { -- char buf[STRERR_BUFSIZE]; - int err, ret; - FILE *f; - - f = fopen(file, "re"); - if (!f) { - err = -errno; -- pr_debug("failed to open '%s': %s\n", file, -- libbpf_strerror_r(err, buf, sizeof(buf))); -+ pr_debug("failed to open '%s': %s\n", file, errstr(err)); - return err; - } - err = fscanf(f, fmt, &ret); - if (err != 1) { - err = err == EOF ? -EIO : -errno; -- pr_debug("failed to parse '%s': %s\n", file, -- libbpf_strerror_r(err, buf, sizeof(buf))); -+ pr_debug("failed to parse '%s': %s\n", file, errstr(err)); - fclose(f); - return err; - } -@@ -10959,7 +10927,6 @@ static int perf_event_open_probe(bool uprobe, bool retprobe, const char *name, - { - const size_t attr_sz = sizeof(struct perf_event_attr); - struct perf_event_attr attr; -- char errmsg[STRERR_BUFSIZE]; - int type, pfd; - - if ((__u64)ref_ctr_off >= (1ULL << PERF_UPROBE_REF_CTR_OFFSET_BITS)) -@@ -10972,7 +10939,7 @@ static int perf_event_open_probe(bool uprobe, bool retprobe, const char *name, - if (type < 0) { - pr_warn("failed to determine %s perf type: %s\n", - uprobe ? "uprobe" : "kprobe", -- libbpf_strerror_r(type, errmsg, sizeof(errmsg))); -+ errstr(type)); - return type; - } - if (retprobe) { -@@ -10982,7 +10949,7 @@ static int perf_event_open_probe(bool uprobe, bool retprobe, const char *name, - if (bit < 0) { - pr_warn("failed to determine %s retprobe bit: %s\n", - uprobe ? "uprobe" : "kprobe", -- libbpf_strerror_r(bit, errmsg, sizeof(errmsg))); -+ errstr(bit)); - return bit; - } - attr.config |= 1 << bit; -@@ -11111,14 +11078,13 @@ static int perf_event_kprobe_open_legacy(const char *probe_name, bool retprobe, - { - const size_t attr_sz = sizeof(struct perf_event_attr); - struct perf_event_attr attr; -- char errmsg[STRERR_BUFSIZE]; - int type, pfd, err; - - err = add_kprobe_event_legacy(probe_name, retprobe, kfunc_name, offset); - if (err < 0) { - pr_warn("failed to add legacy kprobe event for '%s+0x%zx': %s\n", - kfunc_name, offset, -- libbpf_strerror_r(err, errmsg, sizeof(errmsg))); -+ errstr(err)); - return err; - } - type = determine_kprobe_perf_type_legacy(probe_name, retprobe); -@@ -11126,7 +11092,7 @@ static int perf_event_kprobe_open_legacy(const char *probe_name, bool retprobe, - err = type; - pr_warn("failed to determine legacy kprobe event id for '%s+0x%zx': %s\n", - kfunc_name, offset, -- libbpf_strerror_r(err, errmsg, sizeof(errmsg))); -+ errstr(err)); - goto err_clean_legacy; - } - -@@ -11142,7 +11108,7 @@ static int perf_event_kprobe_open_legacy(const char *probe_name, bool retprobe, - if (pfd < 0) { - err = -errno; - pr_warn("legacy kprobe perf_event_open() failed: %s\n", -- libbpf_strerror_r(err, errmsg, sizeof(errmsg))); -+ errstr(err)); - goto err_clean_legacy; - } - return pfd; -@@ -11218,7 +11184,6 @@ bpf_program__attach_kprobe_opts(const struct bpf_program *prog, - { - DECLARE_LIBBPF_OPTS(bpf_perf_event_opts, pe_opts); - enum probe_attach_mode attach_mode; -- char errmsg[STRERR_BUFSIZE]; - char *legacy_probe = NULL; - struct bpf_link *link; - size_t offset; -@@ -11276,7 +11241,7 @@ bpf_program__attach_kprobe_opts(const struct bpf_program *prog, - pr_warn("prog '%s': failed to create %s '%s+0x%zx' perf event: %s\n", - prog->name, retprobe ? "kretprobe" : "kprobe", - func_name, offset, -- libbpf_strerror_r(err, errmsg, sizeof(errmsg))); -+ errstr(err)); - goto err_out; - } - link = bpf_program__attach_perf_event_opts(prog, pfd, &pe_opts); -@@ -11286,7 +11251,7 @@ bpf_program__attach_kprobe_opts(const struct bpf_program *prog, - pr_warn("prog '%s': failed to attach to %s '%s+0x%zx': %s\n", - prog->name, retprobe ? "kretprobe" : "kprobe", - func_name, offset, -- libbpf_strerror_r(err, errmsg, sizeof(errmsg))); -+ errstr(err)); - goto err_clean_legacy; - } - if (legacy) { -@@ -11422,7 +11387,7 @@ static int libbpf_available_kallsyms_parse(struct kprobe_multi_resolve *res) - f = fopen(available_functions_file, "re"); - if (!f) { - err = -errno; -- pr_warn("failed to open %s: %d\n", available_functions_file, err); -+ pr_warn("failed to open %s: %s\n", available_functions_file, errstr(err)); - return err; - } - -@@ -11497,7 +11462,7 @@ static int libbpf_available_kprobes_parse(struct kprobe_multi_resolve *res) - f = fopen(available_path, "re"); - if (!f) { - err = -errno; -- pr_warn("failed to open %s: %d\n", available_path, err); -+ pr_warn("failed to open %s: %s\n", available_path, errstr(err)); - return err; - } - -@@ -11543,7 +11508,6 @@ bpf_program__attach_kprobe_multi_opts(const struct bpf_program *prog, - }; - enum bpf_attach_type attach_type; - struct bpf_link *link = NULL; -- char errmsg[STRERR_BUFSIZE]; - const unsigned long *addrs; - int err, link_fd, prog_fd; - bool retprobe, session; -@@ -11611,7 +11575,7 @@ bpf_program__attach_kprobe_multi_opts(const struct bpf_program *prog, - if (link_fd < 0) { - err = -errno; - pr_warn("prog '%s': failed to attach: %s\n", -- prog->name, libbpf_strerror_r(err, errmsg, sizeof(errmsg))); -+ prog->name, errstr(err)); - goto error; - } - link->fd = link_fd; -@@ -11804,15 +11768,15 @@ static int perf_event_uprobe_open_legacy(const char *probe_name, bool retprobe, - - err = add_uprobe_event_legacy(probe_name, retprobe, binary_path, offset); - if (err < 0) { -- pr_warn("failed to add legacy uprobe event for %s:0x%zx: %d\n", -- binary_path, (size_t)offset, err); -+ pr_warn("failed to add legacy uprobe event for %s:0x%zx: %s\n", -+ binary_path, (size_t)offset, errstr(err)); - return err; - } - type = determine_uprobe_perf_type_legacy(probe_name, retprobe); - if (type < 0) { - err = type; -- pr_warn("failed to determine legacy uprobe event id for %s:0x%zx: %d\n", -- binary_path, offset, err); -+ pr_warn("failed to determine legacy uprobe event id for %s:0x%zx: %s\n", -+ binary_path, offset, errstr(err)); - goto err_clean_legacy; - } - -@@ -11827,7 +11791,7 @@ static int perf_event_uprobe_open_legacy(const char *probe_name, bool retprobe, - -1 /* group_fd */, PERF_FLAG_FD_CLOEXEC); - if (pfd < 0) { - err = -errno; -- pr_warn("legacy uprobe perf_event_open() failed: %d\n", err); -+ pr_warn("legacy uprobe perf_event_open() failed: %s\n", errstr(err)); - goto err_clean_legacy; - } - return pfd; -@@ -11992,7 +11956,6 @@ bpf_program__attach_uprobe_multi(const struct bpf_program *prog, - unsigned long *resolved_offsets = NULL; - int err = 0, link_fd, prog_fd; - struct bpf_link *link = NULL; -- char errmsg[STRERR_BUFSIZE]; - char full_path[PATH_MAX]; - const __u64 *cookies; - const char **syms; -@@ -12045,8 +12008,8 @@ bpf_program__attach_uprobe_multi(const struct bpf_program *prog, - if (!strchr(path, '/')) { - err = resolve_full_path(path, full_path, sizeof(full_path)); - if (err) { -- pr_warn("prog '%s': failed to resolve full path for '%s': %d\n", -- prog->name, path, err); -+ pr_warn("prog '%s': failed to resolve full path for '%s': %s\n", -+ prog->name, path, errstr(err)); - return libbpf_err_ptr(err); - } - path = full_path; -@@ -12087,7 +12050,7 @@ bpf_program__attach_uprobe_multi(const struct bpf_program *prog, - if (link_fd < 0) { - err = -errno; - pr_warn("prog '%s': failed to attach multi-uprobe: %s\n", -- prog->name, libbpf_strerror_r(err, errmsg, sizeof(errmsg))); -+ prog->name, errstr(err)); - goto error; - } - link->fd = link_fd; -@@ -12106,7 +12069,7 @@ bpf_program__attach_uprobe_opts(const struct bpf_program *prog, pid_t pid, - const struct bpf_uprobe_opts *opts) - { - const char *archive_path = NULL, *archive_sep = NULL; -- char errmsg[STRERR_BUFSIZE], *legacy_probe = NULL; -+ char *legacy_probe = NULL; - DECLARE_LIBBPF_OPTS(bpf_perf_event_opts, pe_opts); - enum probe_attach_mode attach_mode; - char full_path[PATH_MAX]; -@@ -12138,8 +12101,8 @@ bpf_program__attach_uprobe_opts(const struct bpf_program *prog, pid_t pid, - } else if (!strchr(binary_path, '/')) { - err = resolve_full_path(binary_path, full_path, sizeof(full_path)); - if (err) { -- pr_warn("prog '%s': failed to resolve full path for '%s': %d\n", -- prog->name, binary_path, err); -+ pr_warn("prog '%s': failed to resolve full path for '%s': %s\n", -+ prog->name, binary_path, errstr(err)); - return libbpf_err_ptr(err); - } - binary_path = full_path; -@@ -12206,7 +12169,7 @@ bpf_program__attach_uprobe_opts(const struct bpf_program *prog, pid_t pid, - pr_warn("prog '%s': failed to create %s '%s:0x%zx' perf event: %s\n", - prog->name, retprobe ? "uretprobe" : "uprobe", - binary_path, func_offset, -- libbpf_strerror_r(err, errmsg, sizeof(errmsg))); -+ errstr(err)); - goto err_out; - } - -@@ -12217,7 +12180,7 @@ bpf_program__attach_uprobe_opts(const struct bpf_program *prog, pid_t pid, - pr_warn("prog '%s': failed to attach to %s '%s:0x%zx': %s\n", - prog->name, retprobe ? "uretprobe" : "uprobe", - binary_path, func_offset, -- libbpf_strerror_r(err, errmsg, sizeof(errmsg))); -+ errstr(err)); - goto err_clean_legacy; - } - if (legacy) { -@@ -12338,8 +12301,8 @@ struct bpf_link *bpf_program__attach_usdt(const struct bpf_program *prog, - if (!strchr(binary_path, '/')) { - err = resolve_full_path(binary_path, resolved_path, sizeof(resolved_path)); - if (err) { -- pr_warn("prog '%s': failed to resolve full path for '%s': %d\n", -- prog->name, binary_path, err); -+ pr_warn("prog '%s': failed to resolve full path for '%s': %s\n", -+ prog->name, binary_path, errstr(err)); - return libbpf_err_ptr(err); - } - binary_path = resolved_path; -@@ -12417,14 +12380,13 @@ static int perf_event_open_tracepoint(const char *tp_category, - { - const size_t attr_sz = sizeof(struct perf_event_attr); - struct perf_event_attr attr; -- char errmsg[STRERR_BUFSIZE]; - int tp_id, pfd, err; - - tp_id = determine_tracepoint_id(tp_category, tp_name); - if (tp_id < 0) { - pr_warn("failed to determine tracepoint '%s/%s' perf event ID: %s\n", - tp_category, tp_name, -- libbpf_strerror_r(tp_id, errmsg, sizeof(errmsg))); -+ errstr(tp_id)); - return tp_id; - } - -@@ -12439,7 +12401,7 @@ static int perf_event_open_tracepoint(const char *tp_category, - err = -errno; - pr_warn("tracepoint '%s/%s' perf_event_open() failed: %s\n", - tp_category, tp_name, -- libbpf_strerror_r(err, errmsg, sizeof(errmsg))); -+ errstr(err)); - return err; - } - return pfd; -@@ -12451,7 +12413,6 @@ struct bpf_link *bpf_program__attach_tracepoint_opts(const struct bpf_program *p - const struct bpf_tracepoint_opts *opts) - { - DECLARE_LIBBPF_OPTS(bpf_perf_event_opts, pe_opts); -- char errmsg[STRERR_BUFSIZE]; - struct bpf_link *link; - int pfd, err; - -@@ -12464,7 +12425,7 @@ struct bpf_link *bpf_program__attach_tracepoint_opts(const struct bpf_program *p - if (pfd < 0) { - pr_warn("prog '%s': failed to create tracepoint '%s/%s' perf event: %s\n", - prog->name, tp_category, tp_name, -- libbpf_strerror_r(pfd, errmsg, sizeof(errmsg))); -+ errstr(pfd)); - return libbpf_err_ptr(pfd); - } - link = bpf_program__attach_perf_event_opts(prog, pfd, &pe_opts); -@@ -12473,7 +12434,7 @@ struct bpf_link *bpf_program__attach_tracepoint_opts(const struct bpf_program *p - close(pfd); - pr_warn("prog '%s': failed to attach to tracepoint '%s/%s': %s\n", - prog->name, tp_category, tp_name, -- libbpf_strerror_r(err, errmsg, sizeof(errmsg))); -+ errstr(err)); - return libbpf_err_ptr(err); - } - return link; -@@ -12524,7 +12485,6 @@ bpf_program__attach_raw_tracepoint_opts(const struct bpf_program *prog, - struct bpf_raw_tracepoint_opts *opts) - { - LIBBPF_OPTS(bpf_raw_tp_opts, raw_opts); -- char errmsg[STRERR_BUFSIZE]; - struct bpf_link *link; - int prog_fd, pfd; - -@@ -12549,7 +12509,7 @@ bpf_program__attach_raw_tracepoint_opts(const struct bpf_program *prog, - pfd = -errno; - free(link); - pr_warn("prog '%s': failed to attach to raw tracepoint '%s': %s\n", -- prog->name, tp_name, libbpf_strerror_r(pfd, errmsg, sizeof(errmsg))); -+ prog->name, tp_name, errstr(pfd)); - return libbpf_err_ptr(pfd); - } - link->fd = pfd; -@@ -12608,7 +12568,6 @@ static struct bpf_link *bpf_program__attach_btf_id(const struct bpf_program *pro - const struct bpf_trace_opts *opts) - { - LIBBPF_OPTS(bpf_link_create_opts, link_opts); -- char errmsg[STRERR_BUFSIZE]; - struct bpf_link *link; - int prog_fd, pfd; - -@@ -12633,7 +12592,7 @@ static struct bpf_link *bpf_program__attach_btf_id(const struct bpf_program *pro - pfd = -errno; - free(link); - pr_warn("prog '%s': failed to attach: %s\n", -- prog->name, libbpf_strerror_r(pfd, errmsg, sizeof(errmsg))); -+ prog->name, errstr(pfd)); - return libbpf_err_ptr(pfd); - } - link->fd = pfd; -@@ -12674,7 +12633,6 @@ bpf_program_attach_fd(const struct bpf_program *prog, - const struct bpf_link_create_opts *opts) - { - enum bpf_attach_type attach_type; -- char errmsg[STRERR_BUFSIZE]; - struct bpf_link *link; - int prog_fd, link_fd; - -@@ -12696,7 +12654,7 @@ bpf_program_attach_fd(const struct bpf_program *prog, - free(link); - pr_warn("prog '%s': failed to attach to %s: %s\n", - prog->name, target_name, -- libbpf_strerror_r(link_fd, errmsg, sizeof(errmsg))); -+ errstr(link_fd)); - return libbpf_err_ptr(link_fd); - } - link->fd = link_fd; -@@ -12838,7 +12796,6 @@ bpf_program__attach_iter(const struct bpf_program *prog, - const struct bpf_iter_attach_opts *opts) - { - DECLARE_LIBBPF_OPTS(bpf_link_create_opts, link_create_opts); -- char errmsg[STRERR_BUFSIZE]; - struct bpf_link *link; - int prog_fd, link_fd; - __u32 target_fd = 0; -@@ -12866,7 +12823,7 @@ bpf_program__attach_iter(const struct bpf_program *prog, - link_fd = -errno; - free(link); - pr_warn("prog '%s': failed to attach to iterator: %s\n", -- prog->name, libbpf_strerror_r(link_fd, errmsg, sizeof(errmsg))); -+ prog->name, errstr(link_fd)); - return libbpf_err_ptr(link_fd); - } - link->fd = link_fd; -@@ -12908,12 +12865,10 @@ struct bpf_link *bpf_program__attach_netfilter(const struct bpf_program *prog, - - link_fd = bpf_link_create(prog_fd, 0, BPF_NETFILTER, &lopts); - if (link_fd < 0) { -- char errmsg[STRERR_BUFSIZE]; -- - link_fd = -errno; - free(link); - pr_warn("prog '%s': failed to attach to netfilter: %s\n", -- prog->name, libbpf_strerror_r(link_fd, errmsg, sizeof(errmsg))); -+ prog->name, errstr(link_fd)); - return libbpf_err_ptr(link_fd); - } - link->fd = link_fd; -@@ -13198,7 +13153,6 @@ perf_buffer__open_cpu_buf(struct perf_buffer *pb, struct perf_event_attr *attr, - int cpu, int map_key) - { - struct perf_cpu_buf *cpu_buf; -- char msg[STRERR_BUFSIZE]; - int err; - - cpu_buf = calloc(1, sizeof(*cpu_buf)); -@@ -13214,7 +13168,7 @@ perf_buffer__open_cpu_buf(struct perf_buffer *pb, struct perf_event_attr *attr, - if (cpu_buf->fd < 0) { - err = -errno; - pr_warn("failed to open perf buffer event on cpu #%d: %s\n", -- cpu, libbpf_strerror_r(err, msg, sizeof(msg))); -+ cpu, errstr(err)); - goto error; - } - -@@ -13225,14 +13179,14 @@ perf_buffer__open_cpu_buf(struct perf_buffer *pb, struct perf_event_attr *attr, - cpu_buf->base = NULL; - err = -errno; - pr_warn("failed to mmap perf buffer on cpu #%d: %s\n", -- cpu, libbpf_strerror_r(err, msg, sizeof(msg))); -+ cpu, errstr(err)); - goto error; - } - - if (ioctl(cpu_buf->fd, PERF_EVENT_IOC_ENABLE, 0) < 0) { - err = -errno; - pr_warn("failed to enable perf buffer event on cpu #%d: %s\n", -- cpu, libbpf_strerror_r(err, msg, sizeof(msg))); -+ cpu, errstr(err)); - goto error; - } - -@@ -13307,7 +13261,6 @@ static struct perf_buffer *__perf_buffer__new(int map_fd, size_t page_cnt, - { - const char *online_cpus_file = "/sys/devices/system/cpu/online"; - struct bpf_map_info map; -- char msg[STRERR_BUFSIZE]; - struct perf_buffer *pb; - bool *online = NULL; - __u32 map_info_len; -@@ -13330,7 +13283,7 @@ static struct perf_buffer *__perf_buffer__new(int map_fd, size_t page_cnt, - */ - if (err != -EINVAL) { - pr_warn("failed to get map info for map FD %d: %s\n", -- map_fd, libbpf_strerror_r(err, msg, sizeof(msg))); -+ map_fd, errstr(err)); - return ERR_PTR(err); - } - pr_debug("failed to get map info for FD %d; API not supported? Ignoring...\n", -@@ -13360,7 +13313,7 @@ static struct perf_buffer *__perf_buffer__new(int map_fd, size_t page_cnt, - if (pb->epoll_fd < 0) { - err = -errno; - pr_warn("failed to create epoll instance: %s\n", -- libbpf_strerror_r(err, msg, sizeof(msg))); -+ errstr(err)); - goto error; - } - -@@ -13391,7 +13344,7 @@ static struct perf_buffer *__perf_buffer__new(int map_fd, size_t page_cnt, - - err = parse_cpu_mask_file(online_cpus_file, &online, &n); - if (err) { -- pr_warn("failed to get online CPU mask: %d\n", err); -+ pr_warn("failed to get online CPU mask: %s\n", errstr(err)); - goto error; - } - -@@ -13422,7 +13375,7 @@ static struct perf_buffer *__perf_buffer__new(int map_fd, size_t page_cnt, - err = -errno; - pr_warn("failed to set cpu #%d, key %d -> perf FD %d: %s\n", - cpu, map_key, cpu_buf->fd, -- libbpf_strerror_r(err, msg, sizeof(msg))); -+ errstr(err)); - goto error; - } - -@@ -13433,7 +13386,7 @@ static struct perf_buffer *__perf_buffer__new(int map_fd, size_t page_cnt, - err = -errno; - pr_warn("failed to epoll_ctl cpu #%d perf FD %d: %s\n", - cpu, cpu_buf->fd, -- libbpf_strerror_r(err, msg, sizeof(msg))); -+ errstr(err)); - goto error; - } - j++; -@@ -13528,7 +13481,7 @@ int perf_buffer__poll(struct perf_buffer *pb, int timeout_ms) - - err = perf_buffer__process_records(pb, cpu_buf); - if (err) { -- pr_warn("error while processing records: %d\n", err); -+ pr_warn("error while processing records: %s\n", errstr(err)); - return libbpf_err(err); - } - } -@@ -13612,7 +13565,8 @@ int perf_buffer__consume(struct perf_buffer *pb) - - err = perf_buffer__process_records(pb, cpu_buf); - if (err) { -- pr_warn("perf_buffer: failed to process records in buffer #%d: %d\n", i, err); -+ pr_warn("perf_buffer: failed to process records in buffer #%d: %s\n", -+ i, errstr(err)); - return libbpf_err(err); - } - } -@@ -13723,14 +13677,14 @@ int parse_cpu_mask_file(const char *fcpu, bool **mask, int *mask_sz) - fd = open(fcpu, O_RDONLY | O_CLOEXEC); - if (fd < 0) { - err = -errno; -- pr_warn("Failed to open cpu mask file %s: %d\n", fcpu, err); -+ pr_warn("Failed to open cpu mask file %s: %s\n", fcpu, errstr(err)); - return err; - } - len = read(fd, buf, sizeof(buf)); - close(fd); - if (len <= 0) { - err = len ? -errno : -EINVAL; -- pr_warn("Failed to read cpu mask from %s: %d\n", fcpu, err); -+ pr_warn("Failed to read cpu mask from %s: %s\n", fcpu, errstr(err)); - return err; - } - if (len >= sizeof(buf)) { -@@ -13822,20 +13776,21 @@ int bpf_object__open_skeleton(struct bpf_object_skeleton *s, - obj = bpf_object_open(NULL, s->data, s->data_sz, s->name, opts); - if (IS_ERR(obj)) { - err = PTR_ERR(obj); -- pr_warn("failed to initialize skeleton BPF object '%s': %d\n", s->name, err); -+ pr_warn("failed to initialize skeleton BPF object '%s': %s\n", -+ s->name, errstr(err)); - return libbpf_err(err); - } - - *s->obj = obj; - err = populate_skeleton_maps(obj, s->maps, s->map_cnt, s->map_skel_sz); - if (err) { -- pr_warn("failed to populate skeleton maps for '%s': %d\n", s->name, err); -+ pr_warn("failed to populate skeleton maps for '%s': %s\n", s->name, errstr(err)); - return libbpf_err(err); - } - - err = populate_skeleton_progs(obj, s->progs, s->prog_cnt, s->prog_skel_sz); - if (err) { -- pr_warn("failed to populate skeleton progs for '%s': %d\n", s->name, err); -+ pr_warn("failed to populate skeleton progs for '%s': %s\n", s->name, errstr(err)); - return libbpf_err(err); - } - -@@ -13865,13 +13820,13 @@ int bpf_object__open_subskeleton(struct bpf_object_subskeleton *s) - - err = populate_skeleton_maps(s->obj, s->maps, s->map_cnt, s->map_skel_sz); - if (err) { -- pr_warn("failed to populate subskeleton maps: %d\n", err); -+ pr_warn("failed to populate subskeleton maps: %s\n", errstr(err)); - return libbpf_err(err); - } - - err = populate_skeleton_progs(s->obj, s->progs, s->prog_cnt, s->prog_skel_sz); - if (err) { -- pr_warn("failed to populate subskeleton maps: %d\n", err); -+ pr_warn("failed to populate subskeleton maps: %s\n", errstr(err)); - return libbpf_err(err); - } - -@@ -13918,7 +13873,7 @@ int bpf_object__load_skeleton(struct bpf_object_skeleton *s) - - err = bpf_object__load(*s->obj); - if (err) { -- pr_warn("failed to load BPF skeleton '%s': %d\n", s->name, err); -+ pr_warn("failed to load BPF skeleton '%s': %s\n", s->name, errstr(err)); - return libbpf_err(err); - } - -@@ -13957,8 +13912,8 @@ int bpf_object__attach_skeleton(struct bpf_object_skeleton *s) - - err = prog->sec_def->prog_attach_fn(prog, prog->sec_def->cookie, link); - if (err) { -- pr_warn("prog '%s': failed to auto-attach: %d\n", -- bpf_program__name(prog), err); -+ pr_warn("prog '%s': failed to auto-attach: %s\n", -+ bpf_program__name(prog), errstr(err)); - return libbpf_err(err); - } - -@@ -14007,7 +13962,8 @@ int bpf_object__attach_skeleton(struct bpf_object_skeleton *s) - *link = bpf_map__attach_struct_ops(map); - if (!*link) { - err = -errno; -- pr_warn("map '%s': failed to auto-attach: %d\n", bpf_map__name(map), err); -+ pr_warn("map '%s': failed to auto-attach: %s\n", -+ bpf_map__name(map), errstr(err)); - return libbpf_err(err); - } - } --- -2.53.0 - diff --git a/queue-6.12/series b/queue-6.12/series index 52ec839c44..31cbb3b6c6 100644 --- a/queue-6.12/series +++ b/queue-6.12/series @@ -8,7 +8,6 @@ loop-fix-partition-scan-race-between-udev-and-loop_r.patch nilfs2-reject-zero-bd_oblocknr-in-nilfs_ioctl_mark_b.patch blk-cgroup-fix-disk-reference-leak-in-blkcg_maybe_th.patch pstore-ram-fix-resource-leak-when-ioremap-fails.patch -erofs-verify-metadata-accesses-for-file-backed-mount.patch md-wake-raid456-reshape-waiters-before-suspend.patch btrfs-pass-struct-btrfs_inode-to-clone_copy_inline_e.patch btrfs-fix-deadlock-between-reflink-and-transaction-c.patch @@ -350,9 +349,6 @@ bpf-sockmap-take-state-lock-for-af_unix-iter.patch bpf-fix-precedence-bug-in-convert_bpf_ld_abs-alignme.patch bpf-fix-null-deref-in-map_kptr_match_type-for-scalar.patch bpf-allow-utf-8-literals-in-bpf_bprintf_prepare.patch -libbpf-change-log-level-of-btf-loading-error-message.patch -libbpf-stringify-errno-in-log-messages-in-libbpf.c.patch -libbpf-prevent-double-close-and-leak-of-btf-objects.patch bpf-validate-node_id-in-arena_alloc_pages.patch bpf-arm32-reject-bpf-to-bpf-calls-and-callbacks-in-t.patch pinctrl-pinctrl-pic32-fix-resource-leak.patch diff --git a/queue-6.18/erofs-verify-metadata-accesses-for-file-backed-mount.patch b/queue-6.18/erofs-verify-metadata-accesses-for-file-backed-mount.patch deleted file mode 100644 index bd7642c483..0000000000 --- a/queue-6.18/erofs-verify-metadata-accesses-for-file-backed-mount.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 4952336f3c021fbcbf5e5048ffb063f6b51e19ca Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 30 Mar 2026 10:29:29 +0800 -Subject: erofs: verify metadata accesses for file-backed mounts - -From: Gao Xiang - -[ Upstream commit 307210c262a29f41d7177851295ea1703bd04175 ] - -For file-backed mounts, metadata is fetched via the page cache of -backing inodes to avoid double caching and redundant copy ops out -of RO uptodate folios, which is used by Android APEXes, ComposeFS, -containerd. However, rw_verify_area() was missing prior to -metadata accesses. - -Similar to vfs_iocb_iter_read(), fix this by: - - Enabling fanotify pre-content hooks on metadata accesses; - - security_file_permission() for security modules. - -Verified that fanotify pre-content hooks now works correctly. - -Fixes: fb176750266a ("erofs: add file-backed mount support") -Acked-by: Amir Goldstein -Reviewed-by: Chunhai Guo -Signed-off-by: Gao Xiang -Signed-off-by: Sasha Levin ---- - fs/erofs/data.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/fs/erofs/data.c b/fs/erofs/data.c -index 8ca29962a3dde..58aea2b48580c 100644 ---- a/fs/erofs/data.c -+++ b/fs/erofs/data.c -@@ -29,6 +29,20 @@ void *erofs_bread(struct erofs_buf *buf, erofs_off_t offset, bool need_kmap) - { - pgoff_t index = (buf->off + offset) >> PAGE_SHIFT; - struct folio *folio = NULL; -+ loff_t fpos; -+ int err; -+ -+ /* -+ * Metadata access for file-backed mounts reuses page cache of backing -+ * fs inodes (only folio data will be needed) to prevent double caching. -+ * However, the data access range must be verified here in advance. -+ */ -+ if (buf->file) { -+ fpos = index << PAGE_SHIFT; -+ err = rw_verify_area(READ, buf->file, &fpos, PAGE_SIZE); -+ if (err < 0) -+ return ERR_PTR(err); -+ } - - if (buf->page) { - folio = page_folio(buf->page); --- -2.53.0 - diff --git a/queue-6.18/riscv-misaligned-make-enabling-delegation-depend-on-nonportable.patch b/queue-6.18/riscv-misaligned-make-enabling-delegation-depend-on-nonportable.patch deleted file mode 100644 index d6e024ce33..0000000000 --- a/queue-6.18/riscv-misaligned-make-enabling-delegation-depend-on-nonportable.patch +++ /dev/null @@ -1,83 +0,0 @@ -From b69bcb13ed7024a84d6cd8ad330f1e32782fcf28 Mon Sep 17 00:00:00 2001 -From: Vivian Wang -Date: Wed, 1 Apr 2026 09:53:17 +0800 -Subject: riscv: misaligned: Make enabling delegation depend on NONPORTABLE - -From: Vivian Wang - -commit b69bcb13ed7024a84d6cd8ad330f1e32782fcf28 upstream. - -The unaligned access emulation code in Linux has various deficiencies. -For example, it doesn't emulate vector instructions [1] [2], and doesn't -emulate KVM guest accesses. Therefore, requesting misaligned exception -delegation with SBI FWFT actually regresses vector instructions' and KVM -guests' behavior. - -Until Linux can handle it properly, guard these sbi_fwft_set() calls -behind RISCV_SBI_FWFT_DELEGATE_MISALIGNED, which in turn depends on -NONPORTABLE. Those who are sure that this wouldn't be a problem can -enable this option, perhaps getting better performance. - -The rest of the existing code proceeds as before, except as if -SBI_FWFT_MISALIGNED_EXC_DELEG is not available, to handle any remaining -address misaligned exceptions on a best-effort basis. The KVM SBI FWFT -implementation is also not touched, but it is disabled if the firmware -emulates unaligned accesses. - -Cc: stable@vger.kernel.org -Fixes: cf5a8abc6560 ("riscv: misaligned: request misaligned exception from SBI") -Reported-by: Songsong Zhang # KVM -Link: https://lore.kernel.org/linux-riscv/38ce44c1-08cf-4e3f-8ade-20da224f529c@iscas.ac.cn/ [1] -Link: https://lore.kernel.org/linux-riscv/b3cfcdac-0337-4db0-a611-258f2868855f@iscas.ac.cn/ [2] -Signed-off-by: Vivian Wang -Acked-by: Conor Dooley -Link: https://patch.msgid.link/20260401-riscv-misaligned-dont-delegate-v2-1-5014a288c097@iscas.ac.cn -Signed-off-by: Paul Walmsley -Signed-off-by: Greg Kroah-Hartman ---- - arch/riscv/Kconfig | 22 ++++++++++++++++++++++ - arch/riscv/kernel/traps_misaligned.c | 2 +- - 2 files changed, 23 insertions(+), 1 deletion(-) - ---- a/arch/riscv/Kconfig -+++ b/arch/riscv/Kconfig -@@ -925,6 +925,28 @@ config RISCV_VECTOR_MISALIGNED - help - Enable detecting support for vector misaligned loads and stores. - -+config RISCV_SBI_FWFT_DELEGATE_MISALIGNED -+ bool "Request firmware delegation of unaligned access exceptions" -+ depends on RISCV_SBI -+ depends on NONPORTABLE -+ help -+ Use SBI FWFT to request delegation of load address misaligned and -+ store address misaligned exceptions, if possible, and prefer Linux -+ kernel emulation of these accesses to firmware emulation. -+ -+ Unfortunately, Linux's emulation is still incomplete. Namely, it -+ currently does not handle vector instructions and KVM guest accesses. -+ On platforms where these accesses would have been handled by firmware, -+ enabling this causes unexpected kernel oopses, userspaces crashes and -+ KVM guest crashes. If you are sure that these are not a problem for -+ your platform, you can say Y here, which may improve performance. -+ -+ Saying N here will not worsen emulation support for unaligned accesses -+ even in the case where the firmware also has incomplete support. It -+ simply keeps the firmware's emulation enabled. -+ -+ If you don't know what to do here, say N. -+ - choice - prompt "Unaligned Accesses Support" - default RISCV_PROBE_UNALIGNED_ACCESS ---- a/arch/riscv/kernel/traps_misaligned.c -+++ b/arch/riscv/kernel/traps_misaligned.c -@@ -584,7 +584,7 @@ static int cpu_online_check_unaligned_ac - - static bool misaligned_traps_delegated; - --#ifdef CONFIG_RISCV_SBI -+#if defined(CONFIG_RISCV_SBI_FWFT_DELEGATE_MISALIGNED) - - static int cpu_online_sbi_unaligned_setup(unsigned int cpu) - { diff --git a/queue-6.18/sched-make-class_schedulers-avoid-pushing-current-an.patch b/queue-6.18/sched-make-class_schedulers-avoid-pushing-current-an.patch deleted file mode 100644 index f7ed2c8ee5..0000000000 --- a/queue-6.18/sched-make-class_schedulers-avoid-pushing-current-an.patch +++ /dev/null @@ -1,168 +0,0 @@ -From c4721619d11ce9d44666656128aeea4b0a780cf1 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 24 Mar 2026 19:13:16 +0000 -Subject: sched: Make class_schedulers avoid pushing current, and get rid of - proxy_tag_curr() - -From: John Stultz - -[ Upstream commit e0ca8991b2de6c9dfe6fcd8a0364951b2bd56797 ] - -With proxy-execution, the scheduler selects the donor, but for -blocked donors, we end up running the lock owner. - -This caused some complexity, because the class schedulers make -sure to remove the task they pick from their pushable task -lists, which prevents the donor from being migrated, but there -wasn't then anything to prevent rq->curr from being migrated -if rq->curr != rq->donor. - -This was sort of hacked around by calling proxy_tag_curr() on -the rq->curr task if we were running something other then the -donor. proxy_tag_curr() did a dequeue/enqueue pair on the -rq->curr task, allowing the class schedulers to remove it from -their pushable list. - -The dequeue/enqueue pair was wasteful, and additonally K Prateek -highlighted that we didn't properly undo things when we stopped -proxying, leaving the lock owner off the pushable list. - -After some alternative approaches were considered, Peter -suggested just having the RT/DL classes just avoid migrating -when task_on_cpu(). - -So rework pick_next_pushable_dl_task() and the rt -pick_next_pushable_task() functions so that they skip over the -first pushable task if it is on_cpu. - -Then just drop all of the proxy_tag_curr() logic. - -Fixes: be39617e38e0 ("sched: Fix proxy/current (push,pull)ability") -Closes: https://lore.kernel.org/lkml/e735cae0-2cc9-4bae-b761-fcb082ed3e94@amd.com/ -Reported-by: K Prateek Nayak -Suggested-by: Peter Zijlstra -Signed-off-by: John Stultz -Signed-off-by: Peter Zijlstra (Intel) -Link: https://patch.msgid.link/20260324191337.1841376-2-jstultz@google.com -Signed-off-by: Sasha Levin ---- - kernel/sched/core.c | 24 ------------------------ - kernel/sched/deadline.c | 18 ++++++++++++++++-- - kernel/sched/rt.c | 15 ++++++++++++--- - 3 files changed, 28 insertions(+), 29 deletions(-) - -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index 421efba7db5a1..522d4bad56ad1 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -6730,23 +6730,6 @@ find_proxy_task(struct rq *rq, struct task_struct *donor, struct rq_flags *rf) - } - #endif /* SCHED_PROXY_EXEC */ - --static inline void proxy_tag_curr(struct rq *rq, struct task_struct *owner) --{ -- if (!sched_proxy_exec()) -- return; -- /* -- * pick_next_task() calls set_next_task() on the chosen task -- * at some point, which ensures it is not push/pullable. -- * However, the chosen/donor task *and* the mutex owner form an -- * atomic pair wrt push/pull. -- * -- * Make sure owner we run is not pushable. Unfortunately we can -- * only deal with that by means of a dequeue/enqueue cycle. :-/ -- */ -- dequeue_task(rq, owner, DEQUEUE_NOCLOCK | DEQUEUE_SAVE); -- enqueue_task(rq, owner, ENQUEUE_NOCLOCK | ENQUEUE_RESTORE); --} -- - /* - * __schedule() is the main scheduler function. - * -@@ -6896,9 +6879,6 @@ static void __sched notrace __schedule(int sched_mode) - */ - RCU_INIT_POINTER(rq->curr, next); - -- if (!task_current_donor(rq, next)) -- proxy_tag_curr(rq, next); -- - /* - * The membarrier system call requires each architecture - * to have a full memory barrier after updating -@@ -6933,10 +6913,6 @@ static void __sched notrace __schedule(int sched_mode) - /* Also unlocks the rq: */ - rq = context_switch(rq, prev, next, &rf); - } else { -- /* In case next was already curr but just got blocked_donor */ -- if (!task_current_donor(rq, next)) -- proxy_tag_curr(rq, next); -- - rq_unpin_lock(rq, &rf); - __balance_callbacks(rq); - raw_spin_rq_unlock_irq(rq); -diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c -index d5052f238adf7..ed96b86dec04d 100644 ---- a/kernel/sched/deadline.c -+++ b/kernel/sched/deadline.c -@@ -2761,12 +2761,26 @@ static int find_later_rq(struct task_struct *task) - - static struct task_struct *pick_next_pushable_dl_task(struct rq *rq) - { -- struct task_struct *p; -+ struct task_struct *i, *p = NULL; -+ struct rb_node *next_node; - - if (!has_pushable_dl_tasks(rq)) - return NULL; - -- p = __node_2_pdl(rb_first_cached(&rq->dl.pushable_dl_tasks_root)); -+ next_node = rb_first_cached(&rq->dl.pushable_dl_tasks_root); -+ while (next_node) { -+ i = __node_2_pdl(next_node); -+ /* make sure task isn't on_cpu (possible with proxy-exec) */ -+ if (!task_on_cpu(rq, i)) { -+ p = i; -+ break; -+ } -+ -+ next_node = rb_next(next_node); -+ } -+ -+ if (!p) -+ return NULL; - - WARN_ON_ONCE(rq->cpu != task_cpu(p)); - WARN_ON_ONCE(task_current(rq, p)); -diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c -index a892a01c463e5..8cead8f37aa50 100644 ---- a/kernel/sched/rt.c -+++ b/kernel/sched/rt.c -@@ -1847,13 +1847,22 @@ static int find_lowest_rq(struct task_struct *task) - - static struct task_struct *pick_next_pushable_task(struct rq *rq) - { -- struct task_struct *p; -+ struct plist_head *head = &rq->rt.pushable_tasks; -+ struct task_struct *i, *p = NULL; - - if (!has_pushable_tasks(rq)) - return NULL; - -- p = plist_first_entry(&rq->rt.pushable_tasks, -- struct task_struct, pushable_tasks); -+ plist_for_each_entry(i, head, pushable_tasks) { -+ /* make sure task isn't on_cpu (possible with proxy-exec) */ -+ if (!task_on_cpu(rq, i)) { -+ p = i; -+ break; -+ } -+ } -+ -+ if (!p) -+ return NULL; - - BUG_ON(rq->cpu != task_cpu(p)); - BUG_ON(task_current(rq, p)); --- -2.53.0 - diff --git a/queue-6.18/series b/queue-6.18/series index 2d399e71e0..e763166792 100644 --- a/queue-6.18/series +++ b/queue-6.18/series @@ -7,7 +7,6 @@ loop-fix-partition-scan-race-between-udev-and-loop_r.patch nilfs2-reject-zero-bd_oblocknr-in-nilfs_ioctl_mark_b.patch blk-cgroup-fix-disk-reference-leak-in-blkcg_maybe_th.patch pstore-ram-fix-resource-leak-when-ioremap-fails.patch -erofs-verify-metadata-accesses-for-file-backed-mount.patch erofs-include-the-trailing-nul-in-fs_ioc_getfslabel.patch md-fix-array_state-clear-sysfs-deadlock.patch erofs-handle-48-bit-blocks-uniaddr-for-extra-devices.patch @@ -49,7 +48,6 @@ asoc-intel-avs-check-maximum-valid-cpuid-leaf.patch asoc-intel-avs-include-cpuid-header-at-file-scope.patch x86-vdso-clean-up-remnants-of-vdso32_note_mask.patch firmware-dmi-correct-an-indexing-error-in-dmi.h.patch -sched-make-class_schedulers-avoid-pushing-current-an.patch sched-rt-skip-group-schedulable-check-with-rt_group_.patch wifi-mwifiex-fix-memory-leak-in-mwifiex_11n_aggregat.patch wifi-rtlwifi-pci-fix-possible-use-after-free-caused-.patch @@ -921,7 +919,6 @@ iommu-amd-bounds-check-devid-in-__rlookup_amd_iommu.patch x86-kexec-push-kjump-return-address-even-for-non-kjump-kexec.patch xfs-fix-memory-leak-on-error-in-xfs_alloc_zone_info.patch virt-sev-guest-do-not-use-host-controlled-page-order-in-cleanup-path.patch -riscv-misaligned-make-enabling-delegation-depend-on-nonportable.patch powerpc-warp-fix-error-handling-in-pika_dtm_thread.patch netfs-fix-error-handling-in-netfs_extract_user_iter.patch nfsd-fix-file-change-detection-in-cb_getattr.patch diff --git a/queue-6.6/perf-tools-fix-module-symbol-resolution-for-non-zero.patch b/queue-6.6/perf-tools-fix-module-symbol-resolution-for-non-zero.patch deleted file mode 100644 index 7b4900ff8e..0000000000 --- a/queue-6.6/perf-tools-fix-module-symbol-resolution-for-non-zero.patch +++ /dev/null @@ -1,77 +0,0 @@ -From fb5fe2890eed850e0aa2f5fd1b203e3a7b5a6568 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 23 Mar 2026 11:58:04 -0400 -Subject: perf tools: Fix module symbol resolution for non-zero .text sh_addr - -From: Chuck Lever - -[ Upstream commit 9a82bfde4775b7a87cd1a7e791f46f83ae442848 ] - -When perf resolves symbols from kernel module ELF files (ET_REL), -it converts symbol addresses to file offsets so that sample IPs -can be matched to the correct symbol. The conversion adjusts each -symbol's st_value: - - sym->st_value -= shdr->sh_addr - shdr->sh_offset; - -For vmlinux (ET_EXEC), st_value is a virtual address and sh_addr -is the section's virtual base, so subtracting sh_addr and adding -sh_offset correctly yields a file offset. - -For kernel modules (ET_REL), st_value is a section-relative -offset. The module loader ignores sh_addr entirely and places -symbols at module_base + st_value. Converting to file offset -requires only adding sh_offset; subtracting sh_addr introduces an -error equal to sh_addr bytes. - -When .text has sh_addr == 0 -- the historical norm for simple -modules -- both formulas produce the same result and the bug is -latent. As modules gain more metadata sections before .text (.note, -.static_call.text, etc.), the linker assigns .text a non-zero -sh_addr, exposing the defect. For example, nfsd.ko on this kernel -has sh_addr=0xa80, kvm-intel.ko has sh_addr=0x1e90. - -The effect is that all .text symbols in affected modules -shift by sh_addr bytes relative to sample IPs, causing perf -report to attribute samples to incorrect, nearby symbols. This -was observed as 13% of LLC-load-miss samples misattributed -to nfsd_file_get_dio_attrs when the actual hot function was -nfsd_cache_lookup, approximately 0xa80 bytes away in the symbol -table. - -Use the existing dso__rel() flag (already set for ET_REL modules) -to select the correct adjustment: add sh_offset for ET_REL, -subtract (sh_addr - sh_offset) for ET_EXEC/ET_DYN. - -Fixes: 0131c4ec794a ("perf tools: Make it possible to read object code from kernel modules") -Signed-off-by: Chuck Lever -Reviewed-by: Ian Rogers -Tested-by: Thomas Richter -Signed-off-by: Namhyung Kim -Signed-off-by: Sasha Levin ---- - tools/perf/util/symbol-elf.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c -index 95e99c332d7e3..af610cb00a987 100644 ---- a/tools/perf/util/symbol-elf.c -+++ b/tools/perf/util/symbol-elf.c -@@ -1375,8 +1375,12 @@ static int dso__process_kernel_symbol(struct dso *dso, struct map *map, - char dso_name[PATH_MAX]; - - /* Adjust symbol to map to file offset */ -- if (adjust_kernel_syms) -- sym->st_value -= shdr->sh_addr - shdr->sh_offset; -+ if (adjust_kernel_syms) { -+ if (dso__rel(dso)) -+ sym->st_value += shdr->sh_offset; -+ else -+ sym->st_value -= shdr->sh_addr - shdr->sh_offset; -+ } - - if (strcmp(section_name, (curr_dso->short_name + dso->short_name_len)) == 0) - return 0; --- -2.53.0 - diff --git a/queue-6.6/series b/queue-6.6/series index 446a6f32b5..14693c2d7a 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -249,7 +249,6 @@ perf-branch-avoid-incrementing-null.patch perf-tools-cs-etm-fix-print-issue-for-coresight-debu.patch pinctrl-abx500-fix-type-of-argument-variable.patch perf-lock-fix-option-value-type-in-parse_max_stack.patch -perf-tools-fix-module-symbol-resolution-for-non-zero.patch perf-expr-return-einval-for-syntax-error-in-expr__fi.patch ipmi-ssif_bmc-fix-missing-check-for-copy_to_user-par.patch ipmi-ssif_bmc-fix-message-desynchronization-after-tr.patch diff --git a/queue-7.0/erofs-verify-metadata-accesses-for-file-backed-mount.patch b/queue-7.0/erofs-verify-metadata-accesses-for-file-backed-mount.patch deleted file mode 100644 index 4a92cb42f6..0000000000 --- a/queue-7.0/erofs-verify-metadata-accesses-for-file-backed-mount.patch +++ /dev/null @@ -1,58 +0,0 @@ -From fee0f37add6b4bb59803345f96ec3c1ede584d0e Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 30 Mar 2026 10:29:29 +0800 -Subject: erofs: verify metadata accesses for file-backed mounts - -From: Gao Xiang - -[ Upstream commit 307210c262a29f41d7177851295ea1703bd04175 ] - -For file-backed mounts, metadata is fetched via the page cache of -backing inodes to avoid double caching and redundant copy ops out -of RO uptodate folios, which is used by Android APEXes, ComposeFS, -containerd. However, rw_verify_area() was missing prior to -metadata accesses. - -Similar to vfs_iocb_iter_read(), fix this by: - - Enabling fanotify pre-content hooks on metadata accesses; - - security_file_permission() for security modules. - -Verified that fanotify pre-content hooks now works correctly. - -Fixes: fb176750266a ("erofs: add file-backed mount support") -Acked-by: Amir Goldstein -Reviewed-by: Chunhai Guo -Signed-off-by: Gao Xiang -Signed-off-by: Sasha Levin ---- - fs/erofs/data.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/fs/erofs/data.c b/fs/erofs/data.c -index f79ee80627d95..132a27deb2f3b 100644 ---- a/fs/erofs/data.c -+++ b/fs/erofs/data.c -@@ -30,6 +30,20 @@ void *erofs_bread(struct erofs_buf *buf, erofs_off_t offset, bool need_kmap) - { - pgoff_t index = (buf->off + offset) >> PAGE_SHIFT; - struct folio *folio = NULL; -+ loff_t fpos; -+ int err; -+ -+ /* -+ * Metadata access for file-backed mounts reuses page cache of backing -+ * fs inodes (only folio data will be needed) to prevent double caching. -+ * However, the data access range must be verified here in advance. -+ */ -+ if (buf->file) { -+ fpos = index << PAGE_SHIFT; -+ err = rw_verify_area(READ, buf->file, &fpos, PAGE_SIZE); -+ if (err < 0) -+ return ERR_PTR(err); -+ } - - if (buf->page) { - folio = page_folio(buf->page); --- -2.53.0 - diff --git a/queue-7.0/riscv-misaligned-make-enabling-delegation-depend-on-nonportable.patch b/queue-7.0/riscv-misaligned-make-enabling-delegation-depend-on-nonportable.patch deleted file mode 100644 index e712c38226..0000000000 --- a/queue-7.0/riscv-misaligned-make-enabling-delegation-depend-on-nonportable.patch +++ /dev/null @@ -1,83 +0,0 @@ -From b69bcb13ed7024a84d6cd8ad330f1e32782fcf28 Mon Sep 17 00:00:00 2001 -From: Vivian Wang -Date: Wed, 1 Apr 2026 09:53:17 +0800 -Subject: riscv: misaligned: Make enabling delegation depend on NONPORTABLE - -From: Vivian Wang - -commit b69bcb13ed7024a84d6cd8ad330f1e32782fcf28 upstream. - -The unaligned access emulation code in Linux has various deficiencies. -For example, it doesn't emulate vector instructions [1] [2], and doesn't -emulate KVM guest accesses. Therefore, requesting misaligned exception -delegation with SBI FWFT actually regresses vector instructions' and KVM -guests' behavior. - -Until Linux can handle it properly, guard these sbi_fwft_set() calls -behind RISCV_SBI_FWFT_DELEGATE_MISALIGNED, which in turn depends on -NONPORTABLE. Those who are sure that this wouldn't be a problem can -enable this option, perhaps getting better performance. - -The rest of the existing code proceeds as before, except as if -SBI_FWFT_MISALIGNED_EXC_DELEG is not available, to handle any remaining -address misaligned exceptions on a best-effort basis. The KVM SBI FWFT -implementation is also not touched, but it is disabled if the firmware -emulates unaligned accesses. - -Cc: stable@vger.kernel.org -Fixes: cf5a8abc6560 ("riscv: misaligned: request misaligned exception from SBI") -Reported-by: Songsong Zhang # KVM -Link: https://lore.kernel.org/linux-riscv/38ce44c1-08cf-4e3f-8ade-20da224f529c@iscas.ac.cn/ [1] -Link: https://lore.kernel.org/linux-riscv/b3cfcdac-0337-4db0-a611-258f2868855f@iscas.ac.cn/ [2] -Signed-off-by: Vivian Wang -Acked-by: Conor Dooley -Link: https://patch.msgid.link/20260401-riscv-misaligned-dont-delegate-v2-1-5014a288c097@iscas.ac.cn -Signed-off-by: Paul Walmsley -Signed-off-by: Greg Kroah-Hartman ---- - arch/riscv/Kconfig | 22 ++++++++++++++++++++++ - arch/riscv/kernel/traps_misaligned.c | 2 +- - 2 files changed, 23 insertions(+), 1 deletion(-) - ---- a/arch/riscv/Kconfig -+++ b/arch/riscv/Kconfig -@@ -941,6 +941,28 @@ config RISCV_VECTOR_MISALIGNED - help - Enable detecting support for vector misaligned loads and stores. - -+config RISCV_SBI_FWFT_DELEGATE_MISALIGNED -+ bool "Request firmware delegation of unaligned access exceptions" -+ depends on RISCV_SBI -+ depends on NONPORTABLE -+ help -+ Use SBI FWFT to request delegation of load address misaligned and -+ store address misaligned exceptions, if possible, and prefer Linux -+ kernel emulation of these accesses to firmware emulation. -+ -+ Unfortunately, Linux's emulation is still incomplete. Namely, it -+ currently does not handle vector instructions and KVM guest accesses. -+ On platforms where these accesses would have been handled by firmware, -+ enabling this causes unexpected kernel oopses, userspaces crashes and -+ KVM guest crashes. If you are sure that these are not a problem for -+ your platform, you can say Y here, which may improve performance. -+ -+ Saying N here will not worsen emulation support for unaligned accesses -+ even in the case where the firmware also has incomplete support. It -+ simply keeps the firmware's emulation enabled. -+ -+ If you don't know what to do here, say N. -+ - choice - prompt "Unaligned Accesses Support" - default RISCV_PROBE_UNALIGNED_ACCESS ---- a/arch/riscv/kernel/traps_misaligned.c -+++ b/arch/riscv/kernel/traps_misaligned.c -@@ -584,7 +584,7 @@ static int cpu_online_check_unaligned_ac - - static bool misaligned_traps_delegated; - --#ifdef CONFIG_RISCV_SBI -+#if defined(CONFIG_RISCV_SBI_FWFT_DELEGATE_MISALIGNED) - - static int cpu_online_sbi_unaligned_setup(unsigned int cpu) - { diff --git a/queue-7.0/rtla-simplify-code-by-caching-string-lengths.patch b/queue-7.0/rtla-simplify-code-by-caching-string-lengths.patch deleted file mode 100644 index 4d12254813..0000000000 --- a/queue-7.0/rtla-simplify-code-by-caching-string-lengths.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 389d7f550574749241aced00303e751df67b1f5e Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 9 Mar 2026 16:46:19 -0300 -Subject: rtla: Simplify code by caching string lengths - -From: Wander Lairson Costa - -[ Upstream commit f79720e25b793691dcc46e1f1cd64d01578075c2 ] - -Simplify trace_event_save_hist() and set_comm_cgroup() by computing -string lengths once and storing them in local variables, rather than -calling strlen() multiple times on the same unchanged strings. This -makes the code clearer by eliminating redundant function calls and -improving readability. - -In trace_event_save_hist(), the write loop previously called strlen() -on the hist buffer twice per iteration for both the size calculation -and loop condition. Store the length in hist_len before entering the -loop. In set_comm_cgroup(), strlen() was called on cgroup_path up to -three times in succession. Store the result in cg_path_len to use in -both the offset calculation and size parameter for subsequent append -operations. - -This simplification makes the code easier to read and maintain without -changing program behavior. - -Signed-off-by: Wander Lairson Costa -Link: https://lore.kernel.org/r/20260309195040.1019085-7-wander@redhat.com -Signed-off-by: Tomas Glozar -Stable-dep-of: 4bf4ef5292b9 ("rtla/trace: Fix write loop in trace_event_save_hist()") -Signed-off-by: Sasha Levin ---- - tools/tracing/rtla/src/trace.c | 6 ++++-- - tools/tracing/rtla/src/utils.c | 11 +++++++---- - 2 files changed, 11 insertions(+), 6 deletions(-) - -diff --git a/tools/tracing/rtla/src/trace.c b/tools/tracing/rtla/src/trace.c -index b8be3e28680ee..073ec1b567798 100644 ---- a/tools/tracing/rtla/src/trace.c -+++ b/tools/tracing/rtla/src/trace.c -@@ -362,6 +362,7 @@ static void trace_event_save_hist(struct trace_instance *instance, - mode_t mode = 0644; - char path[1024]; - char *hist; -+ size_t hist_len; - - if (!tevent) - return; -@@ -392,9 +393,10 @@ static void trace_event_save_hist(struct trace_instance *instance, - } - - index = 0; -+ hist_len = strlen(hist); - do { -- index += write(out_fd, &hist[index], strlen(hist) - index); -- } while (index < strlen(hist)); -+ index += write(out_fd, &hist[index], hist_len - index); -+ } while (index < hist_len); - - free(hist); - out_close: -diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c -index 0da3b2470c317..fb067220566a4 100644 ---- a/tools/tracing/rtla/src/utils.c -+++ b/tools/tracing/rtla/src/utils.c -@@ -809,6 +809,7 @@ static int open_cgroup_procs(const char *cgroup) - char cgroup_procs[MAX_PATH]; - int retval; - int cg_fd; -+ size_t cg_path_len; - - retval = find_mount("cgroup2", cgroup_path, sizeof(cgroup_path)); - if (!retval) { -@@ -816,16 +817,18 @@ static int open_cgroup_procs(const char *cgroup) - return -1; - } - -+ cg_path_len = strlen(cgroup_path); -+ - if (!cgroup) { -- retval = get_self_cgroup(&cgroup_path[strlen(cgroup_path)], -- sizeof(cgroup_path) - strlen(cgroup_path)); -+ retval = get_self_cgroup(&cgroup_path[cg_path_len], -+ sizeof(cgroup_path) - cg_path_len); - if (!retval) { - err_msg("Did not find self cgroup\n"); - return -1; - } - } else { -- snprintf(&cgroup_path[strlen(cgroup_path)], -- sizeof(cgroup_path) - strlen(cgroup_path), "%s/", cgroup); -+ snprintf(&cgroup_path[cg_path_len], -+ sizeof(cgroup_path) - cg_path_len, "%s/", cgroup); - } - - snprintf(cgroup_procs, MAX_PATH, "%s/cgroup.procs", cgroup_path); --- -2.53.0 - diff --git a/queue-7.0/rtla-trace-fix-write-loop-in-trace_event_save_hist.patch b/queue-7.0/rtla-trace-fix-write-loop-in-trace_event_save_hist.patch deleted file mode 100644 index 2f0c627bb5..0000000000 --- a/queue-7.0/rtla-trace-fix-write-loop-in-trace_event_save_hist.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 2514d31a3293473bd21eee23a919b02957d84019 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 9 Mar 2026 16:46:28 -0300 -Subject: rtla/trace: Fix write loop in trace_event_save_hist() - -From: Wander Lairson Costa - -[ Upstream commit 4bf4ef5292b9253d8607c61a875d9f6b14129976 ] - -The write loop in trace_event_save_hist() does not correctly handle -errors from the write() system call. If write() returns -1, this value -is added to the loop index, leading to an incorrect memory access on -the next iteration and potentially an infinite loop. The loop also -fails to handle EINTR. - -Fix the write loop by introducing proper error handling. The return -value of write() is now stored in a ssize_t variable and checked for -errors. The loop retries the call if interrupted by a signal and breaks -on any other error after logging it with strerror(). - -Additionally, change the index variable type from int to size_t to -match the type used for buffer sizes and by strlen(), improving type -safety. - -Fixes: 761916fd02c2 ("rtla/trace: Save event histogram output to a file") -Signed-off-by: Wander Lairson Costa -Link: https://lore.kernel.org/r/20260309195040.1019085-16-wander@redhat.com -Signed-off-by: Tomas Glozar -Signed-off-by: Sasha Levin ---- - tools/tracing/rtla/src/trace.c | 14 +++++++++++--- - 1 file changed, 11 insertions(+), 3 deletions(-) - -diff --git a/tools/tracing/rtla/src/trace.c b/tools/tracing/rtla/src/trace.c -index d5a6a7351d40f..a4912aaa10eb9 100644 ---- a/tools/tracing/rtla/src/trace.c -+++ b/tools/tracing/rtla/src/trace.c -@@ -358,11 +358,11 @@ static void trace_event_disable_filter(struct trace_instance *instance, - static void trace_event_save_hist(struct trace_instance *instance, - struct trace_events *tevent) - { -- int index, out_fd; -+ size_t index, hist_len; - mode_t mode = 0644; - char path[1024]; - char *hist; -- size_t hist_len; -+ int out_fd; - - if (!tevent) - return; -@@ -394,7 +394,15 @@ static void trace_event_save_hist(struct trace_instance *instance, - index = 0; - hist_len = strlen(hist); - do { -- index += write(out_fd, &hist[index], hist_len - index); -+ const ssize_t written = write(out_fd, &hist[index], hist_len - index); -+ -+ if (written < 0) { -+ if (errno == EINTR) -+ continue; -+ err_msg(" Error writing hist file: %s\n", strerror(errno)); -+ break; -+ } -+ index += written; - } while (index < hist_len); - - free(hist); --- -2.53.0 - diff --git a/queue-7.0/rtla-use-str_has_prefix-for-prefix-checks.patch b/queue-7.0/rtla-use-str_has_prefix-for-prefix-checks.patch deleted file mode 100644 index 0805dc2acf..0000000000 --- a/queue-7.0/rtla-use-str_has_prefix-for-prefix-checks.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 135850d57c6b0f4cf509b70f6e15fb4cdb2864f5 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 9 Mar 2026 16:46:24 -0300 -Subject: rtla: Use str_has_prefix() for prefix checks - -From: Wander Lairson Costa - -[ Upstream commit 265905df83a4c1e78c1a912e1699d7c81d9540e6 ] - -The code currently uses strncmp() combined with strlen() to check if a -string starts with a specific prefix. This pattern is verbose and prone -to errors if the length does not match the prefix string. - -Replace this pattern with the str_has_prefix() helper function in both -trace.c and utils.c. This improves code readability and safety by -handling the prefix length calculation automatically. - -In addition, remove the unused retval variable from -trace_event_save_hist() in trace.c to clean up the function and -silence potential compiler warnings. - -Signed-off-by: Wander Lairson Costa -Link: https://lore.kernel.org/r/20260309195040.1019085-12-wander@redhat.com -Signed-off-by: Tomas Glozar -Stable-dep-of: 4bf4ef5292b9 ("rtla/trace: Fix write loop in trace_event_save_hist()") -Signed-off-by: Sasha Levin ---- - tools/tracing/rtla/src/trace.c | 5 ++--- - tools/tracing/rtla/src/utils.c | 3 +-- - 2 files changed, 3 insertions(+), 5 deletions(-) - -diff --git a/tools/tracing/rtla/src/trace.c b/tools/tracing/rtla/src/trace.c -index 073ec1b567798..d5a6a7351d40f 100644 ---- a/tools/tracing/rtla/src/trace.c -+++ b/tools/tracing/rtla/src/trace.c -@@ -358,7 +358,7 @@ static void trace_event_disable_filter(struct trace_instance *instance, - static void trace_event_save_hist(struct trace_instance *instance, - struct trace_events *tevent) - { -- int retval, index, out_fd; -+ int index, out_fd; - mode_t mode = 0644; - char path[1024]; - char *hist; -@@ -372,8 +372,7 @@ static void trace_event_save_hist(struct trace_instance *instance, - return; - - /* is this a hist: trigger? */ -- retval = strncmp(tevent->trigger, "hist:", strlen("hist:")); -- if (retval) -+ if (!str_has_prefix(tevent->trigger, "hist:")) - return; - - snprintf(path, 1024, "%s_%s_hist.txt", tevent->system, tevent->event); -diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c -index fb067220566a4..22d2182c729e5 100644 ---- a/tools/tracing/rtla/src/utils.c -+++ b/tools/tracing/rtla/src/utils.c -@@ -316,8 +316,7 @@ static int procfs_is_workload_pid(const char *comm_prefix, struct dirent *proc_e - return 0; - - buffer[MAX_PATH-1] = '\0'; -- retval = strncmp(comm_prefix, buffer, strlen(comm_prefix)); -- if (retval) -+ if (!str_has_prefix(buffer, comm_prefix)) - return 0; - - /* comm already have \n */ --- -2.53.0 - diff --git a/queue-7.0/series b/queue-7.0/series index 8954db30b0..a8501e928e 100644 --- a/queue-7.0/series +++ b/queue-7.0/series @@ -10,7 +10,6 @@ block-fix-zones_cond-memory-leak-on-zone-revalidatio.patch nilfs2-reject-zero-bd_oblocknr-in-nilfs_ioctl_mark_b.patch blk-cgroup-fix-disk-reference-leak-in-blkcg_maybe_th.patch pstore-ram-fix-resource-leak-when-ioremap-fails.patch -erofs-verify-metadata-accesses-for-file-backed-mount.patch erofs-include-the-trailing-nul-in-fs_ioc_getfslabel.patch md-fix-array_state-clear-sysfs-deadlock.patch ublk-reset-per-io-canceled-flag-on-each-fetch.patch @@ -449,9 +448,6 @@ ktest-avoid-undef-warning-when-warnings_file-is-unse.patch ktest-honor-empty-per-test-option-overrides.patch ktest-run-post_ktest-hooks-on-failure-and-cancellati.patch vfio-selftests-fix-crash-in-vfio_dma_mapping_mmio_te.patch -rtla-simplify-code-by-caching-string-lengths.patch -rtla-use-str_has_prefix-for-prefix-checks.patch -rtla-trace-fix-write-loop-in-trace_event_save_hist.patch rtla-utils-fix-resource-leak-in-set_comm_sched_attr.patch tools-rtla-generate-optstring-from-long-options.patch rtla-fix-segfault-on-multiple-sigints.patch @@ -1099,7 +1095,6 @@ iommu-amd-bounds-check-devid-in-__rlookup_amd_iommu.patch x86-kexec-push-kjump-return-address-even-for-non-kjump-kexec.patch xfs-fix-memory-leak-on-error-in-xfs_alloc_zone_info.patch virt-sev-guest-do-not-use-host-controlled-page-order-in-cleanup-path.patch -riscv-misaligned-make-enabling-delegation-depend-on-nonportable.patch powerpc-warp-fix-error-handling-in-pika_dtm_thread.patch netfs-fix-error-handling-in-netfs_extract_user_iter.patch nfsd-fix-get_dir_delegation-when-vfs-leases-are-disabled.patch -- 2.47.3