Compare commits

...

6 Commits
master ... f18

Author SHA1 Message Date
Panu Matilainen 3c10e6e6d5 - fix segfault on empty -p <lua> scriptlet body (#1004062) 2013-09-09 14:15:03 +03:00
Panu Matilainen fdb7b53492 - fix build-time double-free on file capability processing (#956190)
- check for stale locks when opening write-cursors (#860500)
- serialize BDB environment open/close (#924417)
2013-08-26 11:44:02 +03:00
Panu Matilainen 5e2777cb30 - update to 4.10.3.1 2013-02-06 11:42:04 +02:00
Panu Matilainen 91f8c6c095 - fix regression on paths shared between a real file/dir and a ghost 2013-01-28 14:38:42 +02:00
Panu Matilainen 53a566a073 - armv7hl and armv7hnl should not have -mthumb (#901901) 2013-01-28 14:32:43 +02:00
Panu Matilainen f9e8799702 - update to 4.10.2
- drop upstreamed patches
2012-12-10 12:38:02 +02:00
10 changed files with 254 additions and 65 deletions

2
.gitignore vendored
View File

@ -4,3 +4,5 @@
/rpm-4.10.0-beta1.tar.bz2
/rpm-4.10.0.tar.bz2
/rpm-4.10.1.tar.bz2
/rpm-4.10.2.tar.bz2
/rpm-4.10.3.1.tar.bz2

View File

@ -1,25 +0,0 @@
commit 90dd51743200055f30d9e0e0337173118b4ae756
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Thu Oct 11 17:57:10 2012 +0300
Fix noarch __isa_* macro filter in installplatform (RhBug:865436)
- The filter wasn't doing what it was supposed to due to extra single
quotes getting inserted, causing "rpmbuild --target noarch foo.spec"
to whine about empty macro bodies. This is a regression introduced
in rpm 4.10, commit 07ec480c180e4005a629242b8f9f8ab640e3e950 to be
precise.
diff --git a/installplatform b/installplatform
index f7ae241..a68b3c0 100755
--- a/installplatform
+++ b/installplatform
@@ -104,7 +104,7 @@ for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do
noarch)
CANONARCH=noarch
CANONCOLOR=0
- FILTER="grep -v -E '^(%optflag|%__isa)'"
+ FILTER="grep -v -E ^(%optflag|%__isa)"
;;
esac

View File

@ -1,32 +0,0 @@
commit df4eed5debcdc9209e1f5e66d17230861a55a7fc
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Wed Oct 10 10:37:34 2012 +0300
Filter out skipped files on hardlink checking (RhBug:864622)
- Legitimately skipped files (links) must not cause install-errors.
This has always been broken, but the errors were completely ignored
on install prior to rpm 4.10.
- Backported from commit eeea54c76b130da3769ae10f7db2c2fcfb5c57be
diff --git a/lib/fsm.c b/lib/fsm.c
index e4ffcaf..4840708 100644
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -1964,12 +1964,14 @@ static int fsmStage(FSM_t fsm, fileStage stage)
fsm->links = fsm->li->next;
fsm->li->next = NULL;
if (fsm->goal == FSM_PKGINSTALL && fsm->li->linksLeft) {
+ rpmfs fs = rpmteGetFileStates(fsmGetTe(fsm));
for (nlink_t i = 0 ; i < fsm->li->linksLeft; i++) {
- if (fsm->li->filex[i] < 0)
+ int ix = fsm->li->filex[i];
+ if (ix < 0 || XFA_SKIPPING(rpmfsGetAction(fs, ix)))
continue;
rc = CPIOERR_MISSING_HARDLINK;
if (fsm->failedFile && *fsm->failedFile == NULL) {
- fsm->ix = fsm->li->filex[i];
+ fsm->ix = ix;
if (!fsmMapPath(fsm)) {
/* Out-of-sync hardlinks handled as sub-state */
*fsm->failedFile = fsm->path;

View File

@ -0,0 +1,13 @@
diff --git a/build/files.c b/build/files.c
index 30061cf..df1eedf 100644
--- a/build/files.c
+++ b/build/files.c
@@ -1481,7 +1481,7 @@ static rpmRC addFile(FileList fl, const char * diskPath,
}
if (fl->currentCaps) {
- flp->caps = fl->currentCaps;
+ flp->caps = xstrdup(fl->currentCaps);
} else {
flp->caps = xstrdup("");
}

View File

@ -0,0 +1,58 @@
commit 918b2892b46036ac46f07c3156ed78b45e4e2ee2
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Tue Feb 5 10:11:19 2013 +0200
Check for stale db locks when opening write-cursors
- During long-running transactions its entirely possible for some
other player to come and go leaving stale locks behind and cause
the transaction to get stuck until the cavalry comes along in the
form of somebody else opening the rpmdb, clearing the blockage.
- Presumably dbenv->failchk() is not entirely free of cost so we only
do this for writes which are way more critical and also more prone to
getting stuck.
- dbenv->failchk() could return DB_RUNRECOVER in which case we should
abort everything but we lack a mechanism to do it... just add
a reminder comment for now.
(cherry picked from commit 29e7c4b3bd1e67f9de1eaaf9fecf82cae281a7e6)
diff --git a/lib/backend/db3.c b/lib/backend/db3.c
index bbf9577..ed2a5f8 100644
--- a/lib/backend/db3.c
+++ b/lib/backend/db3.c
@@ -244,7 +244,7 @@ dbiCursor dbiCursorInit(dbiIndex dbi, unsigned int flags)
DB * db = dbi->dbi_db;
DBC * cursor;
int cflags;
- int rc;
+ int rc = 0;
uint32_t eflags = db_envflags(db);
/* DB_WRITECURSOR requires CDB and writable db */
@@ -255,8 +255,23 @@ dbiCursor dbiCursorInit(dbiIndex dbi, unsigned int flags)
} else
cflags = 0;
- rc = db->cursor(db, NULL, &cursor, cflags);
- rc = cvtdberr(dbi, "db->cursor", rc, _debug);
+ /*
+ * Check for stale locks which could block writes "forever".
+ * XXX: Should we also do this on reads? Reads are less likely
+ * to get blocked so it seems excessive...
+ * XXX: On DB_RUNRECOVER, we should abort everything. Now
+ * we'll just fail to open a cursor again and again and again.
+ */
+ if (cflags & DB_WRITECURSOR) {
+ DB_ENV *dbenv = db->get_env(db);
+ rc = dbenv->failchk(dbenv, 0);
+ rc = cvtdberr(dbi, "dbenv->failchk", rc, _debug);
+ }
+
+ if (rc == 0) {
+ rc = db->cursor(db, NULL, &cursor, cflags);
+ rc = cvtdberr(dbi, "db->cursor", rc, _debug);
+ }
if (rc == 0) {
dbc = xcalloc(1, sizeof(*dbc));

View File

@ -0,0 +1,139 @@
commit 7e291848bcaea13b3d973901703ec3c760195335
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Tue May 28 08:56:22 2013 +0300
Serialize BDB environment open/close (RhBug:924417 etc)
- Introduce Yet Another Broken Lock[*] to serialize BDB environment open:
otherwise we can end up calling dbenv->failchk() while another process
is just joining the environment, leading to transient "Thread died in..."
DB_RUNRECOVER errors. Also prevents races on chrooted operations where
we remove the entire environment on close.
- This should also make it possible to handle at least some cases of
real DB_RUNRECOVER errors by just nuking the environment but that's
another topic...
[*] YABL as this is nowhere near foolproof or sufficient for all
the possible variants, but better than not having it...
(cherry picked from commit ad874d60e3804f1bcd64f3510e1e2dfbf81456cd)
diff --git a/lib/backend/db3.c b/lib/backend/db3.c
index ed2a5f8..f46c9ff 100644
--- a/lib/backend/db3.c
+++ b/lib/backend/db3.c
@@ -57,10 +57,42 @@ static uint32_t db_envflags(DB * db)
return eflags;
}
+/*
+ * Try to acquire db environment open/close serialization lock.
+ * Return the open, locked fd on success, -1 on failure.
+ */
+static int serialize_env(const char *dbhome)
+{
+ char *lock_path = rstrscat(NULL, dbhome, "/.dbenv.lock", NULL);
+ mode_t oldmask = umask(022);
+ int fd = open(lock_path, (O_RDWR|O_CREAT), 0644);
+ umask(oldmask);
+
+ if (fd >= 0) {
+ int rc;
+ struct flock info;
+ memset(&info, 0, sizeof(info));
+ info.l_type = F_WRLCK;
+ info.l_whence = SEEK_SET;
+ do {
+ rc = fcntl(fd, F_SETLKW, &info);
+ } while (rc == -1 && errno == EINTR);
+
+ if (rc == -1) {
+ close(fd);
+ fd = -1;
+ }
+ }
+
+ free(lock_path);
+ return fd;
+}
+
static int db_fini(rpmdb rdb, const char * dbhome)
{
DB_ENV * dbenv = rdb->db_dbenv;
int rc;
+ int lockfd = -1;
uint32_t eflags = 0;
if (dbenv == NULL)
@@ -72,6 +104,9 @@ static int db_fini(rpmdb rdb, const char * dbhome)
}
(void) dbenv->get_open_flags(dbenv, &eflags);
+ if (!(eflags & DB_PRIVATE))
+ lockfd = serialize_env(dbhome);
+
rc = dbenv->close(dbenv, 0);
rc = dbapi_err(rdb, "dbenv->close", rc, _debug);
@@ -89,6 +124,10 @@ static int db_fini(rpmdb rdb, const char * dbhome)
rpmlog(RPMLOG_DEBUG, "removed db environment %s\n", dbhome);
}
+
+ if (lockfd >= 0)
+ close(lockfd);
+
return rc;
}
@@ -122,6 +161,7 @@ static int db_init(rpmdb rdb, const char * dbhome)
DB_ENV *dbenv = NULL;
int rc, xx;
int retry_open = 2;
+ int lockfd = -1;
struct dbConfig_s * cfg = &rdb->cfg;
/* This is our setup, thou shall not have other setups before us */
uint32_t eflags = (DB_CREATE|DB_INIT_MPOOL|DB_INIT_CDB);
@@ -176,6 +216,24 @@ static int db_init(rpmdb rdb, const char * dbhome)
}
/*
+ * Serialize shared environment open (and clock) via fcntl() lock.
+ * Otherwise we can end up calling dbenv->failchk() while another
+ * process is joining the environment, leading to transient
+ * DB_RUNRECOVER errors. Also prevents races wrt removing the
+ * environment (eg chrooted operation). Silently fall back to
+ * private environment on failure to allow non-privileged queries
+ * to "work", broken as it might be.
+ */
+ if (!(eflags & DB_PRIVATE)) {
+ lockfd = serialize_env(dbhome);
+ if (lockfd < 0) {
+ eflags |= DB_PRIVATE;
+ retry_open--;
+ rpmlog(RPMLOG_DEBUG, "serialize failed, using private dbenv\n");
+ }
+ }
+
+ /*
* Actually open the environment. Fall back to private environment
* if we dont have permission to join/create shared environment or
* system doesn't support it..
@@ -208,6 +266,8 @@ static int db_init(rpmdb rdb, const char * dbhome)
rdb->db_dbenv = dbenv;
rdb->db_opens = 1;
+ if (lockfd >= 0)
+ close(lockfd);
return 0;
errxit:
@@ -216,6 +276,8 @@ errxit:
xx = dbenv->close(dbenv, 0);
xx = dbapi_err(rdb, "dbenv->close", xx, _debug);
}
+ if (lockfd >= 0)
+ close(lockfd);
return rc;
}

View File

@ -0,0 +1,12 @@
diff -up rpm-4.10.3.1/rpmio/rpmlua.c.empty-lua-script rpm-4.10.3.1/rpmio/rpmlua.c
--- rpm-4.10.3.1/rpmio/rpmlua.c.empty-lua-script 2012-10-31 14:23:49.000000000 +0200
+++ rpm-4.10.3.1/rpmio/rpmlua.c 2013-09-09 14:13:49.844888464 +0300
@@ -492,6 +492,8 @@ int rpmluaRunScript(rpmlua _lua, const c
int ret = 0;
if (name == NULL)
name = "<lua>";
+ if (script == NULL)
+ script = "";
if (luaL_loadbuffer(L, script, strlen(script), name) != 0) {
rpmlog(RPMLOG_ERR, _("invalid syntax in lua script: %s\n"),
lua_tostring(L, -1));

View File

@ -17,8 +17,8 @@ diff -uNr rpm-4.9.0-orig//rpmrc.in rpm-4.9.0/rpmrc.in
optflags: armv5tejl -O2 -g -march=armv5te
optflags: armv6l -O2 -g -march=armv6
optflags: armv7l -O2 -g -march=armv7
+optflags: armv7hl -O2 -g -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -mthumb
+optflags: armv7hnl -O2 -g -march=armv7-a -mfloat-abi=hard -mfpu=neon -mthumb
+optflags: armv7hl -O2 -g -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16
+optflags: armv7hnl -O2 -g -march=armv7-a -mfloat-abi=hard -mfpu=neon
optflags: atarist -O2 -g -fomit-frame-pointer
optflags: atariste -O2 -g -fomit-frame-pointer

View File

@ -11,7 +11,7 @@
%define rpmhome /usr/lib/rpm
%define rpmver 4.10.1
%define rpmver 4.10.3.1
%define srcver %{rpmver}%{?snapver:-%{snapver}}
%define bdbname libdb
@ -45,8 +45,10 @@ Patch5: rpm-4.9.90-armhfp.patch
Patch6: rpm-4.9.0-armhfp-logic.patch
# Patches already in upstream
Patch100: rpm-4.10.1-skipped-hardlinks.patch
Patch101: rpm-4.10.1-noarch-isa.patch
Patch100: rpm-4.10.x-caps-double-free.patch
Patch101: rpm-4.10.x-cursor-failchk.patch
Patch102: rpm-4.10.x-db-serialize.patch
Patch103: rpm-4.10.x-empty-lua-script.patch
# These are not yet upstream
Patch301: rpm-4.6.0-niagara.patch
@ -220,8 +222,10 @@ packages on a system.
%patch3 -p1 -b .no-man-dirs
%patch4 -p1 -b .use-gpg2
%patch100 -p1 -b .skipped-hardlinks
%patch101 -p1 -b .noarch-isa
%patch100 -p1 -b .caps-double-free
%patch101 -p1 -b .cursor-failchk
%patch102 -p1 -b .db-serialize
%patch103 -p1 -b .empty-lua-script
%patch301 -p1 -b .niagara
%patch302 -p1 -b .geode
@ -453,6 +457,24 @@ exit 0
%doc COPYING doc/librpm/html/*
%changelog
* Mon Sep 09 2013 Panu Matilainen <pmatilai@redhat.com> - 4.10.3.1-3
- fix segfault on empty -p <lua> scriptlet body (#1004062)
* Mon Aug 26 2013 Panu Matilainen <pmatilai@redhat.com> - 4.10.3.1-2
- fix build-time double-free on file capability processing (#956190)
- check for stale locks when opening write-cursors (#860500)
- serialize BDB environment open/close (#924417)
* Wed Feb 06 2013 Panu Matilainen <pmatilai@redhat.com> - 4.10.3.1-1
- update to 4.10.3.1 (http://rpm.org/wiki/Releases/4.10.3.1)
* Mon Jan 28 2013 Panu Matilainen <pmatilai@redhat.com> - 4.10.2-2
- armv7hl and armv7hnl should not have -mthumb (#901901)
- fix regression on paths shared between a real file/dir and a ghost
* Mon Dec 10 2012 Panu Matilainen <pmatilai@redhat.com> - 4.10.2-1
- update to 4.10.2 (http://rpm.org/wiki/Releases/4.10.2)
* Thu Oct 11 2012 Panu Matilainen <pmatilai@redhat.com> - 4.10.1-3
- fix noarch __isa_* macro filter in installplatform (#865436)

View File

@ -1 +1 @@
188b0de25d5d61439785e248828ee3b0 rpm-4.10.1.tar.bz2
7be152323885f6e558bd581f021e5add rpm-4.10.3.1.tar.bz2