[tor-commits] [torbrowser/maint-2.2] Add a patch to fix cache race condition issues.

mikeperry at torproject.org mikeperry at torproject.org
Tue May 1 22:48:32 UTC 2012


commit b158a601c9070edea22a728f6a45d961fc20923f
Author: Mike Perry <mikeperry-git at fscked.org>
Date:   Tue May 1 15:46:49 2012 -0700

    Add a patch to fix cache race condition issues.
    
    https://trac.torproject.org/projects/tor/ticket/5715
---
 ...-nsICacheService.EvictEntries-synchronous.patch |   44 ++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/src/current-patches/firefox/0017-Make-nsICacheService.EvictEntries-synchronous.patch b/src/current-patches/firefox/0017-Make-nsICacheService.EvictEntries-synchronous.patch
new file mode 100644
index 0000000..5354027
--- /dev/null
+++ b/src/current-patches/firefox/0017-Make-nsICacheService.EvictEntries-synchronous.patch
@@ -0,0 +1,44 @@
+From f7bdc9274aa6dc8efccc50d18dbb287225aa6c27 Mon Sep 17 00:00:00 2001
+From: Mike Perry <mikeperry-git at torproject.org>
+Date: Tue, 1 May 2012 15:02:03 -0700
+Subject: [PATCH 17/17] Make nsICacheService.EvictEntries synchronous
+
+This fixes a race condition that allows cache-based EverCookies to persist for
+a brief time (on the order of minutes?) after cache clearing/"New Identity".
+
+https://trac.torproject.org/projects/tor/ticket/5715
+---
+ netwerk/cache/nsCacheService.cpp |   15 +++++++++++++--
+ 1 files changed, 13 insertions(+), 2 deletions(-)
+
+diff --git a/netwerk/cache/nsCacheService.cpp b/netwerk/cache/nsCacheService.cpp
+index 015e49e..1ef0db1 100644
+--- a/netwerk/cache/nsCacheService.cpp
++++ b/netwerk/cache/nsCacheService.cpp
+@@ -1415,10 +1415,21 @@ NS_IMETHODIMP nsCacheService::VisitEntries(nsICacheVisitor *visitor)
+     return NS_OK;
+ }
+ 
+-
+ NS_IMETHODIMP nsCacheService::EvictEntries(nsCacheStoragePolicy storagePolicy)
+ {
+-    return  EvictEntriesForClient(nsnull, storagePolicy);
++    NS_IMETHODIMP r;
++    r = EvictEntriesForClient(nsnull, storagePolicy);
++
++    // XXX: Bloody hack until we get this notifier in FF14.0:
++    // https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsICacheListener#onCacheEntryDoomed%28%29
++    if (storagePolicy == nsICache::STORE_ANYWHERE &&
++            NS_IsMainThread() && gService && gService->mInitialized) {
++        nsCacheServiceAutoLock lock;
++        gService->DoomActiveEntries();
++        gService->ClearDoomList();
++        (void) SyncWithCacheIOThread();
++    }
++    return r; 
+ }
+ 
+ NS_IMETHODIMP nsCacheService::GetCacheIOTarget(nsIEventTarget * *aCacheIOTarget)
+-- 
+1.7.5.4
+



More information about the tor-commits mailing list