Bug 211799 - catch_mach_exception_raise_state() should fail early if the faulting address is not of interest.
Summary: catch_mach_exception_raise_state() should fail early if the faulting address ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-05-12 13:07 PDT by Mark Lam
Modified: 2020-05-12 21:36 PDT (History)
7 users (show)

See Also:


Attachments
proposed patch. (1.77 KB, patch)
2020-05-12 13:28 PDT, Mark Lam
sbarati: review-
Details | Formatted Diff | Diff
proposed patch. (1.69 KB, patch)
2020-05-12 14:56 PDT, Mark Lam
sbarati: review+
Details | Formatted Diff | Diff
proposed patch. (2.32 KB, patch)
2020-05-12 15:36 PDT, Mark Lam
sbarati: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2020-05-12 13:07:42 PDT
<rdar://problem/62939204>
Comment 1 Mark Lam 2020-05-12 13:28:08 PDT
Created attachment 399166 [details]
proposed patch.

Let's try this on the EWS.
Comment 2 Michael Saboff 2020-05-12 14:23:46 PDT
Comment on attachment 399166 [details]
proposed patch.

r=me
Comment 3 Saam Barati 2020-05-12 14:43:49 PDT
Comment on attachment 399166 [details]
proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=399166&action=review

> Source/WTF/wtf/threads/Signals.cpp:178
> +#if CPU(ADDRESS64) && (CPU(ARM64) || CPU(X86_64))

We already specify valid pointer width in some WTF header. You should use that
Comment 4 Saam Barati 2020-05-12 14:49:47 PDT
(In reply to Saam Barati from comment #3)
> Comment on attachment 399166 [details]
> proposed patch.
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=399166&action=review
> 
> > Source/WTF/wtf/threads/Signals.cpp:178
> > +#if CPU(ADDRESS64) && (CPU(ARM64) || CPU(X86_64))
> 
> We already specify valid pointer width in some WTF header. You should use
> that

WTF_OS_CONSTANT_EFFECTIVE_ADDRESS_WIDTH
Comment 5 Mark Lam 2020-05-12 14:56:40 PDT
Created attachment 399182 [details]
proposed patch.
Comment 6 Saam Barati 2020-05-12 15:01:55 PDT
Comment on attachment 399182 [details]
proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=399182&action=review

r=me

> Source/WTF/wtf/threads/Signals.cpp:181
> +    if ((exceptionType == EXC_BAD_ACCESS) && (exceptionData[1] & invalidAddressMask))

can this code be moved below so we can use "faultingAddress" below?

> Source/WTF/wtf/threads/Signals.cpp:183
> +    compilerFence();

this doesn't seem necessary
Comment 7 Mark Lam 2020-05-12 15:36:23 PDT
Created attachment 399189 [details]
proposed patch.
Comment 8 Mark Lam 2020-05-12 17:49:13 PDT
Comment on attachment 399189 [details]
proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=399189&action=review

> Source/WTF/wtf/threads/Signals.cpp:201
>      memcpy(outState, inState, inStateCount * sizeof(inState[0]));
>      *outStateCount = inStateCount;

Talked with Saam offline: we can't find any documentation on whether this memcpy is required even if we return KERN_FAILURE.  So, I'll move the above if statement back to its original position after the memcpy to be conservative.
Comment 9 Mark Lam 2020-05-12 21:36:02 PDT
Thanks for the reviews.  Landed in r261598: <http://trac.webkit.org/r261598>.