[29597] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Avoid byte-swap cache corruption in libdb2

daemon@ATHENA.MIT.EDU (Tom Yu)
Tue Aug 30 15:07:47 2016

Date: Tue, 30 Aug 2016 15:07:42 -0400
From: Tom Yu <tlyu@mit.edu>
Message-Id: <201608301907.u7UJ7gq9016408@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/56d02135d4c77b6aa0cb7136477d426248c60a6f
commit 56d02135d4c77b6aa0cb7136477d426248c60a6f
Author: Tom Yu <tlyu@mit.edu>
Date:   Thu Aug 25 18:02:56 2016 -0400

    Avoid byte-swap cache corruption in libdb2
    
    Apply a patch from NetBSD to restore the cached copy of a page to the
    machine byte order after a write operation swapped it to the file byte
    order.  As a regression test, modify test13 to sync the database file
    after each put to exercise this bug.
    
    ticket: 8483 (new)
    target_version: 1.14-next
    target_version: 1.13-next
    tags: pullup

 src/plugins/kdb/db2/libdb2/mpool/mpool.c |    8 ++++++++
 src/plugins/kdb/db2/libdb2/test/run.test |    1 +
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/plugins/kdb/db2/libdb2/mpool/mpool.c b/src/plugins/kdb/db2/libdb2/mpool/mpool.c
index 79ad613..e1de679 100644
--- a/src/plugins/kdb/db2/libdb2/mpool/mpool.c
+++ b/src/plugins/kdb/db2/libdb2/mpool/mpool.c
@@ -432,6 +432,14 @@ mpool_write(mp, bp)
 	if (write(mp->fd, bp->page, mp->pagesize) != mp->pagesize)
 		return (RET_ERROR);
 
+	/*
+	 * Re-run through the input filter since this page may soon be
+	 * accessed via the cache, and whatever the user's output filter
+	 * did may screw things up if we don't let the input filter
+	 * restore the in-core copy.
+	 */
+	if (mp->pgin)
+		(mp->pgin)(mp->pgcookie, bp->pgno, bp->page);
 	bp->flags &= ~MPOOL_DIRTY;
 	return (RET_SUCCESS);
 }
diff --git a/src/plugins/kdb/db2/libdb2/test/run.test b/src/plugins/kdb/db2/libdb2/test/run.test
index caf6989..728a70f 100644
--- a/src/plugins/kdb/db2/libdb2/test/run.test
+++ b/src/plugins/kdb/db2/libdb2/test/run.test
@@ -614,6 +614,7 @@ test13()
 				echo p
 				echo k$i
 				echo d$i
+				echo S
 				echo g
 				echo k$i
 			done > $TMP2
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post