diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-15 15:59:08 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-15 15:59:08 +0000 |
commit | 8b98be9556c88fb7cc231305fa707a6a18595738 (patch) | |
tree | f6bbd945cde0b5a2f97dc8fce2d7044c1bf7cb59 /build/output_dll_copy.rules | |
parent | 490ecb0178c9fa1059b5cabf057f52b4faafae77 (diff) | |
download | chromium_src-8b98be9556c88fb7cc231305fa707a6a18595738.zip chromium_src-8b98be9556c88fb7cc231305fa707a6a18595738.tar.gz chromium_src-8b98be9556c88fb7cc231305fa707a6a18595738.tar.bz2 |
Fix two races in DirectoryWatcherInotify:
1. In DirectoryWatcherImpl::Watch we have to initialize delegate_, root_path_
and other members before calling InotifyReader::AddWatch, because otherwise
the following race is possible:
1. InotifyReader::AddWatch
2. DirectoryWatcherImpl::OnInotifyEvent, where we want to use delegate_
and root_path_
3. Now-late initialization of delegate_ and root_path_ in DirectoryWatcherImpl::Watch
2. In InotifyReader::OnInotifyEvent we can't just copy things under a lock
and notify without a lock. Otherwise the following race is possible:
1. Things get copied in InotifyReader::OnInotifyEvent, lock is released
2. DirectoryWatcherImpl is destroyed, removing its watch
3. But it's still in the copied set of watchers to be notified. When we get
to notifying it, it's invalid, and we have a crash.
To fix race #2, I decided to just do everything under the lock. Notifications
shouldn't be a bottleneck, and I don't want to prematurely add more complexity.
TEST=Manually with RaceChecker, see bug.
http://crbug.com/15473
Review URL: http://codereview.chromium.org/149630
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20730 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/output_dll_copy.rules')
0 files changed, 0 insertions, 0 deletions