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

Faster CBMC stubs for memset and memcpy #300

Merged
merged 3 commits into from
Apr 10, 2019

Conversation

danielsn
Copy link
Contributor

@danielsn danielsn commented Apr 5, 2019

Description of changes:
When CBMC processes a memcpy or memset, it ends up doing many invocations of the array theory, which is expensive. Instead, provide CBMC stubs which use 64 bit arithmetic, which in practice often proves to lead to quicker proofs.

Each new implementation has a CBMC proof that it is functionally equivalent to a naive implementation.

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

@danielsn danielsn force-pushed the new-memcpy-memset-stubs branch from 510cf7a to 6feed08 Compare April 5, 2019 18:00
@danielsn danielsn force-pushed the new-memcpy-memset-stubs branch from 89dc5f7 to 7603890 Compare April 9, 2019 19:43
uint64_t *d = (uint64_t *)dst;

for (size_t i = 0; i < num_uint64s; ++i) {
d[i] = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be d[i] = c; or am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This harness is specialized for the common case of memset(0 ...). It uses 0 as the assignment here to let CBMC do more constant propagation. This is safe because of the assert here

@danielsn danielsn merged commit cbe96ad into awslabs:master Apr 10, 2019
@danielsn danielsn deleted the new-memcpy-memset-stubs branch April 10, 2019 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants