Bug Report: arguments supplied to restore are split with whitespace

Anton Kozlov akozlov at azul.com
Tue Aug 8 09:32:51 UTC 2023

On 8/5/23 15:41, Yizhe Sun wrote:
>> On 8/2/23 10:34, 孙译喆 wrote:
>>> Calling `java -XX:CRaCRestore Foo arg1` when there is whitespace in `arg1` causes `arg1` to be split into multiple arguments.
>> this can be caused by the way how arguments are passed from the launcher to the VM on restore. 
> If nobody has started on this yet, I'm willing to work on this bug myself. If someone could give me a few pointers, that would be very helpful.

The VM in the initial process passes the context to being restored VM via shared memory, as a serialized data structure [1]. We reused existing Arguments::java_command() which in this turn does not suit the task very well. That value is set after the "sun.java.command" property, which is passed from the java launcher [3]. As we should not change existing sun.java.command semantics, apparently we need an alternative mechanism to pass unaltered properties from the launcher to the VM, so the initial VM will be able to serialize them properly.


[1] https://github.com/openjdk/crac/blob/crac/src/hotspot/share/runtime/crac.cpp#L462
[2] https://github.com/openjdk/crac/blob/crac/src/hotspot/share/runtime/arguments.cpp#L1373
[3] https://github.com/openjdk/crac/blob/crac/src/java.base/share/native/libjli/java.c#L1829

More information about the crac-dev mailing list