WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
173720
initializeThreading() [first] causes WTFCrash due to maxSingleAllocationSize not being initialized
https://bugs.webkit.org/show_bug.cgi?id=173720
Summary
initializeThreading() [first] causes WTFCrash due to maxSingleAllocationSize ...
Vladimir Vukicevic
Reported
2017-06-22 09:38:52 PDT
This is probably an edge case, but -- in a JSC static build that gets linked into another DLL, and that DLL does some dumb stuff from static constructors, such as JSClassCreate, I get this crash because maxSingleAllocationSize is still 0 (it's set by Options::initialize() which hasn't been called yet by initializeThreading()) -- lambdas and other junk omitted from stack: WTFCrash() WTF::fastMalloc(unsigned __int64 n) WTF::Lock::operator new(unsigned __int64 size) std::make_unique<WTF::Lock>() WTF::threadMap() WTF::ThreadHolder::initializeOnce() WTF::initializeThreading() JSC::initializeThreading::__l2::<lambda>() JSC::initializeThreading() JSClassCreate(const JSClassDefinition * definition) ... I don't know if this is valid (to do stuff like JSClassCreate from constructors without doing explicit engine initialization), but it worked on older versions of jscore.
Attachments
Patch
(1.65 KB, patch)
2017-06-23 01:55 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Vladimir Vukicevic
Comment 1
2017-06-22 09:40:43 PDT
Actually, now that I look closer.. I don't get how it's not initialized to size_t::max(), but is 0, other than static initializer order goop since it's initialized using 'std::numeric_limits<size_t>::max();' ?
Vladimir Vukicevic
Comment 2
2017-06-22 09:49:38 PDT
Yep, changing the static initializer to a simple "= SIZE_MAX;" fixes this.
Vladimir Vukicevic
Comment 3
2017-06-22 09:59:08 PDT
VS 2017 (cl 19.10.25019). max() is constexpr, so, I dunno why!
Yusuke Suzuki
Comment 4
2017-06-23 01:49:39 PDT
(In reply to Vladimir Vukicevic from
comment #3
)
> VS 2017 (cl 19.10.25019). max() is constexpr, so, I dunno why!
Hmmmmm, yeah, that is strange. In the meantime, we just use SIZE_MAX.
Yusuke Suzuki
Comment 5
2017-06-23 01:51:02 PDT
(In reply to Vladimir Vukicevic from
comment #0
)
> This is probably an edge case, but -- in a JSC static build that gets linked > into another DLL, and that DLL does some dumb stuff from static > constructors, such as JSClassCreate, I get this crash because > maxSingleAllocationSize is still 0 (it's set by Options::initialize() which > hasn't been called yet by initializeThreading()) -- lambdas and other junk > omitted from stack: > > WTFCrash() > WTF::fastMalloc(unsigned __int64 n) > WTF::Lock::operator new(unsigned __int64 size) > std::make_unique<WTF::Lock>() > WTF::threadMap() > WTF::ThreadHolder::initializeOnce() > WTF::initializeThreading() > JSC::initializeThreading::__l2::<lambda>() > JSC::initializeThreading() > JSClassCreate(const JSClassDefinition * definition) > ... > > I don't know if this is valid (to do stuff like JSClassCreate from > constructors without doing explicit engine initialization), but it worked on > older versions of jscore.
Basically, we do not allow static constructors in WebKit. If we use static constructors, mac build with clang will fail due to the option restricting static constructors.
Yusuke Suzuki
Comment 6
2017-06-23 01:55:39 PDT
Created
attachment 313700
[details]
Patch
Mark Lam
Comment 7
2017-06-25 14:11:53 PDT
Comment on
attachment 313700
[details]
Patch r=me
Yusuke Suzuki
Comment 8
2017-06-25 14:14:29 PDT
Comment on
attachment 313700
[details]
Patch Thanks!
WebKit Commit Bot
Comment 9
2017-06-25 14:41:54 PDT
Comment on
attachment 313700
[details]
Patch Clearing flags on attachment: 313700 Committed
r218800
: <
http://trac.webkit.org/changeset/218800
>
WebKit Commit Bot
Comment 10
2017-06-25 14:41:56 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug