When blackhole support was added for inline types with 
[JDK-8267791](https://bugs.openjdk.org/browse/JDK-8267791), we wanted to be 
able to call `is/as_Blackhole()` and added an entry to the `NodeClasses` enum. 
But it accidentally ended up being defined as subclass of `MemBar` (subclassing 
`MultiNode`) even though `Blackhole` is directly subclassing `MultiNode`.

This was not noticed until running UBSAN with blackhole tests which failed here:

https://github.com/openjdk/valhalla/blob/80c30478fd8d272b233082e3e9ebb0ff2771d2d3/src/hotspot/share/opto/compile.cpp#L3850-L3852

In the crash, `n` is a `Blackhole` and due to the wrong definition, 
`n->as_Membar()` succeeded. We then call `mb->trailing_store()` which reads the 
`MemBar::_kind` enum which is just some garbage for a `Blackhole`. UBSAN 
reported that the found value is (obviously) not a valid value for that enum.

The fix is straight forward to move the definition in `NodeClasses` to the 
proper place under `MultiNode`.

Thanks,
Christian

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

Commit messages:
 - fix

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

PR: https://git.openjdk.org/valhalla/pull/2220

Reply via email to