Skip to content

Epic: Enable W^X #50391

@janvorli

Description

@janvorli

We plan to enable W^X in .NET 6 on all platforms and architectures. The goal is to get rid of all memory page mappings that are both executable and writeable at the same time.

  • Implement low level allocator of executable memory that will enable double mapping of executable pages with RX and RW protection to different memory locations.
  • Modify code heaps in the runtime to use that allocator and provide separate RW and RX mappings and also mechanism for releasing of the RW mapping for their clients.
  • Modify stub generating code to use a separate RW mapping for writing the code and to release the RW mapping after that.
  • Modify JIT to a separate RW mapping for writing the code and to release the RW mapping after that.
  • Modify GC write barrier switching code to use separate RW mapping for rewriting the barrier code.
  • Integrate the changes with the existing W^X support for Apple M1.
  • Performance validation for all architectures
  • Enable by Default

Postponed to post 6.0:

  • Modify selected stubs to use static code in RX pages with stub specific data read indirectly from separate RW pages. An example of such a stub is the UMEntryThunk. The benefit is that there is no need to update the code after the initial generation and thus no creation / removal of RW mapping for code is needed after the initialization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bottom Up WorkNot part of a theme, epic, or user storyUser StoryA single user-facing feature. Can be grouped under an epic.area-Meta

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions