Skip to content

Conversation

@dnakamura
Copy link

@dnakamura dnakamura commented Oct 18, 2022

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

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>
@babsingh
Copy link
Contributor

jenkins build all

@babsingh
Copy link
Contributor

babsingh commented Oct 18, 2022

https://ci.eclipse.org/omr/job/PullRequest-linux_ppc-64_le_gcc/3848/consoleFull

Known failure: #6571.

13:06:38  30: �[0;32m[----------] �[m14 tests from Special/PPCDirectEncodingTest
13:06:38  30: free(): invalid next size (normal)
13:06:38  30/30 Test #30: compunittest ......................Child aborted***Exception:   0.75 sec

@babsingh
Copy link
Contributor

babsingh commented Oct 18, 2022

A new assertion is noticed, which does not appear in previous PR builds. Why does the assertion occur? Does it prevent mem_test8 to complete?

12:59:24  14: [----------] 11 tests from PortMemTest
12:59:24  14: ** ASSERTION FAILED ** omrport.359 at /home/jenkins/jenkins-agent/workspace/Build/port/common/omrmemtag.c:145 Trc_Assert_PRT_memory_corruption_detected((memoryCorruptionDetected))
12:59:24  14: [----------] 11 tests from PortMemTest (26 ms total)

@dnakamura
Copy link
Author

A new assertion is noticed, which does not appear in previous PR builds. Why does the assertion occur? Does it prevent mem_test8 to complete?

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.

@dnakamura
Copy link
Author

jenkins build all

Copy link
Contributor

@babsingh babsingh left a 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>
@babsingh
Copy link
Contributor

jenkins build all

Copy link
Contributor

@babsingh babsingh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

2 participants