RFR: 8368997: AIX allows reading from address zero which leads to several ubsan findings

Joachim Kern jkern at openjdk.org
Wed Oct 1 14:26:48 UTC 2025


In _SafeFetchXX_internal() a pointer is checked for readability before using. It returns false if this is not the case. The implementation tries to read from the pointer if this is not feasible the signal handler comes into place jumping back to the function via longjmp, so the _SafeFetchXX_internal() itself can return with a false and a null as pseudo content of the address. If the address was readable the function returns true and provides the content of the address.
Because AIX allows reading from address zero, _SafeFetchXX_internal() returns true and follow up functions using the address are called. All these functions end up in an UBSAN finding regarding reading from zero.
The solution could be to manually code that also AIX behaves like other operating systems and returns false and the content zero in case of address zero. Then no UBSAN finding occur.

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

Commit messages:
 - JDK-8368997

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

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


More information about the hotspot-runtime-dev mailing list