Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check for static class objects in Node::mayModifyValue #7294

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jmesyou
Copy link
Contributor

@jmesyou jmesyou commented Mar 26, 2024

This commit fixes a segmentation fault that occurs during
side effect detection in IL generation for an edge case
a static class object reference is passed in as an argument
to Node::mayModifyValue.

Node::mayModifyValue assumes that if its opcode is a store,
the symbol reference whose value it modifies must be one of:

  • auto
  • parm
  • static field ref

Because of the way that side effects of nodes are
checked by recursively traversing their children
(see J9ByteCodeIlGenerator::valueMayBeModified)
and the way certain IL is generated,
it is possible that these assumptions are not invariant.

In a concrete case, when a awrtbar is generated for static stores,
one of the awrtbar children will be a loadaddr which loads
a static class object. When this case occurs, node::mayModifyValue
will erroneously use the constant pool index of the static class reference
as a static field reference, eventually resulting in a garbage value
and causing a segmentation fault.

Fixes: eclipse-openj9/openj9#18156

This commit fixes a segmentation fault that occurs during
side effect detection in IL generation for an edge case
a static class object reference is passed in as an argument
to Node::mayModifyValue.

Node::mayModifyValue assumes that if its opcode is a store,
the symbol reference whose value it modifies must be one of:

+ auto
+ parm
+ static field ref

Because of the way that side effects of nodes are
checked by recursively traversing their children
(see J9ByteCodeIlGenerator::valueMayBeModified)
and the way certain IL is generated,
it is possible that these assumptions are not invariant.

In a concrete case, when a awrtbar is generated for static stores,
one of the awrtbar children will be a loadaddr which loads
a static class object. When this case occurs, node::mayModifyValue
will erroneously use the constant pool index of the static class reference
as a static field reference, eventually resulting in a garbage value
and causing a segmentation fault.

Fixes: #18156

Signed-off-by: James You <james.you@protonmail.com>
@hzongaro hzongaro requested review from hzongaro and removed request for vijaysun-omr March 28, 2024 13:55
@hzongaro hzongaro self-assigned this Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[JDK11.0.20.1+1] Segmentation error on libj9jit29.so with option -XX:-UseCompressedOops
2 participants