diff --git a/substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/AddressRangeCommittedMemoryProvider.java b/substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/AddressRangeCommittedMemoryProvider.java index 1bfa186c1094..a3af81d1fd65 100644 --- a/substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/AddressRangeCommittedMemoryProvider.java +++ b/substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/AddressRangeCommittedMemoryProvider.java @@ -111,6 +111,8 @@ public class AddressRangeCommittedMemoryProvider extends ChunkBasedCommittedMemo protected static final int OUT_OF_ADDRESS_SPACE = 1; protected static final int COMMIT_FAILED = 2; + protected static final String UNCOMMIT_FAILED_ERROR_MSG = "Failed while uncommitting memory. " + + "This error may occur if the operating system's memory mapping limit is too low (see vm.max_map_count on Linux). Please increase this limit and try again."; private static final OutOfMemoryError NODE_ALLOCATION_FAILED = new OutOfMemoryError("Could not allocate node for free list, OS may be out of memory."); private static final OutOfMemoryError OUT_OF_METASPACE = new OutOfMemoryError("Could not allocate a metaspace chunk because the metaspace is exhausted."); private static final OutOfMemoryError ALIGNED_OUT_OF_ADDRESS_SPACE = new OutOfMemoryError("Could not allocate an aligned heap chunk because the heap address space is exhausted. " + @@ -776,7 +778,7 @@ private static RuntimeException reportUncommitFailed(Pointer mapBegin, UnsignedW private static RuntimeException reportUncommitFailedInterruptibly(Pointer mapBegin, UnsignedWord mappingSize) { Log.log().string("Uncommitting ").unsigned(mappingSize).string(" bytes of unused memory at ").hex(mapBegin).string(" failed.").newline(); - throw VMError.shouldNotReachHere("Uncommitting memory failed."); + throw VMError.shouldNotReachHere(UNCOMMIT_FAILED_ERROR_MSG); } @Uninterruptible(reason = CALLED_FROM_UNINTERRUPTIBLE_CODE, mayBeInlined = true) diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/code/RuntimeCodeInfoAccess.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/code/RuntimeCodeInfoAccess.java index f664badace42..7cd8d5c3b899 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/code/RuntimeCodeInfoAccess.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/code/RuntimeCodeInfoAccess.java @@ -238,10 +238,9 @@ public static void makeCodeMemoryExecutableWritable(CodePointer start, UnsignedW private static void protectCodeMemory(CodePointer codeStart, UnsignedWord codeSize, int permissions) { int result = VirtualMemoryProvider.get().protect(codeStart, codeSize, permissions); if (result != 0) { - throw VMError.shouldNotReachHere("Failed to modify protection of code memory. This may be caused by " + - "a. a too restrictive OS-limit of allowed memory mappings (see vm.max_map_count on Linux), " + - "b. a too strict security policy if you are running on Security-Enhanced Linux (SELinux), or " + - "c. a Native Image internal error."); + throw VMError.shouldNotReachHere("Failed to modify protection of code memory. " + + "This error may occur if the operating system's memory mapping limit is too low (see vm.max_map_count on Linux). Please increase this limit and try again." + + "If you are running on Security-Enhanced Linux (SELinux), you may also need to check the configured security policy."); } }