Skip to content

JIT Support on iOS #3

@jandem

Description

@jandem

In order to ship a performant JavaScript/WebAssembly engine, a necessary component of a modern web browser, it must be possible for browser processes to create memory regions that are both writable and executable. However, applications on iOS are prevented from creating such memory regions because the system call used to configure memory region permissions (mmap(2)) does not allow it.

This is sound default behavior that improves security in general, but web browsers need this capability. As evidence, an exception is made for Safari’s WebKit rendering engine on iOS, allowing writable and executable memory regions to be created.

The same general security mitigation is employed on macOS, but on macOS applications like web browsers can opt-out by using entitlements. To allow these memory regions for non-WebKit browsers on iOS, iOS should allow an equivalent entitlement to the macOS Hardened Runtime entitlement com.apple.security.cs.allow-jit (which permits use of the mmap(2) system call using the MAP_JIT flag) and include its accompanying APIs pthread_jit_write_protect_np and sys_icache_invalidate. These APIs are already in iOS, but only Safari and other Apple applications are permitted to use them.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions