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

Catch invalid uses of {must,no}_preserve_cheri_tag #648

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

arichardson
Copy link
Member

@arichardson arichardson commented Oct 5, 2022

It does not make sense to set this attribute for memory transfer
intrinsics that copy less than sizeof(cap) and doing so could indicate
a logic error in an LLVM pass/the clang logic that sets this attribute
initially. This adds a check to the verified as well as an assertion
when setting the attribute (to make it easier to create reduced test
cases in case we discover further bad calls).

Additionally, this also checks that we don't add the attributes for
non-CHERI targets.

This depends on #594 and #650 since we currently create invalid calls.

It does not make sense to set this attribute for memory transfer
intrinsics that copy less than sizeof(cap) and doing so could indicate
a logic error in an LLVM pass/the clang logic that sets this attribute
initially. This adds a check to the verified as well as an assertion
when setting the attribute (to make it easier to create reduced test
cases in case we discover further bad calls).

Additionally, this also checks that we don't add the attributes for
non-CHERI targets.
It was not actually testing what it claimed it was testing and the code
to do what it was supposed to test has long been replaced. It just
happened to work by chance because must_preserve_cheri_tags was being
treated as "force libcall" even for non-CHERI targets.
This problem was found by a new IRVerifier check for the preserve tags
function attribute.
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.

1 participant