commit b73282aad8102da29b2b55149437a512fded5039 Author: MSVSphere Packaging Team Date: Tue Nov 26 16:43:10 2024 +0300 import intel-cmt-cat-23.11-5.el10 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cda336d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/intel-cmt-cat-23.11.tar.gz diff --git a/.intel-cmt-cat.metadata b/.intel-cmt-cat.metadata new file mode 100644 index 0000000..0a700db --- /dev/null +++ b/.intel-cmt-cat.metadata @@ -0,0 +1 @@ +77a458ff99c6b1e8a7da76522a14f4311fbdf70f SOURCES/intel-cmt-cat-23.11.tar.gz diff --git a/SOURCES/0001-alter-install-paths.patch b/SOURCES/0001-alter-install-paths.patch new file mode 100644 index 0000000..51c12c5 --- /dev/null +++ b/SOURCES/0001-alter-install-paths.patch @@ -0,0 +1,68 @@ +Description: Workaround environment variable settings + Add environment to be set by packaging +Forwarded: not-needed +Author: Colin Ian King + +Index: intel-cmt-cat-23.11/lib/Makefile +=================================================================== +--- intel-cmt-cat-23.11.orig/lib/Makefile ++++ intel-cmt-cat-23.11/lib/Makefile +@@ -119,10 +119,10 @@ endif + + HDR = pqos.h + PREFIX ?= /usr/local +-LIB_INSTALL_DIR ?= $(PREFIX)/lib +-HDR_DIR ?= $(PREFIX)/include ++LIB_INSTALL_DIR ?= $(DESTDIR)/usr/lib64 ++HDR_DIR ?= $(DESTDIR)/usr/include + DEPFILE = $(LIB).dep +-NOLDCONFIG ?= n ++NOLDCONFIG ?= y + + all: $(LIBNAME) + +Index: intel-cmt-cat-23.11/pqos/Makefile +=================================================================== +--- intel-cmt-cat-23.11.orig/pqos/Makefile ++++ intel-cmt-cat-23.11/pqos/Makefile +@@ -94,8 +94,8 @@ MAN = pqos.8 + + # XXX: modify as desired + PREFIX ?= /usr/local +-BIN_DIR = $(PREFIX)/bin +-MAN_DIR = $(PREFIX)/man/man8 ++BIN_DIR = $(DESTDIR)/usr/sbin ++MAN_DIR = $(DESTDIR)/usr/share/man/man8 + + SRCS = $(sort $(wildcard *.c)) + OBJS = $(addprefix $(OBJDIR)/,$(SRCS:.c=.o)) +Index: intel-cmt-cat-23.11/rdtset/Makefile +=================================================================== +--- intel-cmt-cat-23.11.orig/rdtset/Makefile ++++ intel-cmt-cat-23.11/rdtset/Makefile +@@ -95,8 +95,8 @@ MAN = rdtset.8 + + # XXX: modify as desired + PREFIX ?= /usr/local +-BIN_DIR = $(PREFIX)/bin +-MAN_DIR = $(PREFIX)/man/man8 ++BIN_DIR = $(DESTDIR)/usr/sbin ++MAN_DIR = $(DESTDIR)/usr/share/man/man8 + + SRCS = $(sort $(wildcard *.c)) + OBJS = $(SRCS:.c=.o) +Index: intel-cmt-cat-23.11/tools/membw/Makefile +=================================================================== +--- intel-cmt-cat-23.11.orig/tools/membw/Makefile ++++ intel-cmt-cat-23.11/tools/membw/Makefile +@@ -39,8 +39,8 @@ MAN = membw.8 + + # XXX: modify as desired + PREFIX ?= /usr/local +-BIN_DIR = $(PREFIX)/bin +-MAN_DIR = $(PREFIX)/man/man8 ++BIN_DIR = $(DESTDIR)/usr/bin ++MAN_DIR = $(DESTDIR)/usr/share/man/man8 + + CFLAGS=-W -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes \ + -Wmissing-declarations -Wold-style-definition -Wpointer-arith \ diff --git a/SOURCES/0002-remove-build-and-install-of-examples.patch b/SOURCES/0002-remove-build-and-install-of-examples.patch new file mode 100644 index 0000000..e0e9def --- /dev/null +++ b/SOURCES/0002-remove-build-and-install-of-examples.patch @@ -0,0 +1,20 @@ +Description: Remove examples + No need to install these, developers are encouraged to look + at the code in the repository +Forwarded: not-needed +Author: Colin Ian King + +Index: intel-cmt-cat-4.5.0/Makefile +=================================================================== +--- intel-cmt-cat-4.5.0.orig/Makefile ++++ intel-cmt-cat-4.5.0/Makefile +@@ -53,9 +53,6 @@ all: + $(MAKE) -C pqos + $(MAKE) -C rdtset + $(MAKE) -C tools/membw +- $(MAKE) -C examples/c/CAT_MBA +- $(MAKE) -C examples/c/CMT_MBM +- $(MAKE) -C examples/c/PSEUDO_LOCK + + setup-dev: + $(MAKE) -C appqos setup-dev diff --git a/SOURCES/0003-allow-debian-flags-to-be-added.patch b/SOURCES/0003-allow-debian-flags-to-be-added.patch new file mode 100644 index 0000000..d960152 --- /dev/null +++ b/SOURCES/0003-allow-debian-flags-to-be-added.patch @@ -0,0 +1,64 @@ +Description: Hard code in hardening options +Forwarded: not-needed +Author: Colin Ian King + +Index: intel-cmt-cat-23.11/lib/Makefile +=================================================================== +--- intel-cmt-cat-23.11.orig/lib/Makefile ++++ intel-cmt-cat-23.11/lib/Makefile +@@ -37,8 +37,8 @@ LIB = libpqos + VERSION = 5.0.0 + SO_VERSION = 5 + SHARED ?= y +-LDFLAGS = -L. -lpthread -z noexecstack -z relro -z now +-CFLAGS = -pthread -I./ -D_GNU_SOURCE \ ++LDFLAGS += -L. -lpthread -z noexecstack -z relro -z now ++CFLAGS += -pthread -I./ -D_GNU_SOURCE \ + -W -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes \ + -Wmissing-declarations -Wold-style-definition -Wpointer-arith \ + -Wcast-qual -Wundef -Wwrite-strings \ +Index: intel-cmt-cat-23.11/pqos/Makefile +=================================================================== +--- intel-cmt-cat-23.11.orig/pqos/Makefile ++++ intel-cmt-cat-23.11/pqos/Makefile +@@ -36,9 +36,9 @@ + + OBJDIR = obj + LIBDIR ?= ../lib +-LDFLAGS = -L$(LIBDIR) -pie -z noexecstack -z relro -z now ++LDFLAGS += -L$(LIBDIR) -pie -z noexecstack -z relro -z now + LDLIBS = -lpqos -lpthread +-CFLAGS = -I$(LIBDIR) \ ++CFLAGS += -I$(LIBDIR) \ + -W -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes \ + -Wmissing-declarations -Wold-style-definition -Wpointer-arith \ + -Wcast-qual -Wundef -Wwrite-strings \ +Index: intel-cmt-cat-23.11/rdtset/Makefile +=================================================================== +--- intel-cmt-cat-23.11.orig/rdtset/Makefile ++++ intel-cmt-cat-23.11/rdtset/Makefile +@@ -35,9 +35,9 @@ + ############################################################################### + + LIBDIR ?= ../lib +-LDFLAGS = -L$(LIBDIR) -pie -z noexecstack -z relro -z now ++LDFLAGS += -L$(LIBDIR) -pie -z noexecstack -z relro -z now + LDLIBS = -lpqos -lpthread +-CFLAGS = -I$(LIBDIR) \ ++CFLAGS += -I$(LIBDIR) \ + -W -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes \ + -Wmissing-declarations -Wold-style-definition -Wpointer-arith \ + -Wcast-qual -Wundef -Wwrite-strings \ +Index: intel-cmt-cat-23.11/tools/membw/Makefile +=================================================================== +--- intel-cmt-cat-23.11.orig/tools/membw/Makefile ++++ intel-cmt-cat-23.11/tools/membw/Makefile +@@ -42,7 +42,7 @@ PREFIX ?= /usr/local + BIN_DIR = $(DESTDIR)/usr/bin + MAN_DIR = $(DESTDIR)/usr/share/man/man8 + +-CFLAGS=-W -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes \ ++CFLAGS += -W -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes \ + -Wmissing-declarations -Wold-style-definition -Wpointer-arith \ + -Wcast-qual -Wundef -Wwrite-strings \ + -Wformat -Wformat-security -fstack-protector -fPIE \ diff --git a/SOURCES/0004-lib-fix-variable-types-in-common.c-pqos_read.patch b/SOURCES/0004-lib-fix-variable-types-in-common.c-pqos_read.patch new file mode 100644 index 0000000..5a3fede --- /dev/null +++ b/SOURCES/0004-lib-fix-variable-types-in-common.c-pqos_read.patch @@ -0,0 +1,51 @@ +From aadf13d6c87b6fe8d1393623757f826514eaad77 Mon Sep 17 00:00:00 2001 +From: Eugene Syromiatnikov +Date: Fri, 16 Aug 2024 16:02:40 +0200 +Subject: [PATCH 4/5] lib: fix variable types in common.c:pqos_read() + +The types used for len and ret variables in pqos_read do not match +neither the function prototype, nor read() library call, which may lead +to possible overflow; while the ret overflow is arguably hypothetical +on Linux, as it likely won't return a value greater than 0x7ffff000, +which is less than INT_MAX, a potential overflow of len seems +to be possible, as caller might pass count greater than INT_MAX. +Fix it by changing the type of len to size_t, to match count, +and the type of ret to ssize_t, to match the return type of read(). + +Discovered by covscan: + + Error: INTEGER_OVERFLOW (CWE-190): + intel-cmt-cat-23.11/lib/common.c:382: tainted_data_return: Called function "read(fd, byte_ptr, len)", and a possible return value may be less than zero. + intel-cmt-cat-23.11/lib/common.c:382: cast_overflow: An assign that casts to a different type, which might trigger an overflow. + intel-cmt-cat-23.11/lib/common.c:389: overflow: The expression "len" is considered to have possibly overflowed. + intel-cmt-cat-23.11/lib/common.c:382: overflow_sink: "len", which might be negative, is passed to "read(fd, byte_ptr, len)". [Note: The source code implementation of the function has been overridden by a builtin model.] + # 380| return -1; + # 381| + # 382|-> while (len != 0 && (ret = read(fd, byte_ptr, len)) != 0) { + # 383| if (ret == -1) { + # 384| if (errno == EINTR) + +Signed-off-by: Eugene Syromiatnikov +--- + lib/common.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/common.c b/lib/common.c +index 55584b34633a..c9688b82f99d 100644 +--- a/lib/common.c ++++ b/lib/common.c +@@ -378,9 +378,9 @@ pqos_munmap(void *mem, const uint64_t size) + ssize_t + pqos_read(int fd, void *buf, size_t count) + { +- int len = count; ++ size_t len = count; + char *byte_ptr = (char *)buf; +- int ret; ++ ssize_t ret; + + if (buf == NULL) + return -1; +-- +2.28.0 + diff --git a/SOURCES/0005-lib-set-errno-when-buf-points-to-NULL-in-common.c-pq.patch b/SOURCES/0005-lib-set-errno-when-buf-points-to-NULL-in-common.c-pq.patch new file mode 100644 index 0000000..dd44cd8 --- /dev/null +++ b/SOURCES/0005-lib-set-errno-when-buf-points-to-NULL-in-common.c-pq.patch @@ -0,0 +1,34 @@ +From 182bb7032151e39d6af6fc34992c7940568b1117 Mon Sep 17 00:00:00 2001 +From: Eugene Syromiatnikov +Date: Fri, 16 Aug 2024 16:11:22 +0200 +Subject: [PATCH 5/5] lib: set errno when buf points to NULL in + common.c:pqos_read() + +There is little need for the check, as the first read() call is supposed +to fail with EFAULT in case buf is NULL, but if this check is done, +it would be nice if it matches the error code the call it wraps. + +Signed-off-by: Eugene Syromiatnikov +--- + lib/common.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/lib/common.c b/lib/common.c +index c9688b82f99d..3273c86d16e8 100644 +--- a/lib/common.c ++++ b/lib/common.c +@@ -382,8 +382,10 @@ pqos_read(int fd, void *buf, size_t count) + char *byte_ptr = (char *)buf; + ssize_t ret; + +- if (buf == NULL) ++ if (buf == NULL) { ++ errno = EFAULT; + return -1; ++ } + + while (len != 0 && (ret = read(fd, byte_ptr, len)) != 0) { + if (ret == -1) { +-- +2.28.0 + diff --git a/SPECS/intel-cmt-cat.spec b/SPECS/intel-cmt-cat.spec new file mode 100644 index 0000000..ee4e92e --- /dev/null +++ b/SPECS/intel-cmt-cat.spec @@ -0,0 +1,197 @@ +%global libpqos_ver 5.0.0 +%global desc %{expand: \ +This package provides basic support for Intel Resource Director Technology +including, Cache Monitoring Technology (CMT), Memory Bandwidth Monitoring +(MBM), Cache Allocation Technology (CAT), Code and Data Prioritization +(CDP) and Memory Bandwidth Allocation (MBA).} + +Name: intel-cmt-cat +Version: 23.11 +Release: 5%{?dist} +Summary: Intel cache monitoring and allocation technology config tool + +License: BSD-3-Clause +URL: https://github.com/intel/intel-cmt-cat +Source: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz + +Patch0: 0001-alter-install-paths.patch +Patch1: 0002-remove-build-and-install-of-examples.patch +Patch2: 0003-allow-debian-flags-to-be-added.patch +Patch3: 0004-lib-fix-variable-types-in-common.c-pqos_read.patch +Patch4: 0005-lib-set-errno-when-buf-points-to-NULL-in-common.c-pq.patch + +ExclusiveArch: x86_64 + +BuildRequires: gcc +BuildRequires: make + +%description +%{desc} + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel %{desc} + +Development files. + +%prep +%autosetup -p1 -n %{name}-%{version} + +%build +%make_build + +%install +%make_install + +%ldconfig_scriptlets + +%files +%license LICENSE +%doc ChangeLog README.md +%{_bindir}/membw +%{_sbindir}/pqos +%{_sbindir}/pqos-msr +%{_sbindir}/pqos-os +%{_sbindir}/rdtset +%{_libdir}/libpqos.so.5 +%{_libdir}/libpqos.so.%{libpqos_ver} +%{_mandir}/man8/membw.8* +%{_mandir}/man8/pqos.8* +%{_mandir}/man8/pqos-msr.8* +%{_mandir}/man8/pqos-os.8* +%{_mandir}/man8/rdtset.8* + +%files -n %{name}-devel +%{_includedir}/pqos.h +%{_libdir}/libpqos.so + +%changelog +* Tue Nov 26 2024 MSVSphere Packaging Team - 23.11-5 +- Rebuilt for MSVSphere 10 + +* Fri Aug 23 2024 Eugene Syromiatnikov - 23.11-5 +- Address issues reported by SAST (RHEL-40017) + +* Mon Jun 24 2024 Troy Dawson - 23.11-4 +- Bump release for June 2024 mass rebuild + +* Wed Jan 24 2024 Fedora Release Engineering - 23.11-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sat Jan 20 2024 Fedora Release Engineering - 23.11-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Mon Nov 13 2023 Ali Erdinc Koroglu - 23.11-1 +- Update to 23.11 + +* Thu Aug 31 2023 Ali Erdinc Koroglu - 23.08-1 +- Update to 23.08 + +* Thu Jul 20 2023 Fedora Release Engineering - 4.5.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Mon Mar 06 2023 Raghavan Kanagaraj - 4.5.0-1 +- New release 4.5.0 + +* Thu Jan 19 2023 Fedora Release Engineering - 4.4.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Wed Oct 12 2022 Marcel cornu - 4.4.1-1 +- New release 4.4.1 + +* Thu Jul 21 2022 Fedora Release Engineering - 4.3.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Tue Mar 1 2022 Khawar Abbasi - 4.3.0-1 +- New release 4.3.0 + +* Thu Jan 20 2022 Fedora Release Engineering - 4.1.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Thu Jul 22 2021 Fedora Release Engineering - 4.1.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Tue Jan 26 2021 Fedora Release Engineering - 4.1.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Fri Dec 18 2020 Khawar Abbasi - 4.1.0-1 +- New release 4.1.0 + +* Tue Jul 28 2020 Fedora Release Engineering - 4.0.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue Jul 21 2020 Khawar Abbasi - 4.0.0-1 +- New release 4.0.0 + +* Wed Jan 29 2020 Fedora Release Engineering - 3.1.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Mon Sep 30 2019 Marcel cornu - 3.1.1-1 +- New release 3.1.1 + +* Thu Jul 25 2019 Fedora Release Engineering - 3.0.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Wed Mar 27 2019 Marcel cornu - 3.0.1-1 +- New release 3.0.1 + +* Mon Feb 18 2019 Marcel cornu - 3.0.0-1 +- New release 3.0.0 + +* Fri Feb 01 2019 Fedora Release Engineering - 2.1.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Tue Oct 16 2018 Marcel cornu , Michal Aleksinski 2.1.0-1 +- New release 2.1.0 + +* Fri Jul 13 2018 Fedora Release Engineering - 2.0.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Thu Jun 28 2018 Marcel cornu , Michal Aleksinski - 2.0.0-1 +- New release 2.0.0 + +* Thu Mar 08 2018 Marcel cornu , Michal Aleksinski - 1.2.0-3 +- Updated spec file with BuildRequires tag + +* Wed Feb 07 2018 Fedora Release Engineering - 1.2.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Wed Nov 29 2017 Marcel Cornu , Wojciech Andralojc 1.2.0-1 +- New release 1.2.0 + +* Thu Aug 3 2017 Aaron Hetherington , Marcel Cornu 1.1.0-1 +- New release 1.1.0 + +* Wed Aug 02 2017 Fedora Release Engineering - 1.0.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 1.0.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Wed Jun 21 2017 Aaron Hetherington , Marcel Cornu 1.0.1-1 +- Spec file bug fixes + +* Wed Jun 07 2017 Aaron Hetherington , Marcel Cornu 1.0.1-1 +- new release +- bug fixes + +* Fri May 19 2017 Aaron Hetherington , Michal Aleksinski 1.0.0-1 +- new release + +* Tue Feb 14 2017 Aaron Hetherington 0.1.5-1 +- new release + +* Mon Oct 17 2016 Aaron Hetherington 0.1.5 +- new release + +* Tue Apr 19 2016 Tomasz Kantecki 0.1.4-3 +- global typo fix +- small edits in the description + +* Mon Apr 18 2016 Tomasz Kantecki 0.1.4-2 +- LICENSE file added to the package + +* Thu Apr 7 2016 Tomasz Kantecki 0.1.4-1 +- initial version of the package