JDK-8234508 : VM_HeapWalkOperation::iterate_over_object reads non-strong fields with an on-strong load barrier
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 11,14
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-11-20
  • Updated: 2021-02-08
  • Resolved: 2019-12-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 14
11.0.11Fixed 14 b27Fixed
Related Reports
Blocks :  
Description
I added some verification code to check that we never apply on-strong load barriers to non-strong fields.

The verification triggered at this point:
// an object references a class and its instance fields
// (static fields are ignored here as we report these as
// references from the class).
inline bool VM_HeapWalkOperation::iterate_over_object(oop o) {
  // reference to the class
  if (!CallbackInvoker::report_class_reference(o, o->klass()->java_mirror())) {
    return false;
  }

  // iterate over instance fields
  ClassFieldMap* field_map = JvmtiCachedClassFieldMap::get_map_of_instance_fields(o);
  for (int i=0; i<field_map->field_count(); i++) {
    ClassFieldDescriptor* field = field_map->field_at(i);
    char type = field->field_type();
    if (!is_primitive_field_type(type)) {
      oop fld_o = o->obj_field(field->field_offset()); <<< Here

Comments
Just checking: [~stefank], are you good with backporting this to 11u?
08-02-2021

[~shade] Sure. Go ahead an backport it.
08-02-2021

Fix Request (11u) This eliminates another GC bug that affects concurrent GCs like G1, Shenandoah and ZGC. The patch requires JDK-8235324 to be backported first, so that non-keepalive loads would still be handled. Patch applies cleanly to 11u, and with all the relevant backports, passes tier{1,2,3}/vmTestbase_nsk_jvmti with {G1, Parallel, Shenandoah, ZGC}. (ZGC has some "expected" OOMEs).
03-02-2021

URL: https://hg.openjdk.java.net/jdk/jdk/rev/2aaa8bcb90a9 User: stefank Date: 2019-12-09 21:11:18 +0000
09-12-2019

Out for review on hotspot-gc-dev
04-12-2019