From 329c574f5ceb98e4946394d7eeeb35c7a3495203 Mon Sep 17 00:00:00 2001 From: Roman Zagorowski Date: Wed, 12 Jun 2024 11:47:47 +0200 Subject: [PATCH] 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 --- src/coreclr/inc/clrconfigvalues.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/coreclr/inc/clrconfigvalues.h b/src/coreclr/inc/clrconfigvalues.h index 07fa685484f02..591b3cd4bae06 100644 --- a/src/coreclr/inc/clrconfigvalues.h +++ b/src/coreclr/inc/clrconfigvalues.h @@ -722,7 +722,11 @@ RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_LTTng, W("LTTng"), 1, "If DOTNET_LTTng is s // // Executable code // +#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 ///