Skip to content

Commit

Permalink
[RISC-V] Disable EnableWriteXorExecute by default on riscv64 architec…
Browse files Browse the repository at this point in the history
…tue (#103408)

* Disable EnableWriteXorExecute by default on riscv64 architectue

On riscv64 architectue any dotnet process that loads corossgened assembly
without DOTNET_EnableWriteXorExecute=0 environment variable set
crashes with "Segmentation fault" error.

For example System.Private.CoreLib.dll is compiled with crossgen2 by default
during build phase so this crash applies to any processes that loads it.

Setting EnableWriteXorExecute=0 disables this options on riscv64 architecure
and prevents these crashes.

Co-authored-by: Dong-Heon Jung <clamp03@gmail.com>

* Add a link to an issue about re-enabling WriteXorExecute on riscv64 arch.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>

---------

Co-authored-by: Dong-Heon Jung <clamp03@gmail.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
  • Loading branch information
3 people authored Jun 14, 2024
1 parent 121230d commit dd8d97e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/coreclr/inc/clrconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,12 @@ RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_LTTng, W("LTTng"), 1, "If DOTNET_LTTng is s
//
// Executable code
//
// TODO: https://github.com/dotnet/runtime/issues/103465
#ifdef TARGET_RISCV64
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableWriteXorExecute, W("EnableWriteXorExecute"), 0, "Enable W^X for executable memory.");
#else
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableWriteXorExecute, W("EnableWriteXorExecute"), 1, "Enable W^X for executable memory.");
#endif // TARGET_RISCV64

#ifdef FEATURE_GDBJIT
///
Expand Down

0 comments on commit dd8d97e

Please sign in to comment.