Bug 236670 - OSAllocatorPosix::tryReserveUncommittedAligned() should not use PROT_NONE on non-linux platforms
Summary: OSAllocatorPosix::tryReserveUncommittedAligned() should not use PROT_NONE on ...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Basuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-02-15 14:41 PST by Yoshiaki Jitsukawa
Modified: 2022-02-22 14:42 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yoshiaki Jitsukawa 2022-02-15 14:41:04 PST
OSAllocatorPosix::tryReserveUncommittedAligned() should not use PROT_NONE on non-linux platforms.

Only on linux PROT_NONE is used for deccommitted pages. That is, protection flags are set on commit() only on Linux. 
https://github.com/WebKit/WebKit/blob/9067a50/Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp#L228

However in tryReserveUncommittedAligned() PROT_NONE is used for platforms other than
 #if PLATFORM(MAC) || USE(APPLE_INTERNAL_SDK),
which may result in protection faults because appropriate flags won't be set on commit().
Comment 1 Basuke Suzuki 2022-02-17 09:25:53 PST
(In reply to Yoshiaki Jitsukawa from comment #0)
> OSAllocatorPosix::tryReserveUncommittedAligned() should not use PROT_NONE on
> non-linux platforms.
> 
> Only on linux PROT_NONE is used for deccommitted pages. That is, protection
> flags are set on commit() only on Linux. 
> https://github.com/WebKit/WebKit/blob/9067a50/Source/WTF/wtf/posix/
> OSAllocatorPOSIX.cpp#L228
> 
> However in tryReserveUncommittedAligned() PROT_NONE is used for platforms
> other than
>  #if PLATFORM(MAC) || USE(APPLE_INTERNAL_SDK),
> which may result in protection faults because appropriate flags won't be set
> on commit().

Linux implementation is so much depends on Linux memory management way and very different from other port.
Comment 2 Radar WebKit Bug Importer 2022-02-22 14:42:18 PST
<rdar://problem/89317522>