Bug 186004

Summary: MachineContext's instructionPointer() should handle null PCs correctly.
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: JavaScriptCoreAssignee: Mark Lam <mark.lam>
Status: RESOLVED FIXED    
Severity: Normal CC: ews-watchlist, keith_miller, msaboff, saam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
proposed patch. saam: review+

Mark Lam
Reported 2018-05-25 16:34:19 PDT
instructionPointer() returns a MacroAssemblerCodePtr<CFunctionPtrTag>. However MacroAssemblerCodePtr's constructor does not accept a nullptr and will assert accordingly with a debug ASSERT. This is inconsequential for release builds, but to avoid this assertion failure, we should check for a null PC and return MacroAssemblerCodePtr<CFunctionPtrTag>(nullptr) instead (which uses the MacroAssemblerCodePtr(std::nullptr_t) constructor instead). Alternatively, we can change all of MacroAssemblerCodePtr's constructors to check for null pointers, but I rather not do that yet. In general, MacroAssemblerCodePtrs are constructed with non-null pointers, and I prefer to leave it that way for now.
Attachments
proposed patch. (2.12 KB, patch)
2018-05-25 16:42 PDT, Mark Lam
saam: review+
Mark Lam
Comment 1 2018-05-25 16:35:03 PDT
Note: this issue only manifests when we have signal traps enabled, and encounter a null pointer deref.
Mark Lam
Comment 2 2018-05-25 16:42:01 PDT
Created attachment 341354 [details] proposed patch.
Radar WebKit Bug Importer
Comment 3 2018-05-25 16:42:53 PDT
Mark Lam
Comment 4 2018-05-25 16:46:07 PDT
Thanks for the review. Landed in r232215: <http://trac.webkit.org/r232215>.
Note You need to log in before you can comment on or make changes to this bug.