mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[metadata prespecialization] Ptrauth for compared protocol conformances.
Two protocol conformance descriptors are passed to swift_compareProtocolConformanceDecriptors from generic metadata accessors when there is a canonical prespecialization and one of the generic arguments has a protocol requirement. Previously, the descriptors were incorrectly being passed without ptrauth processing: one from the witness table in the arguments that are passed in to the accessor and one known statically. Here, the descriptor in the witness table is authed using the ProtocolConformanceDescriptor schema. Then, both descriptors are signed using the ProtocolConformanceDescriptorsAsArguments schema. Finally, in the runtime function, the descriptors are authed.
This commit is contained in:
@@ -4996,6 +4996,11 @@ const WitnessTable *swift::swift_getAssociatedConformanceWitness(
|
||||
bool swift::swift_compareProtocolConformanceDescriptors(
|
||||
const ProtocolConformanceDescriptor *lhs,
|
||||
const ProtocolConformanceDescriptor *rhs) {
|
||||
lhs = swift_auth_data_non_address(
|
||||
lhs, SpecialPointerAuthDiscriminators::ProtocolConformanceDescriptor);
|
||||
rhs = swift_auth_data_non_address(
|
||||
rhs, SpecialPointerAuthDiscriminators::ProtocolConformanceDescriptor);
|
||||
|
||||
return MetadataCacheKey::compareProtocolConformanceDescriptors(lhs, rhs) == 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user