WebKit Bugzilla
Attachment 341420 Details for
Bug 186017
: [WTF] RandomDevice should be initialized inside std::call_once
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186017-20180527225818.patch (text/plain), 1.57 KB, created by
Yusuke Suzuki
on 2018-05-27 06:58:19 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yusuke Suzuki
Created:
2018-05-27 06:58:19 PDT
Size:
1.57 KB
patch
obsolete
>Subversion Revision: 232227 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 229f30316c5817b1815a85799a77a8a64c0d99b8..afb549736e520a167cac84b58f3b84036ebddd04 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,17 @@ >+2018-05-27 Yusuke Suzuki <utatane.tea@gmail.com> >+ >+ [WTF] RandomDevice should be initialized inside std::call_once >+ https://bugs.webkit.org/show_bug.cgi?id=186017 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ While Linux ports uses mutex-guarded static variables, Mac ports do not. >+ So we should guard static variables' initialization by using std::call_once. >+ This patch does it for RandomDevice. >+ >+ * wtf/OSRandomSource.cpp: >+ (WTF::cryptographicallyRandomValuesFromOS): >+ > 2018-05-26 Filip Pizlo <fpizlo@apple.com> > > testair sometimes crashes due to races in initialization of ARC4RandomNumberGenerator >diff --git a/Source/WTF/wtf/OSRandomSource.cpp b/Source/WTF/wtf/OSRandomSource.cpp >index c3d08957861e469c0f5c8abb5acb7abf1204e949..8133943bec39d3b777385ebce655aaa5372c8e6e 100644 >--- a/Source/WTF/wtf/OSRandomSource.cpp >+++ b/Source/WTF/wtf/OSRandomSource.cpp >@@ -33,7 +33,13 @@ namespace WTF { > > void cryptographicallyRandomValuesFromOS(unsigned char* buffer, size_t length) > { >- static NeverDestroyed<RandomDevice> device; >+ static LazyNeverDestroyed<RandomDevice> device; >+ static std::once_flag onceFlag; >+ std::call_once( >+ onceFlag, >+ [] { >+ device.construct(); >+ }); > device.get().cryptographicallyRandomValues(buffer, length); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186017
:
341420
|
343674