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

[PAuth][clang] Error on passing PAuth-specific options on non-PAuth target #65

Closed
kovdan01 opened this issue Dec 12, 2023 · 2 comments · Fixed by #66
Closed

[PAuth][clang] Error on passing PAuth-specific options on non-PAuth target #65

kovdan01 opened this issue Dec 12, 2023 · 2 comments · Fixed by #66
Assignees
Labels

Comments

@kovdan01
Copy link
Contributor

There are several PAuth-specific options in clang: -msign-return-address, -fptrauth-*, a meta-option -mbranch-protection=pauthabi, etc. Currently, clang does no verify if PAuth subtarget feature is enabled when such options are passed. Given that backend also does not verify that, we only fail in assertion during verifying machine instructions if some pac-specific instruction are emitted for pac-disabled target.

#62 clearly shows that backend is a bad place to add such verification since there are way too many places where checks should be added. Also, it's better to fail as early as we can.

The verification should probably exploit the HasPAuth field of AArch64TargetInfo (see clang/lib/Basic/Targets/AArch64.h). It should probably also be set in AArch64TargetInfo::handleTargetFeatures when subtarget is greater or equal than armv8.

Software authentication should also be taken into account so we don't fail when a user tries to enable that.

See also https://reviews.llvm.org/D115501 for similar checks implementation.

@atrosinenko
Copy link
Contributor

Fix proposed in #66.

@kovdan01 kovdan01 linked a pull request Jul 1, 2024 that will close this issue
@kovdan01
Copy link
Contributor Author

kovdan01 commented Jul 1, 2024

Close as resolved in #66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants