46 lines
1.5 KiB
Diff
46 lines
1.5 KiB
Diff
From 85b51e2dcf2a0a6393d2fbc51b78d5398e5ffeed Mon Sep 17 00:00:00 2001
|
|
From: Michael Schroeder <mls@suse.de>
|
|
Date: Tue, 14 Apr 2020 10:44:11 +0200
|
|
Subject: [PATCH] ndb: also copy the mapped pointer when keeping a slot
|
|
|
|
We forgot to copy the mapped pointer if a slot was kept when
|
|
re-syncing after a generation mismatch. This led to the mapped
|
|
pointer being zero even if the map callback was set.
|
|
Also add an extra test for the map callback before setting the
|
|
protection flag to PROT_READ.
|
|
|
|
Found by testing the code with different mapping protection flags.
|
|
See the next commits.
|
|
|
|
URL:https://github.com/rpm-software-management/rpm/commit/85b51e2dcf2a0a6393d2fbc51b78d5398e5ffeed
|
|
---
|
|
lib/backend/ndb/rpmxdb.c | 5 ++++-
|
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/lib/backend/ndb/rpmxdb.c b/lib/backend/ndb/rpmxdb.c
|
|
index 5136fbc..354a098 100644
|
|
--- a/lib/backend/ndb/rpmxdb.c
|
|
+++ b/lib/backend/ndb/rpmxdb.c
|
|
@@ -369,6 +369,8 @@ static int rpmxdbReadHeader(rpmxdb xdb)
|
|
nslot->mapcallback(xdb, nslot->mapcallbackdata, 0, 0);
|
|
}
|
|
}
|
|
+ } else {
|
|
+ nslot->mapped = slot->mapped;
|
|
}
|
|
}
|
|
}
|
|
@@ -624,7 +626,8 @@ static int moveblobto(rpmxdb xdb, struct xdb_slot *oldslot, struct xdb_slot *aft
|
|
didmap = 0;
|
|
oldpagecnt = oldslot->pagecnt;
|
|
if (!oldslot->mapped && oldpagecnt) {
|
|
- oldslot->mapflags = PROT_READ;
|
|
+ if (!oldslot->mapcallback)
|
|
+ oldslot->mapflags = PROT_READ;
|
|
if (mapslot(xdb, oldslot))
|
|
return RPMRC_FAIL;
|
|
didmap = 1;
|
|
--
|
|
1.8.3.1
|
|
|