Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Issue 145953007: Revert "Fix race condition in concurrent printf and fopen." (Closed)

Created:
6 years, 10 months ago by Sam Clegg
Modified:
6 years, 10 months ago
Reviewers:
binji, Roland McGrath
CC:
native-client-reviews_googlegroups.com
Base URL:
http://git.chromium.org/native_client/nacl-newlib.git@master
Visibility:
Public.

Description

Revert "Fix race condition in concurrent printf and fopen." This reverts commit a46dfff66f8c8f13a7be3b78bd4c81ba0b94ccb0 since it introduced a possible deadlock between two threads calling fopen() and fclose(). See: http://codereview.chromium.org/7604003 fclose() takes two locks using _flockfile() and then later on __sfp_lock_acquire(). __sfp previously only took one lock using __sfp_lock_acquire but this change added an inner call to _flockfile() which causes deadlock. Although accessing the fp->flags in __sfp to check it against zero is technically a data race with any function that writes to it, this seems to be by design here. Specifically, AFAICT, the race with printf() can't change the outcome of the zero test since flags is guarantees to be non-zero both before and after the call or ORIENT(). So my conclusion is that tsan found a false positive here. BUG=338220 R=mcgrathr@chromium.org Committed: https://git.chromium.org/gitweb?p=native_client/nacl-newlib.git;a=commit;h=d28ae86 Committed: https://git.chromium.org/gitweb?p=native_client/nacl-newlib.git;a=commit;h=41e7008

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2 lines, -8 lines) Patch
M newlib/libc/stdio/findfp.c View 2 chunks +2 lines, -8 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Sam Clegg
6 years, 10 months ago (2014-01-29 00:05:21 UTC) #1
Roland McGrath
lgtm
6 years, 10 months ago (2014-01-30 00:08:03 UTC) #2
Sam Clegg
Committed patchset #1 manually as rd28ae86 (presubmit successful).
6 years, 10 months ago (2014-01-30 00:11:20 UTC) #3
Sam Clegg
6 years, 10 months ago (2014-01-30 00:12:09 UTC) #4
Message was sent while issue was closed.
Committed patchset #1 manually as r41e7008 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698