JDK-8309405 : RISC-V: is_deopt may produce unaligned memory read
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: riscv
  • Submitted: 2023-06-03
  • Updated: 2023-10-13
  • Resolved: 2023-06-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 21
21 b26Fixed
Related Reports
Relates :  
Description
After compressed opcodes were enabled by default, we  may have a 4-byte opcode located at 2-byte aligned address, but not 4-byte aligned address ( e.g. ending with 2/6/a/e in hex form)

This code then may produce misaligned read, and on some hardware (e.g. hifive) may result in misaligned load emulation thru m-mode

  static bool is_deopt_at(address instr) {
    assert(instr != nullptr, "");
    uint32_t value = *(uint32_t *) instr;
    // 0xc0201073 encodes CSRRW x0, instret, x0
    return value == 0xc0201073;
  }

direct pointer dereference should be replaced with a proper method
Comments
Changeset: a02d8001 Author: Vladimir Kempik <vkempik@openjdk.org> Date: 2023-06-05 07:30:28 +0000 URL: https://git.openjdk.org/jdk/commit/a02d8001fa43b379bee3803cda06a15a64d99ac2
05-06-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/14299 Date: 2023-06-03 12:34:20 +0000
03-06-2023