[crac] RFR: 8367975: [CRaC] Pattern in CRaCCheckpointTo
Timofei Pushkin
tpushkin at openjdk.org
Tue Sep 23 12:42:56 UTC 2025
On Tue, 23 Sep 2025 12:30:01 GMT, Radim Vansa <rvansa at openjdk.org> wrote:
>> src/hotspot/share/runtime/crac.cpp line 208:
>>
>>> 206: check_retval(snprintf(buf, buflen, "%08x-%04x-4%03x-a%03x-%04x%08x",
>>> 207: static_cast<u4>(os::random()), time_mid_high >> 16, time_mid_high & 0xFFF,
>>> 208: seq_and_node_low & 0xFFF, seq_and_node_low >> 16, static_cast<u4>(os::random())));
>>
>> Not that it matters much, but I believe the 4th part does not always have to start with "a" according to the spec
>>
>> Suggestion:
>>
>> check_retval(snprintf(buf, buflen, "%08x-%04x-4%03x-%04x-%04x%08x",
>> static_cast<u4>(os::random()), time_mid_high >> 16, time_mid_high & 0xFFF,
>> (seq_and_node_low & 0x3FFF | 0x8000), seq_and_node_low >> 16, static_cast<u4>(os::random())));
>
> We're using RFC 4122 variant, with Msb0 = 1 and Msb1 = 0: https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.1
Yes, and IIUC it fixes only two bits, allowing the other two to change: 1000 = 8, 1001 = 9, 1010 = a, 1011 = b. Or am I reading it wrong?
-------------
PR Review Comment: https://git.openjdk.org/crac/pull/264#discussion_r2372182155
More information about the crac-dev
mailing list