-
Notifications
You must be signed in to change notification settings - Fork 92
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 a few examples of using shadow memory to check initialization of slices #3237
Add a few examples of using shadow memory to check initialization of slices #3237
Conversation
Nice! Those are interesting examples, although I am a bit confused about the semantics of the checks. Right now, the only thing that is actually checked is that the underlying memory of the slices points to the same memory objects that were previously tagged as initialized. In other words, if the methods under verification somehow deinitialized the memory or allocated and initialized new memory, the checks wouldn't catch it. Maybe we should add some comments explaining the limitations of the checks? |
Thanks for taking a look @artemagvanian.
Correct. The purpose of the tests is to check that those unsafe methods do not mess up the start/end of the slices produced in a way that makes them go out of bounds of the original arrays/slices.
Correct. The proper way to check for such cases is what you did in #3264. The main purpose of the tests in this PR is to demonstrate a possible usage of the shadow memory APIs. They're not really verifying those methods. I can add a comment that clarifies that. |
@artemagvanian I added clarifying comments in those tests. |
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.
Looks good to me!
A follow-up on #3200: use API to check that slices produced by some slice operations that internally use
unsafe
are properly initialized.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.