Skip to content

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

Closed
@kovdan01

Description

@kovdan01

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions