-
Bug
-
Resolution: Fixed
-
P2
-
6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18
-
b24
Building HotSpot with LLVM 13 fails due to SEGV at FrameMap::java_calling_convention(GrowableArray<BasicType> const*, bool). See attached log.
The root cause is the following code in LIR_OprDesc:
// Conversion
intptr_t value() const { return (intptr_t) this; }
This pattern is a source of undefined behavior in C++. This is similar to the issue with markOop/markOopDesc that was fixed inJDK-8229258.
In this case, the undefined behavior happens with:
bool check_value_mask(intptr_t mask, intptr_t masked_value) const {
return (value() & mask) == masked_value;
}
Compiler can make various optimizations if it believes "this" pointer is aligned. The LLVM optimization that tripped this is https://reviews.llvm.org/rG16d03818412415c56efcd482d18c0cbdf712524c , which is a roll-forward of https://reviews.llvm.org/D99790.
Properly fixing this requires wide refactoring of the use cases of LIR_OprDesc.
Colleagues James Y Knight and [~rasbold] have contributed a workaround patch with some hacks to reduce the patch size. I will publish this partial fix to collect initial feedback, and see if we could proceed with the patch, or if there are volunteers to pick up this work.
The root cause is the following code in LIR_OprDesc:
// Conversion
intptr_t value() const { return (intptr_t) this; }
This pattern is a source of undefined behavior in C++. This is similar to the issue with markOop/markOopDesc that was fixed in
In this case, the undefined behavior happens with:
bool check_value_mask(intptr_t mask, intptr_t masked_value) const {
return (value() & mask) == masked_value;
}
Compiler can make various optimizations if it believes "this" pointer is aligned. The LLVM optimization that tripped this is https://reviews.llvm.org/rG16d03818412415c56efcd482d18c0cbdf712524c , which is a roll-forward of https://reviews.llvm.org/D99790.
Properly fixing this requires wide refactoring of the use cases of LIR_OprDesc.
Colleagues James Y Knight and [~rasbold] have contributed a workaround patch with some hacks to reduce the patch size. I will publish this partial fix to collect initial feedback, and see if we could proceed with the patch, or if there are volunteers to pick up this work.
- relates to
-
JDK-8276563 Undefined Behaviour in class Assembler
- Resolved
-
JDK-8277077 Replace "->" with "." for use cases of LIR_Opr
- Open
-
JDK-8276976 Rename LIR_OprDesc to LIR_Opr
- Resolved
-
JDK-8229258 Rework markOop and markOopDesc into a simpler mark word value carrier
- Resolved
(1 links to)