RFR: 8310656: RISC-V: __builtin___clear_cache can fail silently.

Robbin Ehn rehn at openjdk.org
Tue Jun 27 12:39:03 UTC 2023


On Tue, 27 Jun 2023 12:22:49 GMT, Ludovic Henry <luhenry at openjdk.org> wrote:

>> Hi, please consider.
>> 
>> We recently had a bug where user were missing permissions to use this syscall.
>> Which caused crashing on, according to hs_err on things like "addi x11, x24, 0" with SIGILL.
>> If it fails it is even possible to execute valid but 'old' instruction which may not lead to a crash, instead the program misbehaves.
>> 
>> To avoid this mess I suggest that we first test the syscall during vm init and we use it directly.
>> This way we can make sure it never fails.
>> 
>> Tested failing syscall with qemu, tested t1 in qemu, t1 on jh7110 in-progress.
>
> src/hotspot/os_cpu/linux_riscv/riscv_flush_icache.cpp line 60:
> 
>> 58: }
>> 59: 
>> 60: bool RiscvFlushIcache::test() {
> 
> Why not having all this code in src/hotspot/cpu/riscv/icache_riscv.cpp directly? It seems it's going to be (and it should be) the only user of it.

During boot we want to give the user an informative message of what is wrong and not crash.
Calling RiscvFlushIcache::flush() brings the vm down hard, so we can't call that.
So the only options would be to expose the syscall and it's defines, which I don't want to.
Hence a separate method was done.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14670#discussion_r1243664056


More information about the hotspot-dev mailing list