Closed Bug 1533530 Opened 7 years ago Closed 5 years ago

Data race in FilePreferences

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: ytausky, Unassigned)

References

(Blocks 1 open bug)

Details

In this report FilePreferences::InitPrefs is racing with FilePreferences::IsAllowedPath:

WARNING: ThreadSanitizer: data race (pid=65550)
  Write of size 8 at 0x0001106c0d80 by main thread:
    #0 mozilla::FilePreferences::InitPrefs() StaticPtr.h:92 (XUL:x86_64+0x12f570)
    #1 XREMain::XRE_mainRun() nsAppRunner.cpp:4369 (XUL:x86_64+0x7990d6f)
    #2 XREMain::XRE_main(int, char**, mozilla::BootstrapConfig const&) nsAppRunner.cpp:4682 (XUL:x86_64+0x799326d)
    #3 XRE_main(int, char**, mozilla::BootstrapConfig const&) nsAppRunner.cpp:4766 (XUL:x86_64+0x7993c62)
    #4 mozilla::BootstrapImpl::XRE_main(int, char**, mozilla::BootstrapConfig const&) Bootstrap.cpp:39 (XUL:x86_64+0x79a7bb7)
    #5 main nsBrowserApp.cpp:214 (firefox:x86_64+0x100001b63)

  Previous read of size 8 at 0x0001106c0d80 by thread T4:
    #0 mozilla::FilePreferences::IsAllowedPath(nsTSubstring<char> const&) StaticPtr.h:63 (XUL:x86_64+0x1301f9)
    #1 nsLocalFile::Create(unsigned int, unsigned int) nsLocalFileUnix.cpp:492 (XUL:x86_64+0x121ccc)
    #2 nsLocalFile::CreateUnique(unsigned int, unsigned int) nsLocalFileCommon.cpp:252 (XUL:x86_64+0x15a51d)
    #3 nsAtomicFileOutputStream::DoOpen() nsFileStreams.cpp:804 (XUL:x86_64+0x342d0b)
    #4 nsFileStreamBase::MaybeOpen(nsIFile*, int, int, bool) nsFileStreams.cpp:290 (XUL:x86_64+0x33e905)
    #5 non-virtual thunk to nsAtomicFileOutputStream::Init(nsIFile*, int, int, int) nsFileStreams.cpp:719 (XUL:x86_64+0x342a03)
    #6 NS_NewSafeLocalFileOutputStream(nsIOutputStream**, nsIFile*, int, int, int) nsNetUtil.cpp:1206 (XUL:x86_64+0x374ca4)
    #7 mozilla::PreferencesWriter::Write(nsIFile*, nsTArray<nsTString<char> >&) Preferences.cpp:2967 (XUL:x86_64+0x25975a)
    #8 mozilla::PWRunnable::Run() Preferences.cpp:3052 (XUL:x86_64+0x273096)
    #9 nsThreadPool::Run() nsThreadPool.cpp:241 (XUL:x86_64+0x1eb640)
    #10 non-virtual thunk to nsThreadPool::Run() nsThreadPool.cpp (XUL:x86_64+0x1ebabd)
    #11 nsThread::ProcessNextEvent(bool, bool*) nsThread.cpp:1179 (XUL:x86_64+0x1e1c38)
    #12 NS_ProcessNextEvent(nsIThread*, bool) nsThreadUtils.cpp:482 (XUL:x86_64+0x1e7842)
    #13 mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) MessagePump.cpp:333 (XUL:x86_64+0xbe88ac)
    #14 MessageLoop::RunInternal() message_loop.cc:315 (XUL:x86_64+0xb54d5d)
    #15 MessageLoop::Run() message_loop.cc:308 (XUL:x86_64+0xb54c08)
    #16 nsThread::ThreadFunc(void*) nsThread.cpp:454 (XUL:x86_64+0x1dccff)
    #17 _pt_root ptthread.c:201 (libnss3.dylib:x86_64+0x22280c)

  Location is global 'mozilla::FilePreferences::sBlacklist' at 0x0001106c0d80 (XUL+0x00000cb51d80)

  Thread T4 (tid=1568664, running) created by main thread at:
    #0 pthread_create tsan_interceptors.cc:965 (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x931d)
    #1 _PR_CreateThread ptthread.c:433 (libnss3.dylib:x86_64+0x21befe)
    #2 PR_CreateThread ptthread.c:518 (libnss3.dylib:x86_64+0x20e237)
    #3 nsThread::Init(nsTSubstring<char> const&) nsThread.cpp:660 (XUL:x86_64+0x1de6b5)
    #4 nsThreadManager::NewNamedThread(nsTSubstring<char> const&, unsigned int, nsIThread**) nsThreadManager.cpp:416 (XUL:x86_64+0x1e67eb)
    #5 NS_NewNamedThread(nsTSubstring<char> const&, nsIThread**, nsIRunnable*, unsigned int) nsThreadUtils.cpp:135 (XUL:x86_64+0x1ea7bf)
    #6 nsThreadPool::PutEvent(already_AddRefed<nsIRunnable>, unsigned int) nsThreadPool.cpp:110 (XUL:x86_64+0x1ea367)
    #7 nsThreadPool::Dispatch(already_AddRefed<nsIRunnable>, unsigned int) nsThreadPool.cpp:287 (XUL:x86_64+0x1ebda8)
    #8 mozilla::net::nsStreamTransportService::Dispatch(already_AddRefed<nsIRunnable>, unsigned int) nsStreamTransportService.cpp:216 (XUL:x86_64+0x3eee89)
    #9 non-virtual thunk to mozilla::net::nsStreamTransportService::Dispatch(already_AddRefed<nsIRunnable>, unsigned int) nsStreamTransportService.cpp (XUL:x86_64+0x3ef05d)
    #10 mozilla::dom::ServiceWorkerRegistrar::ProfileStarted() ServiceWorkerRegistrar.cpp:1117 (XUL:x86_64+0x53669eb)
    #11 mozilla::dom::ServiceWorkerRegistrar::Observe(nsISupports*, char const*, char16_t const*) ServiceWorkerRegistrar.cpp:1246 (XUL:x86_64+0x5367281)
    #12 nsObserverList::NotifyObservers(nsISupports*, char const*, char16_t const*) nsObserverList.cpp:66 (XUL:x86_64+0x102c65)
    #13 nsObserverService::NotifyObservers(nsISupports*, char const*, char16_t const*) nsObserverService.cpp:293 (XUL:x86_64+0x1073ed)
    #14 nsXREDirProvider::DoStartup() nsXREDirProvider.cpp:1015 (XUL:x86_64+0x79a5dc5)
    #15 XREMain::XRE_mainRun() nsAppRunner.cpp:4364 (XUL:x86_64+0x7990d65)
    #16 XREMain::XRE_main(int, char**, mozilla::BootstrapConfig const&) nsAppRunner.cpp:4682 (XUL:x86_64+0x799326d)
    #17 XRE_main(int, char**, mozilla::BootstrapConfig const&) nsAppRunner.cpp:4766 (XUL:x86_64+0x7993c62)
    #18 mozilla::BootstrapImpl::XRE_main(int, char**, mozilla::BootstrapConfig const&) Bootstrap.cpp:39 (XUL:x86_64+0x79a7bb7)
    #19 main nsBrowserApp.cpp:214 (firefox:x86_64+0x100001b63)

SUMMARY: ThreadSanitizer: data race StaticPtr.h:92 in mozilla::FilePreferences::InitPrefs()

This looks like it was fixed in bug 1561912.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
See Also: → 1561912
You need to log in before you can comment on or make changes to this bug.