On Tue, 21 Oct 2025 13:56:57 GMT, Andrew Dinn <[email protected]> wrote:

> A possible solution to this would be to check for NOP only as the first step, 
> and to check for MOVK conditionally.

SafeFetch was designed specifically for problems like this one.


diff --git a/src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp 
b/src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp
index df5d97c2376..eff84ac195f 100644
--- a/src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp
+++ b/src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp
@@ -29,7 +29,7 @@
 #include "asm/assembler.hpp"
 #include "runtime/icache.hpp"
 #include "runtime/os.hpp"
-#include "runtime/os.hpp"
+#include "runtime/safefetch.hpp"
 #if INCLUDE_JVMCI
 #include "jvmci/jvmciExceptions.hpp"
 #endif
@@ -528,7 +528,7 @@ inline NativeLdSt* NativeLdSt_at(address addr) {
 class NativePostCallNop: public NativeInstruction {
 public:
   bool check() const {
-    uint64_t insns = *(uint64_t*)addr_at(0);
+    uint64_t insns = SafeFetchN((intptr_t*)addr_at(0), 0);
     // Check for two instructions: nop; movk zr, xx
     // These instructions only ever appear together in a post-call
     // NOP, so it's unnecessary to check that the third instruction is

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

PR Comment: https://git.openjdk.org/jdk/pull/26678#issuecomment-3431497753

Reply via email to