Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Concurrency] Use reinterpret_cast for function_cast when ptrauth is on. #81380

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented May 8, 2025

We need to use reinterpret_cast when ptrauth is enabled to ensure that any necessary auth-and-sign operations are performed.

rdar://150747009

We need to use reinterpret_cast when ptrauth is enabled to ensure that any necessary auth-and-sign operations are performed.

rdar://150747009
@mikeash mikeash requested a review from DougGregor as a code owner May 8, 2025 20:29
@mikeash
Copy link
Contributor Author

mikeash commented May 8, 2025

@swift-ci please test

#if __has_feature(ptrauth_calls)
// Use reinterpret_cast here so we perform any necessary auth-and-sign.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
Copy link
Member

Choose a reason for hiding this comment

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

I don't think that we should be silencing away this warning. This is technically UB, and the compiler is pointing that out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don’t see any use in leaving it. The cast is necessary for correct behavior when ptrauth_calls is on, so we’d just have a warning we can’t address.

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.

3 participants