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

Ludovic Henry luhenry at openjdk.org
Tue Jun 27 12:26:04 UTC 2023


On Tue, 27 Jun 2023 08:19:47 GMT, Robbin Ehn <rehn 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.

For context, this was tracked down for https://github.com/adoptium/adoptium-support/issues/697

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.

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

PR Comment: https://git.openjdk.org/jdk/pull/14670#issuecomment-1609393296
PR Review Comment: https://git.openjdk.org/jdk/pull/14670#discussion_r1243645521


More information about the hotspot-dev mailing list