Skip to content

Commit 3615dbf

Browse files
committed
[Concurrency] Fix ptr auth for task priority escalation handler
We missed to sign the handler. Along the way the signature of it changed, so adjust for that. How to get the number: ``` func PROPER(bar: (TaskPriority, TaskPriority) -> Void) { let p = TaskPriority.default bar(p, p) } ``` ``` -> % swiftc -target arm64e-apple-macos13 example.swift -S -o - | swift demangle | grep -a3 autda stur x8, [x29, #-64] mov x17, x8 movk x17, swiftlang#11839, lsl swiftlang#48 <<<<<<<<< autda x16, x17 ldr x8, [x16, swiftlang#64] lsr x8, x8, #0 add x8, x8, swiftlang#15 ``` Resolves rdar://150378890
1 parent 1dda72d commit 3615dbf

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

include/swift/ABI/MetadataValues.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1765,7 +1765,7 @@ namespace SpecialPointerAuthDiscriminators {
17651765
const uint16_t AsyncContextParent = 0xbda2; // = 48546
17661766
const uint16_t AsyncContextResume = 0xd707; // = 55047
17671767
const uint16_t AsyncContextYield = 0xe207; // = 57863
1768-
const uint16_t CancellationNotificationFunction = 0x1933; // = 6451
1768+
const uint16_t CancellationNotificationFunction = 0x2E3F; // = 11839 (TaskPriority, TaskPriority) -> Void
17691769
const uint16_t EscalationNotificationFunction = 0x7861; // = 30817
17701770
const uint16_t AsyncThinNullaryFunction = 0x0f08; // = 3848
17711771
const uint16_t AsyncFutureFunction = 0x720f; // = 29199

stdlib/public/Concurrency/Task.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1811,8 +1811,9 @@ swift_task_addPriorityEscalationHandlerImpl(
18111811
void *context) {
18121812
void *allocation =
18131813
swift_task_alloc(sizeof(EscalationNotificationStatusRecord));
1814+
auto unsigned_handler = swift_auth_code(handler, 11839);
18141815
auto *record = ::new (allocation)
1815-
EscalationNotificationStatusRecord(handler, context);
1816+
EscalationNotificationStatusRecord(unsigned_handler, context);
18161817

18171818
addStatusRecordToSelf(record, [&](ActiveTaskStatus oldStatus, ActiveTaskStatus& newStatus) {
18181819
return true;

0 commit comments

Comments
 (0)