Skip to content

[Concurrency] Fix ptr auth for task priority escalation handler #81229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2025

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented May 1, 2025

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, #11839, lsl #48 <<<<<<<<<
            autda   x16, x17
            ldr     x8, [x16, #64]
            lsr     x8, x8, #0
            add     x8, x8, #15

Resolves rdar://150378890

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
@ktoso
Copy link
Contributor Author

ktoso commented May 1, 2025

@swift-ci please smoke test

Copy link
Contributor

@rjmccall rjmccall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. You should separately make sure that the function pointer is stored with reasonable diversity in the status record, but that's not necessary to fix the bug.

@ktoso
Copy link
Contributor Author

ktoso commented May 1, 2025

Thank you!

Yup, we have that

class EscalationNotificationStatusRecord : public TaskStatusRecord {
public:
  using FunctionType = SWIFT_CC(swift) void(JobPriority, JobPriority, SWIFT_CONTEXT void *);

private:
  FunctionType *__ptrauth_swift_escalation_notification_function Function;

@ktoso ktoso merged commit 62c6159 into swiftlang:main May 1, 2025
3 checks passed
@ktoso ktoso deleted the wip-escalation-handler-priority-auth branch May 1, 2025 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants