Fix read file failure code checking

A bug fixed in libtrace 1.8.2 breaks trace sample processing on
machines with a large number of CPUs. Backport patch that fixes this
issue.

Resolves: RHEL-93863
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
This commit is contained in:
Tomas Glozar 2025-05-28 09:32:20 +02:00
parent 8346d1c229
commit 9912f64a58
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,31 @@
From 3f5dc533a8306527b77bcf9187768ba0eaf910b6 Mon Sep 17 00:00:00 2001
From: Haiyue Wang <haiyuewa@163.com>
Date: Fri, 14 Feb 2025 20:35:17 +0800
Subject: [PATCH] libtracefs: Fix the read file failure code checking
The failure error code '-1' will be treated as 'true'. Only nonzero
number has buffer data returned successfully.
Link: https://lore.kernel.org/20250214123531.13883-1-haiyuewa@163.com
Signed-off-by: Haiyue Wang <haiyuewa@163.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
src/tracefs-record.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tracefs-record.c b/src/tracefs-record.c
index 932e8b4..1a4a16c 100644
--- a/src/tracefs-record.c
+++ b/src/tracefs-record.c
@@ -550,7 +550,7 @@ static int init_splice(struct tracefs_cpu *tcpu)
if (ret < 0)
return ret;
- if (str_read_file("/proc/sys/fs/pipe-max-size", &buf, false)) {
+ if (str_read_file("/proc/sys/fs/pipe-max-size", &buf, false) > 0) {
int size = atoi(buf);
fcntl(tcpu->splice_pipe[0], F_SETPIPE_SZ, &size);
free(buf);
--
2.49.0

View File

@ -1,6 +1,6 @@
Name: libtracefs
Version: 1.8.0
Release: 6%{?dist}
Release: 7%{?dist}
License: LGPL-2.1-or-later AND GPL-2.0-or-later AND GPL-2.0-only
Summary: Library for access kernel tracefs
@ -21,6 +21,7 @@ Patch11: libtracefs-Prevent-memory-leak-in-tracefs_dynevent_g.patch
Patch12: libtracefs-Close-dir-in-the-error-path-in-tracefs_sy.patch
Patch13: libtracefs-Close-dir-in-the-error-path-in-tracefs_ev.patch
Patch14: libtracefs-Initialize-val-in-build_filter.patch
Patch15: libtracefs-Fix-the-read-file-failure-code-checking.patch
BuildRequires: gcc
BuildRequires: make
@ -62,6 +63,10 @@ rm -rf %{buildroot}/%{_libdir}/libtracefs.a
%{_libdir}/%{name}.so
%changelog
* Wed May 28 2025 Tomas Glozar <tglozar@redhat.com> - 1.8.0-7
- Fix read file failure code checking
Resolves: RHEL-93863
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1.8.0-6
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018