Skip to content

[5.8][build] Remove runpath from build host from shared ICU libraries on linux #65692

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 15, 2023

Conversation

finagolfin
Copy link
Member

Cherrypick of #64365

Explanation: I found this --enable-rpath flag in a hurry more than a year ago and suggested it before the branch in #40340, but was unaware it also adds an absolute runpath to the CI install directory:

> readelf -d swift-5.8-RELEASE-ubuntu20.04/usr/lib/swift/linux/libicu*so | ag "File:|runpath"
File: swift-5.8-RELEASE-ubuntu20.04/usr/lib/swift/linux/libicudataswift.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN:/home/build-user/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux/x86_64]
File: swift-5.8-RELEASE-ubuntu20.04/usr/lib/swift/linux/libicui18nswift.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN:/home/build-user/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux/x86_64]
File: swift-5.8-RELEASE-ubuntu20.04/usr/lib/swift/linux/libicuucswift.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN:/home/build-user/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux/x86_64]

This is a deployment security risk, as these libraries are linked by Foundation, and thus is worth fixing in the current 5.8 release branch.

Scope: Only affects these libicu runpaths on ELF platforms like linux

Issue: None

Risk: low, as it only affects libicu runpaths for ELF platforms

Testing: Passed all CI, and we've had no problems since it was merged into trunk/5.9 a couple months ago.

Reviewer: @bnbarham

@tomerd, would be good to get this in before the next patch release.

@finagolfin finagolfin requested a review from a team as a code owner May 5, 2023 09:45
@finagolfin
Copy link
Member Author

@shahmishal, any chance we can get this small 5.8 tweak in before 5.8.1 is released?

@etcwilde
Copy link
Contributor

@swift-ci please test

Copy link
Contributor

@etcwilde etcwilde left a comment

Choose a reason for hiding this comment

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

There may be someone abusing this who we'll break, but I'm okay not officially endorsing the rpath configuration.

@etcwilde
Copy link
Contributor

@swift-ci Please Build Toolchain Linux Platform

@finagolfin
Copy link
Member Author

All CI passed, plus I downloaded the linux toolchain built for this pull, checked that these CI runpaths were removed from the ICU libraries, and built and tested NIO with this modified 5.8 toolchain without a problem.

@DougGregor, this is ready to go in.

@tomerd tomerd merged commit 6c4331d into swiftlang:release/5.8 May 15, 2023
@finagolfin finagolfin deleted the release/5.8 branch May 16, 2023 07:45
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