Crash in [@ JSContext::realm] with a fuzz testcase
Categories
(Core :: JavaScript Engine, defect, P1)
Tracking
()
People
(Reporter: mayankleoboy1, Unassigned)
References
(Blocks 2 open bugs)
Details
(4 keywords)
Crash Data
Attachments
(2 files)
Crash report: https://crash-stats.mozilla.org/report/index/090c4a29-74aa-4bd7-aabc-66fbf0250819
Reason:
EXCEPTION_ACCESS_VIOLATION_READ
Top 10 frames:
0 xul.dll JSContext::realm() const js/src/vm/JSContext.h:298
0 xul.dll js::AutoRealm::AutoRealm(JSContext*, JS::PersistentRooted<js::PromiseObject*>... js/src/vm/Realm-inl.h:61
0 xul.dll js::OffThreadPromiseTask::run(JSContext*, JS::Dispatchable::MaybeShuttingDown) js/src/vm/OffThreadPromiseRuntimeState.cpp:137
1 xul.dll JS::Dispatchable::Run(JSContext*, std::unique_ptr<JS::Dispatchable, JS::Delet... js/src/jsapi.cpp:3118
1 xul.dll mozilla::dom::workerinternals::(anonymous namespace)::JSDispatchableRunnable:... dom/workers/RuntimeService.cpp:661
2 xul.dll mozilla::dom::WorkerThreadRunnable::Run() dom/workers/WorkerRunnable.cpp:443
3 xul.dll nsThread::ProcessNextEvent(bool, bool*) xpcom/threads/nsThread.cpp:1153
4 xul.dll NS_ProcessPendingEvents(nsIThread*, unsigned int) xpcom/threads/nsThreadUtils.cpp:445
5 xul.dll mozilla::dom::workerinternals::(anonymous namespace)::WorkerThreadPrimaryRunn... dom/workers/RuntimeService.cpp:2291
6 xul.dll nsThread::ProcessNextEvent(bool, bool*) xpcom/threads/nsThread.cpp:1153
Open testcase
Click on run.
Within a few seconds, the tab will crash.
Fuzzer generated using Chatgpt.
Marking s-s for now.
| Reporter | ||
Comment 1•1 year ago
|
||
Comment 2•1 year ago
|
||
Assuming the stack trace is correct, I think we get a nullptr context here from aWorkerPrivate->GetJSContext() and pass that to JS::Dispatchable::Run. We should check what happens in a debug build.
Updated•1 year ago
|
Updated•1 year ago
|
Comment 3•1 year ago
|
||
A random fuzzer that doesn't preserve the actual testcases (what's attached is a testcase-generator) might never hit this bug again. Maybe at the very least save the seed so we can try to run it again?
This particular crash is a null-deref and probably isn't that serious, but we should keep the generator hidden while we explore whether it turns up more interesting results. And even a null-deref crash is worth fixing, especially if it blocks further testing.
| Reporter | ||
Comment 4•1 year ago
|
||
This is a somewhat reduced testcase that removes randomness. It just spinds up promises and workers.
To increase the possibility of the crash, try increasing the parallel count.
Comment 5•1 year ago
|
||
I need to dig into this more, but from a workers perspective in terms of policies around when we turn off the JS runtime's ability to ask us to dispatch runnables, I think the runnable should have already run or been forbidden from being scheduled, so there's a questions of whether this is just a workers bug. I hope to have an answer on Monday as part of also looking at bug 1980271 and bug 1984739 where it seems like workers may need to narrow our locking.
| Reporter | ||
Comment 6•1 year ago
•
|
||
still crashes using the second testcase: https://crash-stats.mozilla.org/report/index/1f1d9fe4-488a-4739-adda-d4b3d0251028#tab-details
Comment 7•11 months ago
|
||
I think the fix in bug 1988289 is likely to make the crash go away since a StrongWorkerRef will prevent the worker from transitioning beyond Canceling until the async tasks are all completed. (The crash from comment 6 shows us having transitioned beyond Canceling.)
| Reporter | ||
Comment 8•11 months ago
|
||
Is this bug still s-s?
If yes, Would this bug be considered for bug-bounty?
Comment 10•9 months ago
|
||
Looking at the current signatures, I only see 1 crash in 148 which is https://crash-stats.mozilla.org/report/index/69551689-801e-4e41-b27f-8a1310260103#tab-details and which is very much something different since it's a case of a WebExtension using CloneInto and the issue of concern was a worker lifecycle issue. Duping forward to bug 1988289 which fixed the problem (and which explains why the test case was reproducing the same problem).
I'm not an expert on the bug bounty program and do not make determinations but I understand that https://www.mozilla.org/en-US/security/client-bug-bounty/ documents it and I think this is saying generally things need to be sec-high or sec-critical:
Typically, the security rating given by the Bounty Committee for a bug must be rated a "sec-high" or "sec-critical" in order for it to be eligible for a bounty. In some circumstances, bounties may be paid for lower-rated bugs as well. (See Security Ratings for details of the rating qualifications.)
Lower down there does seem to be some discretion for some sec-mods but this would not fall under them to my understanding.
Updated•1 month ago
|
Description
•