Skip to content

[Runtimes][Core] Add a setting to mark backtracer path as mandatory #82842

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

Conversation

edymtt
Copy link
Contributor

@edymtt edymtt commented Jul 7, 2025

...and apply that to the Apple vendor caches.

Addresses rdar://154230894

...and apply that to the Apple vendor caches.

Addresses rdar://154230894
@edymtt
Copy link
Contributor Author

edymtt commented Jul 7, 2025

@swift-ci please smoke test

@@ -81,6 +81,10 @@ if(SwiftCore_ENABLE_FILESYSTEM_SUPPORT AND (NOT SwiftCore_ARCH_SUBDIR OR NOT Swi
message(SEND_ERROR "Filesystem support requires setting `SwiftCore_ARCH_SUBDIR` and `SwiftCore_PLATFORM_SUBDIR`")
endif()

if(SwiftCore_VERIFY_BACKTRACER_PATH AND (NOT SwiftCore_BACKTRACER_PATH))
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I see the point of having this as a vendor carve out. If backtracer is enabled, always ensure that the path is provided. That simplifies the logic and reduces the number of possible configurations.

Copy link
Contributor

Choose a reason for hiding this comment

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

The point is that, in general, Swift's install location isn't fixed, so the backtracer path gets constructed by the runtime by looking at the path of libswiftCore.dylib/.so/swiftCore.dll, or for -static-stdlib cases, the application's executable, and then by searching a few other "known" locations.

For Darwin specifically because it's an OS component, we don't want that behaviour, because we know where the backtracer is installed and hard-coding the path improves system security (it reduces the likelihood of an attacker being able to control the path to the backtracer).

Copy link
Member

Choose a reason for hiding this comment

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

Why not just do that under if(APPLE) then? I think that if we can avoid options, that is better.

Copy link
Contributor

Choose a reason for hiding this comment

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

Because there's at least some chance that one of the Linux distros might pick Swift up at some point, and they will want to fix the path also?

Copy link
Member

Choose a reason for hiding this comment

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

Sure, I'm not against the SwiftCore_BACKTRACER_PATH option, I'm trying to avoid the SwiftCore_VERIFY_BACKTRACER_PATH option.

Copy link
Member

@etcwilde etcwilde Jul 9, 2025

Choose a reason for hiding this comment

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

The runtime has a default, which is convenient and necessary for testing, so there are situations where it should be left unset, like for local development. There are security implications to leaving it empty when distributing the runtimes though. Vendors should be able to set something to ensure that it can't accidentally be forgotten. If you have a better proposal than having a check for it, I'd be happy to listen.

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 now realize I started from the wrong assumption that this option is useful in general, while in fact at the moment it is specific to Darwin.

I will add this instead to our internal vendor files, so we don't add unnecessary complexity in opensource.

@edymtt edymtt closed this Jul 11, 2025
@edymtt edymtt deleted the edymtt/verify-backtracer-path-in-runtimes branch July 11, 2025 17:10
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.

4 participants