On Tue, 29 Mar 2022 04:24:15 GMT, Ioi Lam <[email protected]> wrote:
>> `JvmtiEnv::SetSystemProperty` eventually calls `PathString::set_value` in
>> arguments.cpp, which aborts the VM when it fails to allocate a string copy
>> of the property value.
>>
>>
>> bool PathString::set_value(const char *value) {
>> if (_value != NULL) {
>> FreeHeap(_value);
>> }
>> _value = AllocateHeap(strlen(value)+1, mtArguments );
>> // should pass AllocFailStrategy::RETURN_NULL -----^
>> assert(_value != NULL, "Unable to allocate space for new path value");
>>
>>
>> This should be fixed so that `JvmtiEnv::SetSystemProperty` can return
>> `JVMTI_ERROR_OUT_OF_MEMORY` in case of OOM. See
>> https://docs.oracle.com/en/java/javase/17/docs/specs/jvmti.html#SetSystemProperty
>
> Ioi Lam has updated the pull request incrementally with one additional commit
> since the last revision:
>
> @dholmes-ora comments: simplify the changes
src/hotspot/share/runtime/arguments.hpp line 113:
> 111: bool writeable() const { return _writeable; }
> 112:
> 113: bool readable() const {
Might be better/simpler to keep is_readable and change to is_writeable(), as
that avoids changing other files.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7981