Skip to content

Commit bb89ea4

Browse files
committed
[Runtime] Authenticate relative witness tables in _checkWitnessTableIsolation.
When SWIFT_STDLIB_USE_RELATIVE_PROTOCOL_WITNESS_TABLES is set, witness table pointers are signed. We need to authenticate them before using them. rdar://148687148
1 parent 3f4519e commit bb89ea4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

stdlib/public/runtime/ProtocolConformance.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,12 @@ static bool _checkWitnessTableIsolation(
444444
llvm::ArrayRef<const void *> conditionalArgs,
445445
ConformanceExecutionContext &context
446446
) {
447+
#if SWIFT_STDLIB_USE_RELATIVE_PROTOCOL_WITNESS_TABLES && SWIFT_PTRAUTH
448+
wtable = ptrauth_auth_data(wtable,
449+
ptrauth_key_process_independent_data,
450+
SpecialPointerAuthDiscriminators::RelativeProtocolWitnessTable);
451+
#endif
452+
447453
// If there's no protocol conformance descriptor, do nothing.
448454
auto description = wtable->getDescription();
449455
if (!description)

0 commit comments

Comments
 (0)