Closed
Bug 1406793
Opened 7 years ago
Closed 7 years ago
IsWindowsVersionOrLater/IsWindowsBuildOrLater/IsWindows10BuildOrLater aren't thread safe
Categories
(Core :: MFBT, enhancement)
Tracking
()
RESOLVED
FIXED
mozilla58
Tracking | Status | |
---|---|---|
firefox58 | --- | fixed |
People
(Reporter: jya, Assigned: jya)
References
Details
Attachments
(1 file)
IsWindowsBuildOrLater and IsWindows10BuildOrLater store previous results (to speed up future access I guess) in static variables. Both IsWindows10BuildOrLater and IsWindows10BuildOrLater are called from various threads. There's no locking mechanism to protect the way those results are stored or access.
Comment 1•7 years ago
|
||
How does it matter? The worst that can happen is that the function code runs twice, gets the same value twice, and stores the same value twice.
Assignee | ||
Comment 2•7 years ago
|
||
The writes being non atomic, if you have simultaneous write access to the variable, the result is undefined. As such, the result of the next run is also undefined. Of all people, data races should always be a concern.
Comment hidden (mozreview-request) |
Attachment #8916538 -
Flags: review?(nfroyd)
Assignee: nobody → jyavenard
Assignee | ||
Comment 4•7 years ago
|
||
Thanks David for fixing the reviewer...
Comment 5•7 years ago
|
||
mozreview-review |
Comment on attachment 8916538 [details] Bug 1406793 - Make IsWindows* methods thread-safe. https://reviewboard.mozilla.org/r/187674/#review192870 If this was cross-platform code, I think I would care a little more about efficiency, but since this is Windows-only and we'll always be executing on x86, where sequentially consistent atomics are less of a problem (particularly for loads, which is what matters here), I think this is OK.
Attachment #8916538 -
Flags: review?(nfroyd) → review+
Assignee | ||
Comment 6•7 years ago
|
||
mozreview-review-reply |
Comment on attachment 8916538 [details] Bug 1406793 - Make IsWindows* methods thread-safe. https://reviewboard.mozilla.org/r/187674/#review192870 thanks for the review. im interested to know however, how you could make this more efficient on other platforms. as it, the code quickly settle in a state wheremthe first two comparisons handle all cases, and the main code never runs
Pushed by jyavenard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4bf0f40c6755 Make IsWindows* methods thread-safe. r=froydnj
Comment 8•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/4bf0f40c6755
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox58:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in
before you can comment on or make changes to this bug.
Description
•