Skip to content

[5.9][CMake] Don't add an extraneous rpath to the swift-frontend #66121

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

Conversation

finagolfin
Copy link
Member

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

@finagolfin finagolfin requested a review from a team as a code owner May 25, 2023 09:25
@edymtt
Copy link
Contributor

edymtt commented May 25, 2023

@swift-ci please test

@edymtt
Copy link
Contributor

edymtt commented May 25, 2023

@swift-ci please build toolchain

@edymtt edymtt added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.9 labels May 25, 2023
@finagolfin
Copy link
Member Author

Some problem on the macOS CI, toolchain build appears stuck.

@edymtt
Copy link
Contributor

edymtt commented May 26, 2023

@swift-ci please test

@edymtt
Copy link
Contributor

edymtt commented May 26, 2023

(sorry for the typo, misread the job that failed :( )

@edymtt
Copy link
Contributor

edymtt commented May 26, 2023

@swift-ci please build toolchain macOS

@edymtt
Copy link
Contributor

edymtt commented May 29, 2023

The generated Linux and macOS toolchains look good

$ readelf -d usr/bin/swift-frontend | grep -E "File:|runpath"
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib/swift/linux]
> otool -lv macos/Library/Developer/Toolchains/swift-PR-66121-708.xctoolchain/usr/bin/swift-frontend | grep -A2 RPATH
          cmd LC_RPATH
      cmdsize 32
         path /usr/lib/swift (offset 12)
--
          cmd LC_RPATH
      cmdsize 48
         path @executable_path/../lib/swift/host (offset 12)

@edymtt edymtt merged commit 2e610ad into swiftlang:release/5.9 May 29, 2023
@finagolfin finagolfin deleted the release/5.9 branch May 30, 2023 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.9
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants