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

Improve robustness of checking tags of allocated memory blocks #4191

Merged
merged 1 commit into from
Jan 8, 2019

Conversation

keithc-ca
Copy link
Contributor

@keithc-ca keithc-ca commented Jan 7, 2019

J9MemTag.allocSize has type uintptr_t (aka UDATA), which is mapped to U64 by MSVC on Windows (or with the changes in eclipse-omr/omr#3355 on all 64-bit platforms). A random address treated as a pointer to a J9MemTag has a 50% chance of referring to a J9MemTag where allocSize >= 2^63 which would trigger an InvalidDataTypeException from U64.longValue(). This change modifies ROUNDED_FOOTER_OFFSET() so it always returns a UDATA object independent of the actual
argument type, thus avoiding that exception for blocks that otherwise would fail the sanity checks.

eclipse-omr/omr#3422 replays eclipse-omr/omr#3355.

J9MemTag.allocSize has type uintptr_t (aka UDATA), which is mapped
to U64 by MSVC on Windows (or with the changes in eclipse-omr/omr#3355
on all 64-bit platforms). A random address treated as a pointer
to a J9MemTag has a 50% chance of referring to a J9MemTag where
allocSize >= 2^63 which would trigger an InvalidDataTypeException
from U64.longValue(). This change modifies ROUNDED_FOOTER_OFFSET()
so it always returns a UDATA object independent of the actual
argument type, thus avoiding that exception for blocks that otherwise
would fail the sanity checks.

Signed-off-by: Keith W. Campbell <keithc@ca.ibm.com>
@keithc-ca
Copy link
Contributor Author

Jenkins test all zlinux jdk11 depends eclipse-omr/omr#3422

@pshipton
Copy link
Member

pshipton commented Jan 7, 2019

Jenkins test all win jdk11 depends eclipse-omr/omr#3422

@pshipton
Copy link
Member

pshipton commented Jan 7, 2019

jenkins test sanity win jdk11 depends eclipse-omr/omr#3422

@pshipton
Copy link
Member

pshipton commented Jan 7, 2019

jenkins test extended win jdk11 depends eclipse-omr/omr#3422

@pshipton pshipton merged commit 761ff93 into eclipse-openj9:master Jan 8, 2019
@keithc-ca keithc-ca deleted the ddr branch January 8, 2019 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants