Fix bad order of syscalls causing high CPU usage

Resolves: #2002186
This commit is contained in:
Filip Januš 2021-09-13 14:57:14 +02:00
parent 6f7cc26613
commit 1cbf51eb87
2 changed files with 27 additions and 1 deletions

View File

@ -0,0 +1,19 @@
Author: Filip Januš <fjanus@redhat.com>
Date: 6 Sep 2021
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1992402
Patch was created based on the discussion in the previous link
diff -ur db-5.3.28/src/os/os_map.c db_patch/src/os/os_map.c
--- db-5.3.28/src/os/os_map.c 2013-09-09 17:35:09.000000000 +0200
+++ db_patch/src/os/os_map.c 2021-09-09 07:33:12.027328265 +0200
@@ -213,7 +213,10 @@
if (rp->max < rp->size)
rp->max = rp->size;
if (ret == 0 && F_ISSET(infop, REGION_CREATE)) {
- if (F_ISSET(dbenv, DB_ENV_REGION_INIT))
+
+ rp->size = rp->max;
+
+ if (F_ISSET(dbenv, DB_ENV_REGION_INIT))
ret = __db_file_write(env, infop->fhp,
rp->size / MEGABYTE, rp->size % MEGABYTE, 0x00);
else

View File

@ -5,7 +5,7 @@
Summary: The Berkeley DB database library for C
Name: libdb
Version: 5.3.28
Release: 51%{?dist}
Release: 52%{?dist}
Source0: http://download.oracle.com/berkeley-db/db-%{version}.tar.gz
Source1: http://download.oracle.com/berkeley-db/db.1.85.tar.gz
# For mt19937db.c
@ -58,6 +58,7 @@ Patch39: libdb-5.3.21-trickle_cpu.patch
Patch40: db-5.3.28_cve-2019-2708.patch
# Downstream covscan patch
Patch41: db-5.3.28-fix-CWE-686-398.patch
Patch42: db-5.3.28-mmap-high-cpu-usage.patch
URL: http://www.oracle.com/database/berkeley-db/
License: BSD and LGPLv2 and Sleepycat
@ -229,6 +230,7 @@ popd
%patch39 -p1
%patch40 -p1 -b .cve-2019-2708
%patch41 -p1
%patch42 -p1
cd dist
./s_config
@ -390,6 +392,11 @@ mv man/* ${RPM_BUILD_ROOT}%{_mandir}/man1
%{_includedir}/%{name}/dbsql.h
%changelog
* Mon Sep 13 2021 Filip Januš <fjanus@redhat.com> - 5.3.28-52
- Bad order of sys calls cause high CPU usage
- Related: #2002186
- Patch no. 42 was added
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 5.3.28-51
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688