-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[CMake] Don't add an extraneous rpath to the swift-frontend #64103
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
Pinging @ktoso, haven't gotten a response on this so far and it's about to ship with the 5.8 release. |
Ping @eeckstein, you have some experience with these rpath issues with your bootstrapping work. |
Sorry, I can't remember the details. What you should do is to test all affected bootstrapping modes and see if the RPATH in the binary is set correct and if the final swift-frontend is loading the correct libraries (with |
@eeckstein, nothing wrong with your bootstrapping work, the issue is this line that I'm removing in this pull, that was added by Doug and Zoe last year. It adds the incorrect second rpath shown in my OP for linux, and should add it incorrectly for macOS too for full bootstraps. I'd simply like your opinion on if this line should be removed. |
I can't tell for sure without testing it. |
@edymtt, perhaps you can review? |
@CodaFi, would you take a look at this? |
@etcwilde, any input on this issue? |
@buttaface apologies for acknowledging this late -- at the moment I am busy with other efforts, so cannot devote the time to reason on any impact of this change. In the meantime, could you comment on the impact this has on the Linux build? |
@edymtt, I believe this is just a cleanup of an extra unneeded runpath added on linux and certain macOS configs. This could be a mild security issue in certain system install layouts and cause libraries to be loaded that shouldn't be, so it is better to clean it up. If you would run the CI on this pull, that should give us an idea if this line was unneeded in the first place. |
@artemcm, would you run the CI on this? |
@swift-ci please test |
@edymtt, passed CI, which heavily implies this line was extraneous all along, though the CI obviously doesn't test all configurations. I'm fairly certain it is never needed for linux, I just can't speak for some obscure macOS config. |
@DougGregor, you committed this line, can you review? |
Found some time to review this, and in fact I see that @finagolfin -- could you check if my understanding of your concern is correct? (in the meantime I will check on the "obscure macOS configs") |
@swift-ci please test |
@swift-ci please build toolchain |
@edymtt, yep, that is the problem, you got it. |
Mac toolchain build failure is unrelated, some libcxx issue:
|
Agree, that seems related to this LLVM PR |
Double checked that in the generated linux toolchain we have only one rpath
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for noticing this!
Thanks @edymtt, I will submit this for the release branches next. |
Cherrypick of #64103 Explanation: The current 5.9 snapshot has an incorrect relative runpath added to the compiler on linux, the second one: ``` > readelf -d swift-5.9-DEVELOPMENT-SNAPSHOT-2023-05-22-a-ubuntu20.04/usr/bin/swift-frontend | ag runpath 0x000000000000001d (RUNPATH) Library runpath: [$ORIGIN/../lib/swift/linux:$ORIGIN/../../lib/swift/linux] This pull fixes that, removing a mild security risk when running the compiler. ``` Scope: Only affects the compiler runpath on linux Issue: None Risk: low, as it only removes an unused runpath for the linux compiler Testing: Passed all CI on trunk Reviewer: @edymtt
) Cherrypick of #64103 __Explanation__: The 5.8 release has an incorrect relative runpath added to the compiler on linux, the second one: ``` > readelf -d swift-5.8-RELEASE-ubuntu20.04/usr/bin/swift-frontend | ag runpath 0x000000000000001d (RUNPATH) Library runpath: [$ORIGIN/../lib/swift/linux:$ORIGIN/../../lib/swift/linux] This pull fixes that, removing a mild security risk when running the compiler. ``` __Scope__: Only affects the compiler runpath on linux __Issue__: None __Risk__: low, as it only removes an unused runpath for the linux compiler __Testing__: Passed all CI on trunk __Reviewer__: @edymtt
When checking rpaths for #63782, I just noticed these incorrect runpaths on linux:
It looks like this line was incorrectly added in #60943, then incorporated into #61426 and merged.
This line is unused on Darwin because the CI builds with
BOOTSTRAPPING-WITH-HOSTLIBS
, but the incorrect runpath should show up on macOS too if a full bootstrap were done.@zoecarver and @DougGregor, let me know what you think.