!14 add check for device number in __check_lock_fn
From: @panxh_purple Reviewed-by: @xiezhipeng1 Signed-off-by: @xiezhipeng1
This commit is contained in:
commit
da039f66da
55
add-check-for-device-number-in-__check_lock_fn.patch
Normal file
55
add-check-for-device-number-in-__check_lock_fn.patch
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
From ad2bb7182132f6d15c207a8c0d37d24e241eb468 Mon Sep 17 00:00:00 2001
|
||||||
|
From: hanxinke <hanxinke@huawei.com>
|
||||||
|
Date: Fri, 11 Feb 2022 11:08:18 +0800
|
||||||
|
Subject: [PATCH] add check for device number in __check_lock_fn
|
||||||
|
|
||||||
|
When a file with the same inode as the inode of /var/lib/rpm/.rpm.lock
|
||||||
|
exists on another partition, package updates will also execute correctly
|
||||||
|
because of check for device.
|
||||||
|
|
||||||
|
---
|
||||||
|
src/os/os_flock.c | 11 ++++++++++-
|
||||||
|
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/os/os_flock.c b/src/os/os_flock.c
|
||||||
|
index 03aa3df..482dffa 100644
|
||||||
|
--- a/src/os/os_flock.c
|
||||||
|
+++ b/src/os/os_flock.c
|
||||||
|
@@ -10,6 +10,8 @@
|
||||||
|
|
||||||
|
#include "db_int.h"
|
||||||
|
|
||||||
|
+#include <linux/kdev_t.h>
|
||||||
|
+
|
||||||
|
#if !defined(HAVE_FCNTL) || !defined(HAVE_FLOCK)
|
||||||
|
static int __os_filelocking_notsup __P((ENV *));
|
||||||
|
#endif
|
||||||
|
@@ -34,6 +36,7 @@ int __check_lock_fn(fn, pid)
|
||||||
|
int i, inode;
|
||||||
|
struct stat st;
|
||||||
|
pid_t lpid = 0;
|
||||||
|
+ int f_major, f_minor, l_major, l_minor;
|
||||||
|
|
||||||
|
if (!fn)
|
||||||
|
return -1;
|
||||||
|
@@ -59,10 +62,16 @@ int __check_lock_fn(fn, pid)
|
||||||
|
/* Check the inode */
|
||||||
|
else if (i == 5) {
|
||||||
|
inode = 0;
|
||||||
|
- sscanf(token, "%*02x:%*02x:%d", &inode);
|
||||||
|
+ sscanf(token, "%02x:%02x:%d", &l_major, &l_minor, &inode);
|
||||||
|
/* Not the inode we are looking for */
|
||||||
|
if (inode != st.st_ino)
|
||||||
|
continue;
|
||||||
|
+
|
||||||
|
+ f_major = MAJOR(st.st_dev);
|
||||||
|
+ f_minor = MINOR(st.st_dev);
|
||||||
|
+ if ((f_major != l_major) || (f_minor != l_minor))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* We have the correct file.
|
||||||
|
* We are either looking for a specific process or we do not care at all.
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
||||||
26
libdb.spec
26
libdb.spec
@ -1,6 +1,6 @@
|
|||||||
Name: libdb
|
Name: libdb
|
||||||
Version: 5.3.28
|
Version: 5.3.28
|
||||||
Release: 38
|
Release: 39
|
||||||
Summary: The Berkeley DB database library for C
|
Summary: The Berkeley DB database library for C
|
||||||
License: BSD and LGPLv2 and Sleepycat
|
License: BSD and LGPLv2 and Sleepycat
|
||||||
URL: https://www.oracle.com/database/berkeley-db/
|
URL: https://www.oracle.com/database/berkeley-db/
|
||||||
@ -34,11 +34,11 @@ Patch35: checkpoint-opd-deadlock.patch
|
|||||||
Patch36: db-5.3.28-atomic_compare_exchange.patch
|
Patch36: db-5.3.28-atomic_compare_exchange.patch
|
||||||
Patch37: backport-CVE-2019-2708-Resolved-data-store-execution-which-led-to-partial-DoS.patch
|
Patch37: backport-CVE-2019-2708-Resolved-data-store-execution-which-led-to-partial-DoS.patch
|
||||||
|
|
||||||
Patch9000: bugfix-fix-deadlock-on-mempool-file-locks.patch
|
Patch38: bugfix-fix-deadlock-on-mempool-file-locks.patch
|
||||||
|
Patch39: libdb-limit-cpu.patch
|
||||||
Patch9001: libdb-limit-cpu.patch
|
patch40: libdb-cbd-race.patch
|
||||||
patch9002: libdb-cbd-race.patch
|
Patch41: fix-a-potential-infinite-loop.patch
|
||||||
Patch9003: fix-a-potential-infinite-loop.patch
|
Patch42: add-check-for-device-number-in-__check_lock_fn.patch
|
||||||
|
|
||||||
BuildRequires: gcc gcc-c++ perl-interpreter libtool tcl-devel >= 8.5.2-3
|
BuildRequires: gcc gcc-c++ perl-interpreter libtool tcl-devel >= 8.5.2-3
|
||||||
BuildRequires: java-devel >= 1:1.6.0 chrpath zlib-devel
|
BuildRequires: java-devel >= 1:1.6.0 chrpath zlib-devel
|
||||||
@ -115,12 +115,11 @@ popd
|
|||||||
%patch35 -p1
|
%patch35 -p1
|
||||||
%patch36 -p1
|
%patch36 -p1
|
||||||
%patch37 -p1
|
%patch37 -p1
|
||||||
|
%patch38 -p1
|
||||||
%patch9000 -p1
|
%patch39 -p1
|
||||||
|
%patch40 -p1
|
||||||
%patch9001 -p1
|
%patch41 -p1
|
||||||
%patch9002 -p1
|
%patch42 -p1
|
||||||
%patch9003 -p1
|
|
||||||
|
|
||||||
pushd dist
|
pushd dist
|
||||||
./s_config
|
./s_config
|
||||||
@ -213,6 +212,9 @@ mv man/* %{buildroot}%{_mandir}/man1/
|
|||||||
%{_mandir}/man1
|
%{_mandir}/man1
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jun 28 2022 panxiaohe <panxh.life@foxmail.com> - 5.3.28-39
|
||||||
|
- add check for device number in __check_lock_fn
|
||||||
|
|
||||||
* Tue Jun 21 2022 Kou Wenqi <kouwenqi@kylinos.cn> - 5.3.28-38
|
* Tue Jun 21 2022 Kou Wenqi <kouwenqi@kylinos.cn> - 5.3.28-38
|
||||||
- Fix a potential infinite loop
|
- Fix a potential infinite loop
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user