mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Concurrency] Fix ptrauth value for __ptrauth_swift_escalation_notification_function
Previously these records were not used at all, so changing this has no impact on existing runtimes. Note that we changedd the FunctionType because the previous one was slightly incorrect -- the context comes LAST in the type, not first.
This commit is contained in:
@@ -1678,7 +1678,7 @@ namespace SpecialPointerAuthDiscriminators {
|
||||
const uint16_t AsyncContextResume = 0xd707; // = 55047
|
||||
const uint16_t AsyncContextYield = 0xe207; // = 57863
|
||||
const uint16_t CancellationNotificationFunction = 0x1933; // = 6451
|
||||
const uint16_t EscalationNotificationFunction = 0x5be4; // = 23524
|
||||
const uint16_t EscalationNotificationFunction = 0xf59d; // = 62877
|
||||
const uint16_t AsyncThinNullaryFunction = 0x0f08; // = 3848
|
||||
const uint16_t AsyncFutureFunction = 0x720f; // = 29199
|
||||
|
||||
|
||||
@@ -1773,7 +1773,7 @@ swift_task_addPriorityEscalationHandlerImpl(
|
||||
void *context) {
|
||||
void *allocation =
|
||||
swift_task_alloc(sizeof(EscalationNotificationStatusRecord));
|
||||
auto unsigned_handler = swift_auth_code(handler, 3848); // FIXME: fix this number for ptrauth
|
||||
auto unsigned_handler = swift_auth_code(handler, 62877);
|
||||
auto *record = ::new (allocation)
|
||||
EscalationNotificationStatusRecord(handler, context);
|
||||
|
||||
|
||||
@@ -994,26 +994,12 @@ public func withTaskPriorityEscalationHandler<T, E>(
|
||||
let handler0: (UInt8) -> Void = {
|
||||
handler(TaskPriority(rawValue: $0))
|
||||
}
|
||||
let record = _taskaddPriorityEscalationHandler(handler: handler0)
|
||||
defer { _taskremovePriorityEscalationHandler(record: record) }
|
||||
let record = _taskAddPriorityEscalationHandler(handler: handler0)
|
||||
defer { _taskRemovePriorityEscalationHandler(record: record) }
|
||||
|
||||
return try await operation()
|
||||
}
|
||||
|
||||
@usableFromInline
|
||||
@available(SwiftStdlib 9999, *)
|
||||
@_silgen_name("swift_task_addPriorityEscalationHandler")
|
||||
func _taskaddPriorityEscalationHandler(
|
||||
handler: (UInt8) -> Void
|
||||
) -> UnsafeRawPointer /*EscalationNotificationStatusRecord*/
|
||||
|
||||
@usableFromInline
|
||||
@available(SwiftStdlib 9999, *)
|
||||
@_silgen_name("swift_task_removePriorityEscalationHandler")
|
||||
func _taskremovePriorityEscalationHandler(
|
||||
record: UnsafeRawPointer /*EscalationNotificationStatusRecord*/
|
||||
)
|
||||
|
||||
// ==== UnsafeCurrentTask ------------------------------------------------------
|
||||
|
||||
/// Calls a closure with an unsafe reference to the current task.
|
||||
@@ -1185,6 +1171,20 @@ func _enqueueJobGlobalWithDeadline(_ seconds: Int64, _ nanoseconds: Int64,
|
||||
_ toleranceSec: Int64, _ toleranceNSec: Int64,
|
||||
_ clock: Int32, _ task: Builtin.Job)
|
||||
|
||||
@usableFromInline
|
||||
@available(SwiftStdlib 9999, *)
|
||||
@_silgen_name("swift_task_addPriorityEscalationHandler")
|
||||
func _taskAddPriorityEscalationHandler(
|
||||
handler: (UInt8) -> Void
|
||||
) -> UnsafeRawPointer /*EscalationNotificationStatusRecord*/
|
||||
|
||||
@usableFromInline
|
||||
@available(SwiftStdlib 9999, *)
|
||||
@_silgen_name("swift_task_removePriorityEscalationHandler")
|
||||
func _taskRemovePriorityEscalationHandler(
|
||||
record: UnsafeRawPointer /*EscalationNotificationStatusRecord*/
|
||||
)
|
||||
|
||||
@available(SwiftStdlib 5.1, *)
|
||||
@usableFromInline
|
||||
@_silgen_name("swift_task_asyncMainDrainQueue")
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
// UNSUPPORTED: DARWIN_SIMULATOR=ios
|
||||
// UNSUPPORTED: DARWIN_SIMULATOR=tvos
|
||||
|
||||
// rdar://107390341 - Temporarily disable for arm64e
|
||||
// rdar://107390341 - Because task escalation tests seem disabled on this platform
|
||||
// UNSUPPORTED: CPU=arm64e
|
||||
|
||||
import Darwin
|
||||
|
||||
Reference in New Issue
Block a user