RFR: 8302384: Handle hsdis out-of-bound logic for RISC-V [v2]
Xiaolin Zheng
xlinzheng at openjdk.org
Tue Feb 21 03:42:27 UTC 2023
On Fri, 17 Feb 2023 09:41:30 GMT, Ludovic Henry <luhenry at openjdk.org> wrote:
>> Xiaolin Zheng has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Review comments
>
> src/utils/hsdis/binutils/hsdis-binutils.c line 204:
>
>> 202: int size = (*app_data->dfn)((bfd_vma) p, &app_data->dinfo);
>> 203:
>> 204: if (size <= 0 RISCV_ONLY(|| size == EIO)) {
>
> That should be fixed in binutils as well, or at least reported.
Reasonable, too. Will send one. Although I think we may not likely get rid of this less-than-graceful check... only if this issue is fixed in all versions of binutils.
> src/utils/hsdis/binutils/hsdis-binutils.c line 302:
>
>> 300: DECL_APP_DATA(dinfo);
>> 301: DECL_PRINTF_CALLBACK(app_data);
>> 302: (*printf_callback)(printf_stream, ".4byte\t0x%08x\n", *(uint32_t*)addr);
>
> AFAIU, once this callback is called, we are not going to continue disassembling the code. Given we know how long the rest of the code to disassemble is (with `addr `, `app_data->start_va` and `app_data->length`), could we also print the content of the rest of the buffer without disassembling (with some `.4byte ..`, `.2byte ..`, and `.1byte ..`).
Thanks for reviewing, Ludovic. It sounds very reasonable. Will turn to RFR again after testing its coverage on other platforms (maybe by using some hacking in hsdis code). Theoretically, I think x86 should also have some chance to face the same situation that `Address 0x%s is out of bounds.` are printed when some interesting data at the end of a nmethod is getting disassembled. Though maybe very rare.
Currently it looks: (modified hsdis to use the new memory error callback to disassemble)
......
0x0000003fe000fd59: .4byte 0x1b673902
0x0000003fe000fd5d: .4byte 0xb9ead707
0x0000003fe000fd61: .4byte 0xd7879b67
0x0000003fe000fd65: .4byte 0x413297ea
; {runtime_call handle_exception_from_callee Runtime1 stub}
0x0000003fe000fd69: .4byte 0xa280e707
0x0000003fe000fd6d: .4byte 0x101073d5
0x0000003fe000fd71: .4byte 0x0a30e8c0
0x0000003fe000fd75: .4byte 0x00004003
0x0000003fe000fd79: .4byte 0x00009700
0x0000003fe000fd7d: .4byte 0x4d829700
; {runtime_call DeoptimizationBlob}
0x0000003fe000fd81: .4byte 0x22806707
0x0000003fe000fd85: .2byte 0x0014
0x0000003fe000fd87: .1byte 0x00
--------------------------------------------------------------------------------
[/Disassembly]
-------------
PR: https://git.openjdk.org/jdk/pull/12551
More information about the hotspot-compiler-dev
mailing list