RFR: 8342607: Enhance register printing on x86_64 platforms [v4]
Martin Doerr
mdoerr at openjdk.org
Mon Oct 28 13:45:26 UTC 2024
On Mon, 28 Oct 2024 13:03:42 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> Martin Doerr has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Check uc->uc_mcontext.fpregs sanity.
>
> src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp line 551:
>
>> 549: st->cr();
>> 550: st->cr();
>> 551: size_t fpregs_offset = pointer_delta(uc->uc_mcontext.fpregs, uc, 1);
>
> Could the register substructure live outside uc on x64? If so, it may be safer to
> Suggestion:
>
> size_t fpregs_offset = (uc->uc_mcontext.fpregs >= uc) ? pointer_delta(uc->uc_mcontext.fpregs, uc, 1) : 0;
>
> or similar, since the register substructure may precede uc which would make pointer_delta assert.
I think using 0 would require more changes to avoid accessing uc+0 which would be wrong. Richard and I already discussed about this above. We think it's acceptable. Some other projects claim that FP register substructure is inside the uc: https://github.com/mono/mono/blob/0f53e9e151d92944cacab3e24ac359410c606df6/mono/utils/mono-sigcontext.h#L263
We could also check the kernel code which writes it.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21615#discussion_r1819079823
More information about the hotspot-runtime-dev
mailing list