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

Instrument validity checks for pointer to reference casts for slices and str's #3513

Merged
merged 9 commits into from
Sep 18, 2024

Conversation

zhassan-aws
Copy link
Contributor

As pointed out in #3498, validity checks for pointer to reference casts (added in #3221) were not instrumented in the case of fat pointers (e.g. array and string slices). This PR extends the instrumentation of validity checks to handle those cases.

Resolves #3498

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

@zhassan-aws zhassan-aws requested a review from a team as a code owner September 11, 2024 23:07
@github-actions github-actions bot added the Z-BenchCI Tag a PR to run benchmark CI label Sep 11, 2024
Copy link
Contributor

@celinval celinval left a comment

Choose a reason for hiding this comment

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

I pushed a fix for the test, but as I mentioned before. I think we could create a new test from the existing one that shows the new code catch those issues.

BTW, I think the code we added still does not check alignment.

kani-compiler/src/codegen_cprover_gotoc/codegen/assert.rs Outdated Show resolved Hide resolved
@zhassan-aws
Copy link
Contributor Author

I think we could create a new test from the existing one that shows the new code catch those issues.

Added as an expected test.

Copy link
Contributor

@celinval celinval left a comment

Choose a reason for hiding this comment

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

Thanks!

@zhassan-aws zhassan-aws added this pull request to the merge queue Sep 18, 2024
Merged via the queue into model-checking:main with commit f888913 Sep 18, 2024
27 checks passed
@zhassan-aws zhassan-aws deleted the iss-3498 branch September 18, 2024 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Z-BenchCI Tag a PR to run benchmark CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kani does not detect UB when generating an invalid slice reference from an invalid slice pointer
2 participants