Bug 239457 - The VMTraps signal handler should no return SignalAction::NotHandled on codeBlockSet lock contention.
Summary: The VMTraps signal handler should no return SignalAction::NotHandled on codeB...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-04-18 11:53 PDT by Mark Lam
Modified: 2022-04-18 16:07 PDT (History)
7 users (show)

See Also:


Attachments
[fast-cq] proposed patch. (4.65 KB, patch)
2022-04-18 11:59 PDT, Mark Lam
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2022-04-18 11:53:32 PDT
The signal handler is triggered by the mutator thread due to the installed halt instructions in JIT code (which we already confirmed higher up in the signal handler). Hence, the mutator cannot be in C++ code, and therefore, cannot be already holding the codeBlockSet lock.   The only time the codeBlockSet lock could be in contention is if the Sampling Profiler thread is holding it.  In that case, we'll simply wait till the Sampling Profiler is done with it.  There are no lock ordering issues w.r.t. the Sampling Profiler on this code path.

Note that it is not ok to return SignalAction::NotHandled here if we see contention.  Doing so will cause the fault to be handled by the default handler, which will crash.  It is also not productive to return SignalAction::Handled on contention.  Doing so will simply trigger this fault handler over and over again.  We might as well wait for the Sampling Profiler to release the lock, which is what we should do.

This issue was detected by the stress/get-array-length-concurrently-change-mode.js.ftl-no-cjit-validate-sampling-profiler test, resulting in intermittent crashes.
Comment 1 Mark Lam 2022-04-18 11:59:05 PDT
Created attachment 457813 [details]
[fast-cq] proposed patch.
Comment 2 Radar WebKit Bug Importer 2022-04-18 12:00:44 PDT
<rdar://problem/91908204>
Comment 3 Yusuke Suzuki 2022-04-18 12:01:45 PDT
Comment on attachment 457813 [details]
[fast-cq] proposed patch.

r=me
Comment 4 Mark Lam 2022-04-18 16:05:19 PDT
Comment on attachment 457813 [details]
[fast-cq] proposed patch.

Thanks for the review.
Comment 5 EWS 2022-04-18 16:07:50 PDT
Committed r292978 (249741@main): <https://commits.webkit.org/249741@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 457813 [details].