[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit b158a601c9070edea22a728f6a45d961fc20923f
Author: Mike Perry <mikeperry-git@xxxxxxxxxx>
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@xxxxxxxxxxxxxx>
+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
+

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits