Bug 241386

Summary: Set protections on MAP_ALIGNED platforms too for WTF::OSAllocator::tryReserveUncommittedAligned
Product: WebKit Reporter: Leonardo Taccari <iamleot+webkit-bugzilla>
Component: Web Template FrameworkAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cdumez, cmarcelo, ews-watchlist, iamleot+webkit-bugzilla, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: Other   
See Also: https://bugs.webkit.org/show_bug.cgi?id=236460
Attachments:
Description Flags
REGRESSION(247105@main): Set protections on MAP_ALIGNED platforms too none

Description Leonardo Taccari 2022-06-07 15:37:39 PDT
Since 247105@main when tryReserveUncommittedAligned() on Unix-like platforms that supports MAP_ALIGNED (except macOS and Linux) pages are initially mmap-ed via PROT_NONE but then the protections are never readjusted.

At least in NetBSD running jsc, e.g. via `jsc -e 0', it ends up in a SIGSEGV.
Comment 1 Leonardo Taccari 2022-06-07 15:39:13 PDT
Created attachment 460075 [details]
REGRESSION(247105@main): Set protections on MAP_ALIGNED platforms too

Since the introduction of tryReserveUncommittedAligned() on platforms
that have MAP_ALIGNED via 247105@main, reserved pages via that
function never had the protections adjusted and will likely ends
up in SIGSEGV.
Comment 2 Leonardo Taccari 2022-06-07 15:43:59 PDT
After this patch and https://bugs.webkit.org/show_bug.cgi?id=241386 is applied jsc should build and runs on NetBSD too without any further patches.
Comment 3 Leonardo Taccari 2022-06-07 15:44:45 PDT
Comment on attachment 460075 [details]
REGRESSION(247105@main): Set protections on MAP_ALIGNED platforms too

Mark it as ready for review.
Comment 4 Yusuke Suzuki 2022-06-08 08:02:22 PDT
@Leonardo Also I recommend joining WebKit slack from https://webkit.org/getting-started/
And joining #jsc / #reviews channel. There are JSC reviewers you can ask for reviews :)
Comment 5 Leonardo Taccari 2022-06-08 08:17:15 PDT
Great suggestion! I'm there too now! :)

Thank you very much Yusuke!
Comment 6 Yusuke Suzuki 2022-06-08 08:42:49 PDT
Comment on attachment 460075 [details]
REGRESSION(247105@main): Set protections on MAP_ALIGNED platforms too

r=me
Comment 7 EWS 2022-06-08 09:31:30 PDT
Committed r295382 (251390@main): <https://commits.webkit.org/251390@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 460075 [details].
Comment 8 Radar WebKit Bug Importer 2022-06-08 09:32:13 PDT
<rdar://problem/94641219>