Compare commits

...
Sign in to create a new pull request.

22 commits

Author SHA1 Message Date
Aaron Merey
7581f96112
Add libpfm-fix-const.patch 2025-12-19 13:30:35 -05:00
Python Maint
37780f0847 Rebuilt for Python 3.14.0rc3 bytecode 2025-09-19 12:27:20 +02:00
Aaron Merey
0bfaf1d1cb
libpfm.spec: bump release number 2025-08-25 12:04:16 -04:00
Aaron Merey
91fced006a
tests/runtest.sh: Fix path to tests
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2389127
2025-08-25 11:54:56 -04:00
Python Maint
9b4205af69 Rebuilt for Python 3.14.0rc2 bytecode 2025-08-15 12:56:39 +02:00
Fedora Release Engineering
12330968af Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-24 20:10:36 +00:00
Python Maint
fab74e854f Rebuilt for Python 3.14 2025-06-02 20:26:21 +02:00
Fedora Release Engineering
c9663bf9f8 Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-17 12:58:01 +00:00
Fedora Release Engineering
d9915b348d Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-18 14:46:25 +00:00
Python Maint
9c38e7ca4d Rebuilt for Python 3.13 2024-06-07 08:51:39 +02:00
Yaakov Selkowitz
5b33854516 Modernize provides filter
https://docs.fedoraproject.org/en-US/packaging-guidelines/AutoProvidesAndRequiresFiltering/
2024-02-04 11:33:04 -05:00
Michal Kolar
e8e4c2f2e9 plans/ci.fmf: fix deprecated fmf plan attribute 2024-02-02 09:11:21 +00:00
William Cohen
dcb84740cd Fix gcc-14 -Werror=calloc-transposed-args compatibility 2024-01-29 16:34:57 -05:00
Fedora Release Engineering
461c2dd0bd Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-25 03:13:09 +00:00
Fedora Release Engineering
0697d01219 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-21 05:00:03 +00:00
William Cohen
109072acb0 migrated to SPDX license 2023-08-01 09:48:34 -04:00
Fedora Release Engineering
22274b8db4 Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-20 11:45:57 +00:00
Python Maint
2d5dcdf0e7 Rebuilt for Python 3.12 2023-06-13 20:43:09 +02:00
Miro Hrončok
0f9c88b81f Don't install a Python .egg
Due to an upcoming deprecation of .eggs in pip,
we'd like to avoid all Python .eggs in Fedora.

setuptools forces installation of an .egg when --prefix is set without --root.

To make this work, we set the make's DESTDIR variable
rather than prefixing other values with it.

To assert this works, we list the Python files explicitly,
as required by https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_explicit_lists
2023-04-25 14:13:18 +02:00
William Cohen
face84c751 Rebase on libpfm-4.13.0. 2023-03-28 23:31:46 -04:00
William Cohen
a5d8146854 Add libpfm upstream patch to allow papi-7.0.1 to build. 2023-03-14 10:52:30 -04:00
Fedora Release Engineering
4e095bbe90 Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-19 17:09:29 +00:00
8 changed files with 162 additions and 106 deletions

1
.gitignore vendored
View file

@ -11,3 +11,4 @@
/libpfm-4.10.0.tar.gz
/libpfm-4.10.1.tar.gz
/libpfm-4.11.0.tar.gz
/libpfm-4.13.0.tar.gz

59
libpfm-fix-const.patch Normal file
View file

@ -0,0 +1,59 @@
From ded148888c501c2e9d21c23263d7c09aed4b97d6 Mon Sep 17 00:00:00 2001
From: Aaron Merey <amerey@redhat.com>
Date: Fri, 19 Dec 2025 12:33:33 -0500
Subject: [PATCH] fix discarded const warning on newer gcc
---
lib/pfmlib_common.c | 15 +++++++++------
tests/validate_x86.c | 2 +-
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/lib/pfmlib_common.c b/lib/pfmlib_common.c
index 44b5de4..59a7cff 100644
--- a/lib/pfmlib_common.c
+++ b/lib/pfmlib_common.c
@@ -1625,12 +1625,6 @@ pfmlib_parse_event(const char *event, pfmlib_event_desc_t *d)
const char *pname = NULL;
int i, j, ret;
- /*
- * support only one event at a time.
- */
- p = strpbrk(event, PFMLIB_EVENT_DELIM);
- if (p)
- return PFM_ERR_INVAL;
/*
* create copy because string is const
*/
@@ -1638,6 +1632,15 @@ pfmlib_parse_event(const char *event, pfmlib_event_desc_t *d)
if (!str)
return PFM_ERR_NOMEM;
+ /*
+ * support only one event at a time.
+ */
+ p = strpbrk(s, PFMLIB_EVENT_DELIM);
+ if (p) {
+ free(s);
+ return PFM_ERR_INVAL;
+ }
+
/* check for optional PMU name */
p = strstr(s, PFMLIB_PMU_DELIM);
diff --git a/tests/validate_x86.c b/tests/validate_x86.c
index 500a697..68a776d 100644
--- a/tests/validate_x86.c
+++ b/tests/validate_x86.c
@@ -8018,7 +8018,7 @@ static int
check_pmu_supported(const char *evt)
{
pfm_pmu_info_t info;
- char *p;
+ const char *p;
int ret;
pfm_pmu_t i;
--
2.52.0

View file

@ -1,89 +0,0 @@
commit a7b26272d8327ad1c001456a18518a0ac65dc2bb
Author: Stephane Eranian <eranian@gmail.com>
Date: Wed Jun 8 06:55:36 2022 -0700
avoid GCC-12 use-after-free warnings
gcc-12 seems to complain about bogus use-after-free situations in the
libpfm4 code:
p = realloc(q, ...)
if (!p)
return NULL
s = p + (q - z)
It complains because of the use of q after realloc in this case.
Yet q - z is just pointer artihmetic and is not dereferencing any
memory through the pointer q which may have been freed by realloc.
Fix is to pre-computer the delta before realloc to avoid using the
pointer after the call.
Reported-by: Vitaly Chikunov <vt@altlinux.org>
Signed-off-by: Stephane Eranian <eranian@gmail.com>
diff --git a/lib/pfmlib_perf_event_pmu.c b/lib/pfmlib_perf_event_pmu.c
index c3386aa..637c5b1 100644
--- a/lib/pfmlib_perf_event_pmu.c
+++ b/lib/pfmlib_perf_event_pmu.c
@@ -268,6 +268,7 @@ perf_table_alloc_event(void)
perf_table_alloc_event(void)
{
perf_event_t *new_pe;
+ size_t num_free;
retry:
if (perf_pe_free < perf_pe_end)
@@ -286,11 +287,20 @@ retry:
perf_pe_count += PERF_ALLOC_EVENT_COUNT;
+ /*
+ * compute number of free events left
+ * before realloc() to avoid compiler warning (use-after-free)
+ * even though we are simply doing pointer arithmetic and not
+ * dereferencing the perf_pe after realloc when it may be stale
+ * in case the memory was moved.
+ */
+ num_free = perf_pe_free - perf_pe;
+
new_pe = realloc(perf_pe, perf_pe_count * sizeof(perf_event_t));
if (!new_pe)
return NULL;
- perf_pe_free = new_pe + (perf_pe_free - perf_pe);
+ perf_pe_free = new_pe + num_free;
perf_pe_end = perf_pe_free + PERF_ALLOC_EVENT_COUNT;
perf_pe = new_pe;
@@ -315,18 +325,27 @@ static perf_umask_t *
perf_table_alloc_umask(void)
{
perf_umask_t *new_um;
+ size_t num_free;
retry:
if (perf_um_free < perf_um_end)
return perf_um_free++;
perf_um_count += PERF_ALLOC_UMASK_COUNT;
-
+
+ /*
+ * compute number of free unmasks left
+ * before realloc() to avoid compiler warning (use-after-free)
+ * even though we are simply doing pointer arithmetic and not
+ * dereferencing the perf_um after realloc when it may be stale
+ * in case the memory was moved.
+ */
+ num_free = perf_um_free - perf_um;
new_um = realloc(perf_um, perf_um_count * sizeof(*new_um));
if (!new_um)
return NULL;
- perf_um_free = new_um + (perf_um_free - perf_um);
+ perf_um_free = new_um + num_free;
perf_um_end = perf_um_free + PERF_ALLOC_UMASK_COUNT;
perf_um = new_um;

21
libpfm-gcc14.patch Normal file
View file

@ -0,0 +1,21 @@
commit cb944829e0940d74009e09b8985b4f2139f5cb3b
Author: William Cohen <wcohen@redhat.com>
Date: Mon Jan 29 16:23:43 2024 -0500
Correct s390x code to avoid GCC-14 -Werror=calloc-transposed-args errors
diff --git a/lib/pfmlib_s390x_cpumf.c b/lib/pfmlib_s390x_cpumf.c
index d8ce22d..718f5f8 100644
--- a/lib/pfmlib_s390x_cpumf.c
+++ b/lib/pfmlib_s390x_cpumf.c
@@ -216,8 +216,8 @@ static int pfm_cpumcf_init(void *this)
break;
}
- cpumcf_pe = calloc(sizeof(*cpumcf_pe),
- cfvn_set_count + csvn_set_count + ext_set_count);
+ cpumcf_pe = calloc(cfvn_set_count + csvn_set_count + ext_set_count,
+ sizeof(*cpumcf_pe));
if (cpumcf_pe == NULL)
return PFM_ERR_NOMEM;

View file

@ -4,23 +4,21 @@
%if %{with python}
%define python_sitearch %(python3 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))")
%define python_prefix %(python3 -c "import sys; print (sys.prefix)")
%{?filter_setup:
%filter_provides_in %{python3_sitearch}/perfmon/.*\.so$
%filter_setup
}
%global __provides_exclude_from ^%{python3_sitearch}/perfmon/.*\.so$
%endif
Name: libpfm
Version: 4.11.0
Release: 10%{?dist}
Version: 4.13.0
Release: 17%{?dist}
Summary: Library to encode performance events for use by perf tool
License: MIT
URL: http://perfmon2.sourceforge.net/
Source0: http://sourceforge.net/projects/perfmon2/files/libpfm4/%{name}-%{version}.tar.gz
Patch1: libpfm-fix-const.patch
Patch2: libpfm-python3-setup.patch
Patch3: libpfm-gcc12.patch
Patch3: libpfm-gcc14.patch
BuildRequires: make
BuildRequires: gcc
@ -38,6 +36,7 @@ kernels performance monitoring interfaces. The current version provides support
for the perf_events interface available in upstream Linux kernels since v2.6.31.
%package devel
License: MIT
Summary: Development library to encode performance events for perf_events based tools
Requires: %{name}%{?_isa} = %{version}-%{release}
@ -47,6 +46,7 @@ applications for the perf_events interface.
%if %{with_static}
%package static
License: MIT
Summary: Static library to encode performance events for perf_events based tools
Requires: %{name}%{?_isa} = %{version}-%{release}
@ -57,6 +57,7 @@ applications for the perf_events interface.
%if %{with python}
%package -n python3-libpfm
License: MIT AND LicenseRef-Fedora-UltraPermissive
%{?python_provide:%python_provide python3-libpfm}
# Remove before F30
Provides: %{name}-python = %{version}-%{release}
@ -71,8 +72,13 @@ Python bindings for libpfm4 and perf_event_open system call.
%prep
%setup -q
%patch2 -p1 -b .python3
%patch3 -p1 -b .gcc12
%patch -P1 -p1 -b .fix-const
%patch -P2 -p1 -b .python3
%patch -P3 -p1 -b .gcc14
# to prevent setuptools from installing an .egg, we need to pass --root to setup.py install
# see https://github.com/pypa/setuptools/issues/3143
# and https://github.com/pypa/pip/issues/11501
sed -i 's/--prefix=$(DESTDIR)$(PYTHON_PREFIX)/--root=$(DESTDIR) --prefix=$(PYTHON_PREFIX)/' python/Makefile
%build
%if %{with python}
@ -88,14 +94,15 @@ Python bindings for libpfm4 and perf_event_open system call.
rm -rf $RPM_BUILD_ROOT
%if %{with python}
%global python_config CONFIG_PFMLIB_NOPYTHON=n PYTHON_PREFIX=$RPM_BUILD_ROOT/%{python_prefix}
%global python_config CONFIG_PFMLIB_NOPYTHON=n PYTHON_PREFIX=%{python_prefix}
%else
%global python_config CONFIG_PFMLIB_NOPYTHON=y
%endif
make \
PREFIX=$RPM_BUILD_ROOT%{_prefix} \
LIBDIR=$RPM_BUILD_ROOT%{_libdir} \
DESTDIR=$RPM_BUILD_ROOT \
PREFIX=%{_prefix} \
LIBDIR=%{_libdir} \
%{python_config} \
LDCONFIG=/bin/true \
install
@ -122,10 +129,68 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a
%if %{with python}
%files -n python3-libpfm
%{python3_sitearch}/*
%{python3_sitearch}/perfmon-*.egg-info/
%{python3_sitearch}/perfmon/
%endif
%changelog
* Tue Dec 16 2025 Aaron Merey <amerey@redhat.com> - 4.13.0-17
- Add libpfm-fix-const.patch
* Fri Sep 19 2025 Python Maint <python-maint@redhat.com> - 4.13.0-16
- Rebuilt for Python 3.14.0rc3 bytecode
* Mon Aug 25 2025 Aaron Merey <amerey@redhat.com> - 4.13.0-15
- Fix path in tests/runtest.sh
* Fri Aug 15 2025 Python Maint <python-maint@redhat.com> - 4.13.0-14
- Rebuilt for Python 3.14.0rc2 bytecode
* Thu Jul 24 2025 Fedora Release Engineering <releng@fedoraproject.org> - 4.13.0-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Mon Jun 02 2025 Python Maint <python-maint@redhat.com> - 4.13.0-12
- Rebuilt for Python 3.14
* Fri Jan 17 2025 Fedora Release Engineering <releng@fedoraproject.org> - 4.13.0-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Thu Jul 18 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.13.0-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Fri Jun 07 2024 Python Maint <python-maint@redhat.com> - 4.13.0-9
- Rebuilt for Python 3.13
* Mon Jan 29 2024 William Cohen <wcohen@redhat.com> - 4.13.0-8
- Fix gcc-14 -Werror=calloc-transposed-args compatibility
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.13.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.13.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Tue Aug 1 2023 William Cohen <wcohen@redhat.com> - 4.13.0-5
- migrated to SPDX license
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.13.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 4.13.0-3
- Rebuilt for Python 3.12
* Tue Apr 25 2023 Miro Hrončok <mhroncok@redhat.com> - 4.13.0-2
- Don't install a Python .egg
* Tue Mar 28 2023 William Cohen <wcohen@redhat.com> - 4.13.0-1
- Rebase on libpfm-4.13.0.
* Tue Mar 14 2023 William Cohen <wcohen@redhat.com> - 4.11.0-12
- Add libpfm upstream patch to allow papi-7.0.1 to build.
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.11.0-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 4.11.0-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

View file

@ -1,6 +1,5 @@
summary: CI Gating Plan
discover:
how: fmf
directory: tests
execute:
how: beakerlib
how: tmt

View file

@ -1 +1 @@
SHA512 (libpfm-4.11.0.tar.gz) = 633035b8a7b35973437572095cdc80d422b2a1a61e74e14f106db95fa8e44e4518e591699cc457f828b8f2fb63f60eef6d0c7535c6b4c9a6c3a70d4550b3c3c7
SHA512 (libpfm-4.13.0.tar.gz) = e61b210aa2ce80f0e47603c88eee2e4f2fe30ca2c0e194a5472b6a8de3bf9dc1085e5261bbb9ddbe5b6531c4b391fb34f20d038e5ebd8e6f4c14c2112aee508f

View file

@ -55,7 +55,7 @@ rlJournalStart
rlRun "yum-builddep -y $TmpDir/SPECS/*.spec"
rlRun "su -c 'rpmbuild -D \"_topdir $TmpDir\" -bp $TmpDir/SPECS/*.spec &>$TmpDir/rpmbuild.log' $BUILD_USER"
rlRun "rlFileSubmit $TmpDir/rpmbuild.log"
rlRun "cd $TmpDir/BUILD/libpfm-*/tests"
rlRun "cd \"$TmpDir\"/BUILD/libpfm-*-build/libpfm-*/tests 2>/dev/null || cd \"$TmpDir\"/BUILD/libpfm-*/tests"
rlRun "su -c 'make PFMLIB=`rpm -ql libpfm | grep .so | head -n 1`' $BUILD_USER"
rlRun "ldd validate | tee $TmpDir/ldd.log"
rlRun "grep -q 'libpfm.so' $TmpDir/ldd.log"