-
Notifications
You must be signed in to change notification settings - Fork 415
Avoid size overflow when allocating memory #6771
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
Conversation
Guard against very large allocation sizes which overflow when memory tagging overhead is added. Signed-off-by: Devin Nakamura <devinn@ca.ibm.com>
Signed-off-by: Devin Nakamura <devinn@ca.ibm.com>
|
jenkins build all |
Known failure: #6571. |
|
A new assertion is noticed, which does not appear in previous PR builds. Why does the assertion occur? Does it prevent |
It does not stop the test from completing. Looking into it, it seems that we clear the allocaiton headers before calling the c-lib realloc, however we never consider the possibility that realloc can fail thus we end up with a still valid chunk of memory, but invalid allocation headers. Note: this isn't specific to this change, but would seem to come into play any time realloc fails for any reason. |
|
jenkins build all |
babsingh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current approach modifies the common-path and stack allocates a variable. The error-path, which handles the realloc failure, will be rarely taken. My suggestion would be to only modify the error-path and avoid stack allocation to minimize any impact on perf.
Restore allocation headers in the case realloc fails Signed-off-by: Devin Nakamura <devinn@ca.ibm.com>
f0ee5b3 to
4808a14
Compare
|
jenkins build all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://ci.eclipse.org/omr/job/PullRequest-linux_ppc-64_le_gcc/3851/
Known failure: #6571.
https://github.com/eclipse/omr/pull/6771/checks?check_run_id=8990482324
Known failure: #6516.
@dnakamura Can you please port these changes to https://github.com/eclipse-openj9/openj9-omr/tree/v0.35.0-release?
Commit 1 - Guard against very large allocation sizes which overflow
when memory tagging overhead is added.
Commit 2 - omrmemtest: check that large allocations don't overflow.
Commit 3 - Handle reallocation failures: Restore allocation headers in
the case realloc fails.
Signed-off-by: Devin Nakamura devinn@ca.ibm.com