================ @@ -377,13 +395,32 @@ const char *CFI_Parser<A>::parseCIE(A &addressSpace, pint_t cie, case 'z': cieInfo->fdesHaveAugmentationData = true; break; - case 'P': + case 'P': { cieInfo->personalityEncoding = addressSpace.get8(p); ++p; cieInfo->personalityOffsetInCIE = (uint8_t)(p - cie); - cieInfo->personality = addressSpace - .getEncodedP(p, cieContentEnd, cieInfo->personalityEncoding); + pint_t personality = addressSpace.getEncodedP( + p, cieContentEnd, cieInfo->personalityEncoding, + /*datarelBase=*/0, &resultAddr); +#if __has_feature(ptrauth_calls) + if (personality) { + // The GOT for the personality function was signed address + // authenticated. Manually re-sign with the CIE_Info::personality + // schema. If we could guarantee the encoding of the personality we + // could avoid this by simply giving resultAddr the correct ptrauth + // schema and performing an assignment. + const auto discriminator = ptrauth_blend_discriminator( + &cieInfo->personality, + ptrauth_string_discriminator("CIE_Info::personality")); + void *signedPtr = ptrauth_auth_and_resign( + (void *)personality, ptrauth_key_function_pointer, resultAddr, ---------------- atrosinenko wrote:
In my configuration, I had to use ```cpp const auto oldDiscriminator = ptrauth_blend_discriminator( (void*)resultAddr, ptrauth_string_discriminator("personality")); ``` instead of plain `resultAddr`. This may be `pauthtest`-abi-specific. https://github.com/llvm/llvm-project/pull/143230 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits