diff --git a/CVE-2019-18874-1.patch b/0001-Fix-CVE-2019-18874.patch similarity index 34% rename from CVE-2019-18874-1.patch rename to 0001-Fix-CVE-2019-18874.patch index 412e7c638a572715fff3ab24b789d11530f7cd22..414ac7a2a8873da3cc21cab0a53312cc05838ebe 100644 --- a/CVE-2019-18874-1.patch +++ b/0001-Fix-CVE-2019-18874.patch @@ -1,35 +1,18 @@ -Backport of: +From ee500fd072d033efb5258362272527311bcc35d4 Mon Sep 17 00:00:00 2001 +From: FFrog +Date: Tue, 8 Feb 2022 14:44:42 +0800 +Subject: [PATCH] Fix CVE-2019-18874 -From 7d512c8e4442a896d56505be3e78f1156f443465 Mon Sep 17 00:00:00 2001 -From: Riccardo Schirone -Date: Wed, 13 Nov 2019 14:54:21 +0100 -Subject: [PATCH] Use Py_CLEAR instead of Py_DECREF to also set the variable to - NULL (#1616) - -These files contain loops that convert system data into python objects -and during the process they create objects and dereference their -refcounts after they have been added to the resulting list. - -However, in case of errors during the creation of those python objects, -the refcount to previously allocated objects is dropped again with -Py_XDECREF, which should be a no-op in case the paramater is NULL. Even -so, in most of these loops the variables pointing to the objects are -never set to NULL, even after Py_DECREF is called at the end of the loop -iteration. This means, after the first iteration, if an error occurs -those python objects will get their refcount dropped two times, -resulting in a possible double-free. --- - psutil/_psutil_aix.c | 18 +++++++------- - psutil/_psutil_bsd.c | 30 +++++++++++----------- - psutil/_psutil_linux.c | 14 +++++------ - psutil/_psutil_osx.c | 39 ++++++++++++++--------------- - psutil/_psutil_sunos.c | 43 ++++++++++++++++---------------- - psutil/_psutil_windows.c | 54 ++++++++++++++++++++-------------------- - 6 files changed, 97 insertions(+), 101 deletions(-) + psutil/_psutil_linux.c | 14 +++++++------- + psutil/_psutil_posix.c | 10 +++++----- + 2 files changed, 12 insertions(+), 12 deletions(-) +diff --git a/psutil/_psutil_linux.c b/psutil/_psutil_linux.c +index 4bf53b8..684d59d 100644 --- a/psutil/_psutil_linux.c +++ b/psutil/_psutil_linux.c -@@ -232,9 +232,9 @@ psutil_disk_partitions(PyObject *self, P +@@ -236,9 +236,9 @@ psutil_disk_partitions(PyObject *self, PyObject *args) { goto error; if (PyList_Append(py_retlist, py_tuple)) goto error; @@ -42,7 +25,7 @@ resulting in a possible double-free. } endmntent(file); return py_retlist; -@@ -488,10 +488,10 @@ psutil_users(PyObject *self, PyObject *a +@@ -494,10 +494,10 @@ psutil_users(PyObject *self, PyObject *args) { goto error; if (PyList_Append(py_retlist, py_tuple)) goto error; @@ -57,3 +40,27 @@ resulting in a possible double-free. } endutent(); return py_retlist; +diff --git a/psutil/_psutil_posix.c b/psutil/_psutil_posix.c +index d9a8f6d..1be41dd 100644 +--- a/psutil/_psutil_posix.c ++++ b/psutil/_psutil_posix.c +@@ -324,11 +324,11 @@ psutil_net_if_addrs(PyObject* self, PyObject* args) { + goto error; + if (PyList_Append(py_retlist, py_tuple)) + goto error; +- Py_DECREF(py_tuple); +- Py_DECREF(py_address); +- Py_DECREF(py_netmask); +- Py_DECREF(py_broadcast); +- Py_DECREF(py_ptp); ++ Py_CLEAR(py_tuple); ++ Py_CLEAR(py_address); ++ Py_CLEAR(py_netmask); ++ Py_CLEAR(py_broadcast); ++ Py_CLEAR(py_ptp); + } + + freeifaddrs(ifaddr); +-- +2.23.0 + diff --git a/CVE-2019-18874-2.patch b/CVE-2019-18874-2.patch deleted file mode 100644 index 10baeafbe6a127665cdac9876fa5879337e427b4..0000000000000000000000000000000000000000 --- a/CVE-2019-18874-2.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 3a9bccfd2c6d2e6538298cd3892058b1204056e0 Mon Sep 17 00:00:00 2001 -From: Riccardo Schirone -Date: Mon, 18 Nov 2019 15:51:39 +0100 -Subject: [PATCH] psutil/_psutil_posix.c: better clear variables to ensure they - are NULL (#1624) - ---- - psutil/_psutil_posix.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/psutil/_psutil_posix.c b/psutil/_psutil_posix.c -index 209e787d5..aa6008491 100644 ---- a/psutil/_psutil_posix.c -+++ b/psutil/_psutil_posix.c -@@ -324,11 +324,11 @@ psutil_net_if_addrs(PyObject* self, PyObject* args) { - goto error; - if (PyList_Append(py_retlist, py_tuple)) - goto error; -- Py_DECREF(py_tuple); -- Py_DECREF(py_address); -- Py_DECREF(py_netmask); -- Py_DECREF(py_broadcast); -- Py_DECREF(py_ptp); -+ Py_CLEAR(py_tuple); -+ Py_CLEAR(py_address); -+ Py_CLEAR(py_netmask); -+ Py_CLEAR(py_broadcast); -+ Py_CLEAR(py_ptp); - } - - freeifaddrs(ifaddr); diff --git a/psutil-5.4.3.tar.gz b/psutil-5.4.3.tar.gz deleted file mode 100644 index 0dbcfe191ad3df878b4816159616ec71f7ecf198..0000000000000000000000000000000000000000 Binary files a/psutil-5.4.3.tar.gz and /dev/null differ diff --git a/psutil-5.6.3.tar.gz b/psutil-5.6.3.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..63e0f5b3a1fdddb5345ee3ff10fed2c8d19016af Binary files /dev/null and b/psutil-5.6.3.tar.gz differ diff --git a/python-psutil.spec b/python-psutil.spec index 0239f8b751fae200b62742ce221f34cc799e21f7..15c407bc5c9f4e3fc390cb5894ecf5a1827d924a 100644 --- a/python-psutil.spec +++ b/python-psutil.spec @@ -1,15 +1,13 @@ +%global _empty_manifest_terminate_build 0 Name: python-psutil -Version: 5.4.3 -Release: 10 -Summary: A library for retrieving information on running processes and system utilization in Python +Version: 5.6.3 +Release: 1 +Summary: Cross-platform lib for process and system monitoring in Python. License: BSD URL: https://github.com/giampaolo/psutil -Source0: https://github.com/giampaolo/psutil/archive/release-%{version}.tar.gz#/psutil-%{version}.tar.gz +Source0: https://files.pythonhosted.org/packages/1c/ca/5b8c1fe032a458c2c4bcbe509d1401dca9dda35c7fc46b36bb81c2834740/psutil-5.6.3.tar.gz -Patch0001: CVE-2019-18874-1.patch -Patch0002: CVE-2019-18874-2.patch - -BuildRequires: gcc python3-devel procps-ng python3-mock +Patch0001: 0001-Fix-CVE-2019-18874.patch %description psutil (process and system utilities) is a cross-platform library for retrieving information @@ -18,25 +16,37 @@ It is useful mainly for system monitoring, profiling and limiting process resour management of running processes.It implements many functionalities offered by classic UNIX command line tools such as ps, top, iotop, lsof, netstat, ifconfig, free and others. -%package -n python3-psutil -Summary: A library for retrieving information on running processes and system utilization in Python3 -%{?python_provide:%python_provide python3-psutil} - +%package -n python3-psutil +Summary: Cross-platform lib for process and system monitoring in Python. +Provides: python-psutil +# Base build requires +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pbr +BuildRequires: python3-pip +BuildRequires: python3-wheel +BuildRequires: python3-mock +BuildRequires: procps-ng +BuildRequires: gcc %description -n python3-psutil psutil (process and system utilities) is a cross-platform library for retrieving information -on running processes and system utilization (CPU, memory, disks, network, sensors) in Python3. +on running processes and system utilization (CPU, memory, disks, network, sensors) in Python. It is useful mainly for system monitoring, profiling and limiting process resources and management of running processes.It implements many functionalities offered by classic UNIX command line tools such as ps, top, iotop, lsof, netstat, ifconfig, free and others. -%prep -%autosetup -n psutil-release-%{version} -p1 +%package help +Summary: Cross-platform lib for process and system monitoring in Python. +Provides: python3-psutil-doc +%description help +psutil (process and system utilities) is a cross-platform library for retrieving information +on running processes and system utilization (CPU, memory, disks, network, sensors) in Python. +It is useful mainly for system monitoring, profiling and limiting process resources and +management of running processes.It implements many functionalities offered by classic UNIX +command line tools such as ps, top, iotop, lsof, netstat, ifconfig, free and others. -find psutil -name \*.py | while read file; do - sed -i.orig -e '1{/^#!/d}' $file && \ - touch -r $file.orig $file && \ - rm $file.orig -done +%prep +%autosetup -n psutil-%{version} -p1 %build %py3_build @@ -44,13 +54,42 @@ done %install %py3_install -%files -n python3-psutil -%license LICENSE -%doc CREDITS HISTORY.rst README.rst -%{python3_sitearch}/psutil/ -%{python3_sitearch}/*.egg-info +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-psutil -f filelist.lst +%dir %{python3_sitearch}/* + +%files help -f doclist.lst +%{_docdir}/* %changelog +* Tue Feb 08 2022 OpenStack_SIG - 5.6.3-1 +- Upgrade the version of python3-psutil to 5.6.3 + * Thur Jan 27 2022 lijiawei - 5.4.3-10 - Remove python2 support