RFR: 8338449: ubsan: division by zero in sharedRuntimeTrans.cpp

Matthias Baesken mbaesken at openjdk.org
Mon Oct 14 14:13:45 UTC 2024


When running with ubsan enabled binaries on Linux ppc64le, some divisions by zero are detected in the java/lang/Math jdk jtreg tests dealing with log - related calculations.

java/lang/Math/Log10Tests.java: Tests for {Math, StrictMath}.log10
 
/jdk/src/hotspot/share/runtime/sharedRuntimeTrans.cpp:219:27: runtime error: division by zero
    #0 0x7fffa7e14abc in SharedRuntime::dlog10(double) (/build_ubsan/images/jdk/lib/server/libjvm.so+0x69f4abc)
    #1 0x7fff8b8fc8e8 (<unknown module>)
 
test
java/lang/Math/LogTests.java: Tests for {Math, StrictMath}.log
 
/jdk/src/hotspot/share/runtime/sharedRuntimeTrans.cpp:125:27: runtime error: division by zero
    #0 0x7fff887f48bc in __ieee754_log(double) (/build_ubsan/images/jdk/lib/server/libjvm.so+0x69f48bc)
    #1 0x7fff6b8fc768 (<unknown module>)
 
test
java/lang/Math/PowTests.java: Tests for {Math, StrictMath}.pow
 
/jdk/src/hotspot/share/runtime/sharedRuntimeTrans.cpp:508:23: runtime error: division by zero
    #0 0x7fff92fd61f0 in SharedRuntime::dpow(double, double) (/build_ubsan/images/jdk/lib/server/libjvm.so+0x69f61f0)
    #1 0x7fff7701c8ec (<unknown module>)

The coding does intentional division by zero. 
We should probably check for IEEE compliance  (or rewrite the coding);  but checking for compliance might be sufficient.

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

Commit messages:
 - JDK-8338449

Changes: https://git.openjdk.org/jdk/pull/21500/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21500&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8338449
  Stats: 12 lines in 1 file changed: 12 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/21500.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21500/head:pull/21500

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


More information about the hotspot-dev mailing list