!423 sync patches from upstream
From: @hugel Reviewed-by: @xujing99 Signed-off-by: @xujing99
This commit is contained in:
commit
f603959ed7
@ -0,0 +1,64 @@
|
||||
From 1fbf8aeb4e78b8b4afeeaafcbc97b3cbf7cfeaba Mon Sep 17 00:00:00 2001
|
||||
From: Panu Matilainen <pmatilai@redhat.com>
|
||||
Date: Tue, 17 Sep 2024 08:31:35 +0300
|
||||
Subject: [PATCH] Enforce the same sanity checks on db add and rebuild
|
||||
|
||||
Conflict:adapt context; don't use RPMTAG_HEADERIMMUTABLE because
|
||||
e484d99 is not merged; use int type instead of bool in validHeader()
|
||||
Reference:https://github.com/rpm-software-management/rpm/commit/1fbf8aeb4e78b8b4afeeaafcbc97b3cbf7cfeaba
|
||||
|
||||
It doesn't make a whole lot of sense to allow inserting headers
|
||||
that will get removed as invalid on the next rebuild. Funny what
|
||||
oddities have survived all this time...
|
||||
|
||||
Fixes: #3306
|
||||
---
|
||||
lib/rpmdb.c | 18 +++++++++++++-----
|
||||
1 file changed, 13 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/lib/rpmdb.c b/lib/rpmdb.c
|
||||
index 3bf3457f3..dccdf80cd 100644
|
||||
--- a/lib/rpmdb.c
|
||||
+++ b/lib/rpmdb.c
|
||||
@@ -2176,6 +2176,17 @@ exit:
|
||||
return (rc == 0) ? RPMRC_OK : RPMRC_FAIL;
|
||||
}
|
||||
|
||||
+static int validHeader(Header h)
|
||||
+{
|
||||
+ if (!(headerIsEntry(h, RPMTAG_NAME) &&
|
||||
+ headerIsEntry(h, RPMTAG_VERSION) &&
|
||||
+ headerIsEntry(h, RPMTAG_RELEASE)))
|
||||
+ {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
int rpmdbAdd(rpmdb db, Header h)
|
||||
{
|
||||
dbiIndex dbi = NULL;
|
||||
@@ -2189,7 +2200,7 @@ int rpmdbAdd(rpmdb db, Header h)
|
||||
return 0;
|
||||
|
||||
hdrBlob = headerExport(h, &hdrLen);
|
||||
- if (hdrBlob == NULL || hdrLen == 0) {
|
||||
+ if (!validHeader(h) || hdrBlob == NULL || hdrLen == 0) {
|
||||
ret = -1;
|
||||
goto exit;
|
||||
}
|
||||
@@ -2424,10 +2435,7 @@ int rpmdbRebuild(const char * prefix, rpmts ts,
|
||||
while ((h = rpmdbNextIterator(mi)) != NULL) {
|
||||
|
||||
/* let's sanity check this record a bit, otherwise just skip it */
|
||||
- if (!(headerIsEntry(h, RPMTAG_NAME) &&
|
||||
- headerIsEntry(h, RPMTAG_VERSION) &&
|
||||
- headerIsEntry(h, RPMTAG_RELEASE)))
|
||||
- {
|
||||
+ if (!validHeader(h)) {
|
||||
rpmlog(RPMLOG_ERR,
|
||||
_("header #%u in the database is bad -- skipping.\n"),
|
||||
rpmdbGetIteratorOffset(mi));
|
||||
--
|
||||
2.33.0
|
||||
|
||||
27
backport-Fix-a-memory-leak-on-rpmdb-importdb.patch
Normal file
27
backport-Fix-a-memory-leak-on-rpmdb-importdb.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From 4b830f7b5a4a70a53e2eef63baf82b7fff308a3c Mon Sep 17 00:00:00 2001
|
||||
From: Panu Matilainen <pmatilai@redhat.com>
|
||||
Date: Fri, 11 Oct 2024 14:26:57 +0300
|
||||
Subject: [PATCH] Fix a memory leak on rpmdb --importdb
|
||||
|
||||
Conflict:modify rpmdb.c instead of tools/rpmdb.cc
|
||||
Reference:https://github.com/rpm-software-management/rpm/commit/4b830f7b5a4a70a53e2eef63baf82b7fff308a3c
|
||||
|
||||
---
|
||||
rpmdb.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/rpmdb.c b/rpmdb.c
|
||||
index 20d5d67bd..1736e1ef7 100644
|
||||
--- a/rpmdb.c
|
||||
+++ b/rpmdb.c
|
||||
@@ -79,6 +79,7 @@ static int importDB(rpmts ts)
|
||||
Header h;
|
||||
while ((h = headerRead(fd, HEADER_MAGIC_YES))) {
|
||||
rc += rpmtsImportHeader(txn, h, 0);
|
||||
+ headerFree(h);
|
||||
}
|
||||
} else {
|
||||
rc = -1;
|
||||
--
|
||||
2.33.0
|
||||
|
||||
35
backport-Fix-memleak-when-process-policies.patch
Normal file
35
backport-Fix-memleak-when-process-policies.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From 937e725626eecad2e0c34463e733ae123ba2ff5e Mon Sep 17 00:00:00 2001
|
||||
From: xujing <xujing125@huawei.com>
|
||||
Date: Thu, 12 Sep 2024 20:52:30 +0800
|
||||
Subject: [PATCH] Fix memleak when process policies
|
||||
|
||||
Conflict:NA
|
||||
Reference:https://github.com/rpm-software-management/rpm/commit/937e725626eecad2e0c34463e733ae123ba2ff5e
|
||||
|
||||
---
|
||||
build/policies.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/build/policies.c b/build/policies.c
|
||||
index 5d704c0eb..69062ee6a 100644
|
||||
--- a/build/policies.c
|
||||
+++ b/build/policies.c
|
||||
@@ -289,6 +289,7 @@ static rpmRC processPolicies(rpmSpec spec, Package pkg, int test)
|
||||
mod = freeModule(mod);
|
||||
name = _free(name);
|
||||
types = _free(types);
|
||||
+ optCon = poptFreeContext(optCon);
|
||||
}
|
||||
|
||||
rc = RPMRC_OK;
|
||||
@@ -297,6 +298,7 @@ static rpmRC processPolicies(rpmSpec spec, Package pkg, int test)
|
||||
freeModule(mod);
|
||||
free(name);
|
||||
free(types);
|
||||
+ poptFreeContext(optCon);
|
||||
|
||||
return rc;
|
||||
}
|
||||
--
|
||||
2.33.0
|
||||
|
||||
10
rpm.spec
10
rpm.spec
@ -1,6 +1,6 @@
|
||||
Name: rpm
|
||||
Version: 4.18.2
|
||||
Release: 19
|
||||
Release: 20
|
||||
Summary: RPM Package Manager
|
||||
License: GPL-2.0-or-later
|
||||
URL: https://rpm.org/
|
||||
@ -48,6 +48,9 @@ Patch6025: backport-Fix-crash-on-Lua-file-trigger-exiting-with-return-ed.patch
|
||||
Patch6026: backport-Fix-V-option-usage-in-our-tests.patch
|
||||
Patch6027: backport-Remove-libtool-la-symlinks.patch
|
||||
Patch6028: backport-Specify-the-private-key-in-rpm-addsign.patch
|
||||
Patch6029: backport-Fix-memleak-when-process-policies.patch
|
||||
Patch6030: backport-Enforce-the-same-sanity-checks-on-db-add-and-rebuild.patch
|
||||
Patch6031: backport-Fix-a-memory-leak-on-rpmdb-importdb.patch
|
||||
|
||||
Patch9000: Add-digest-list-plugin.patch
|
||||
Patch9001: Add-IMA-digest-list-support.patch
|
||||
@ -336,10 +339,13 @@ make clean
|
||||
%exclude %{_mandir}/man8/rpmspec.8*
|
||||
|
||||
%changelog
|
||||
* Mon Nov 25 2024 hugel<gengqihu2@h-partners.com> - 4.18.2-20
|
||||
- sync patches from upstream
|
||||
|
||||
* Sat Oct 26 2024 Funda Wang <fundawang@yeah.net> - 4.18.2-19
|
||||
- fix RPM_LD_FLAGS not got exported
|
||||
|
||||
* Fri Oct 25 2024 hugel<xuce10@h-partners.com> - 4.18.2-18
|
||||
* Fri Oct 25 2024 xuce<xuce10@h-partners.com> - 4.18.2-18
|
||||
- Separate the SELinux patch from the IMA digest list patch
|
||||
|
||||
* Sun Sep 29 2024 hugel<gengqihu2@h-partners.com> - 4.18.2-17
|
||||
|
||||
@ -117,7 +117,7 @@ index 0000000..d9c4832
|
||||
+#
|
||||
+# Support this by assuming that below each /usr/lib/python$VERSION/, all
|
||||
+# .pyc/.pyo files are to be compiled for /usr/bin/python$VERSION.
|
||||
+#
|
||||
+#
|
||||
+# For example, below /usr/lib/python2.6/, we're targeting /usr/bin/python2.6
|
||||
+# and below /usr/lib/python3.1/, we're targeting /usr/bin/python3.1
|
||||
+
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user