access-softek / llvm-project

Other
0 stars 0 forks source link

[AArch64][PAC] Support init/fini array signing #58

Closed kovdan01 closed 10 months ago

kovdan01 commented 10 months ago

Implement an option -fptrauth-init-fini allowing to sign pointers in init/fini arrays with a constant discriminator distinguishing them from other function pointers.

The discriminator value is 0xD9D4 which stands for ptrauth_string_discriminator("init_fini").

A preprocessor expression __has_feature(ptrauth_init_fini) allows to change user code behavior depending on presense of the feature.

The option is automatically enabled when building with -mbranch-protection=pauthabi and disabled by default otherwise.

Implemented in 4fb933cc2d3629905a7ddf56ae96276484371a3d.