RFR: 8344802: Crash in StubRoutines::verify_mxcsr with -XX:+EnableX86ECoreOpts and -Xcheck:jni [v2]

Volodymyr Paprotski vpaprotski at openjdk.org
Thu Jan 23 18:11:02 UTC 2025


> @TobiHartmann  There are still some unanswered questions I have, but committing this since we need to work around vacation schedules.
> 
> **This in fact happens on both Windows _AND_ Linux.** However, _only_ on Windows there is a crash. This fix fixes the crash but I don't understand entirely why the crash happens in the first place.
> 
> The issue fixed here are all the CheckJNI warnings:
> 
> OpenJDK 64-Bit Server VM warning: MXCSR changed by native JNI code, use -XX:+RestoreMXCSROnJNICall
> 
> 
> Crash has nothing to do with String.indexOf work, but was introduced by my `8319429: Resetting MXCSR flags degrades ecore` change. I was able to get HelloWorld to crash on Windows (`-Xcheck:jni -XX:+EnableX86ECoreOpts`). Same command on linux produces hundreds of CheckJNI warnings. Is it odd that its only being found now, no other CheckJNI tests?
> 
> I would appreciate some help/reviews from somebody more aware of the Java-to-C linkage. I think I got the masks fixed, but there is one specific place (see the 'FIXME' question in the diff) for Windows I am not certain about. (@sviswa7 is on vacation for few more weeks)
> 
> Note: Crash on windows (if I have the Windows debugger actually correct), happens on:
> 
> 0x000001f2525f13c1:   fxrstor64 (%rsp)
> Stack:
> 0x00000088f1bfe060:   00007ff8b4384310 0000025bfaeb2200
> 
> 
> `00007ff8` _seems_ like a valid mxcsr value, only way it should crash is if top 2 bytes weren't zeroes, which they are.

Volodymyr Paprotski has updated the pull request incrementally with one additional commit since the last revision:

  cleanup

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/22673/files
  - new: https://git.openjdk.org/jdk/pull/22673/files/c106e350..6768b9df

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=22673&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=22673&range=00-01

  Stats: 86 lines in 7 files changed: 42 ins; 35 del; 9 mod
  Patch: https://git.openjdk.org/jdk/pull/22673.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/22673/head:pull/22673

PR: https://git.openjdk.org/jdk/pull/22673


More information about the core-libs-dev mailing list