-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Enable LVI hardening for x86_64-fortanix-unknown-sgx #72655
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,29 @@ RUN apt-get update && apt-get build-dep -y clang llvm && apt-get install -y --no | |
RUN apt-key adv --batch --yes --keyserver keyserver.ubuntu.com --recv-keys 74DA7924C5513486 | ||
RUN add-apt-repository -y 'deb http://apt.dilos.org/dilos dilos2 main' | ||
|
||
ENV \ | ||
AR_x86_64_fuchsia=x86_64-fuchsia-ar \ | ||
CC_x86_64_fuchsia=x86_64-fuchsia-clang \ | ||
CXX_x86_64_fuchsia=x86_64-fuchsia-clang++ \ | ||
AR_aarch64_fuchsia=aarch64-fuchsia-ar \ | ||
CC_aarch64_fuchsia=aarch64-fuchsia-clang \ | ||
CXX_aarch64_fuchsia=aarch64-fuchsia-clang++ \ | ||
AR_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-ar \ | ||
CC_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-gcc \ | ||
CXX_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-g++ \ | ||
AR_x86_64_sun_solaris=x86_64-sun-solaris2.10-ar \ | ||
CC_x86_64_sun_solaris=x86_64-sun-solaris2.10-gcc \ | ||
CXX_x86_64_sun_solaris=x86_64-sun-solaris2.10-g++ \ | ||
CC_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-gcc-7 \ | ||
CXX_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-g++-7 \ | ||
AR_x86_64_fortanix_unknown_sgx=ar \ | ||
CC_x86_64_fortanix_unknown_sgx=x86_64-fortanix-unknown-sgx-clang-11 \ | ||
CFLAGS_x86_64_fortanix_unknown_sgx="-mlvi-hardening -mllvm -x86-experimental-lvi-inline-asm-hardening" \ | ||
CXX_x86_64_fortanix_unknown_sgx=x86_64-fortanix-unknown-sgx-clang++-11 \ | ||
CXXFLAGS_x86_64_fortanix_unknown_sgx="-mlvi-hardening -mllvm -x86-experimental-lvi-inline-asm-hardening" \ | ||
Comment on lines
+46
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This whole block is moved from below so the variables are available for the target-specific build scripts as well. These are the only changed (added) lines |
||
CC=gcc-7 \ | ||
CXX=g++-7 | ||
|
||
WORKDIR /build | ||
COPY scripts/musl.sh /build | ||
RUN env \ | ||
|
@@ -46,34 +69,18 @@ COPY dist-various-2/build-solaris-toolchain.sh /tmp/ | |
RUN /tmp/build-solaris-toolchain.sh x86_64 amd64 solaris-i386 | ||
RUN /tmp/build-solaris-toolchain.sh sparcv9 sparcv9 solaris-sparc | ||
COPY dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/ | ||
COPY dist-various-2/x86_64-fortanix-unknown-sgx-clang-wrap.sh /usr/bin/x86_64-fortanix-unknown-sgx-clang-11 | ||
RUN ln -s /usr/bin/x86_64-fortanix-unknown-sgx-clang-11 /usr/bin/x86_64-fortanix-unknown-sgx-clang++-11 | ||
# We pass the commit id of the port of LLVM's libunwind to the build script. | ||
# Any update to the commit id here, should cause the container image to be re-built from this point on. | ||
RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh "5125c169b30837208a842f85f7ae44a83533bd0e" | ||
RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh "800f95131fe6acd20b96b6f4723ca3c820f3d379" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
COPY dist-various-2/build-wasi-toolchain.sh /tmp/ | ||
RUN /tmp/build-wasi-toolchain.sh | ||
|
||
COPY scripts/sccache.sh /scripts/ | ||
RUN sh /scripts/sccache.sh | ||
|
||
ENV \ | ||
AR_x86_64_fuchsia=x86_64-fuchsia-ar \ | ||
CC_x86_64_fuchsia=x86_64-fuchsia-clang \ | ||
CXX_x86_64_fuchsia=x86_64-fuchsia-clang++ \ | ||
AR_aarch64_fuchsia=aarch64-fuchsia-ar \ | ||
CC_aarch64_fuchsia=aarch64-fuchsia-clang \ | ||
CXX_aarch64_fuchsia=aarch64-fuchsia-clang++ \ | ||
AR_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-ar \ | ||
CC_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-gcc \ | ||
CXX_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-g++ \ | ||
AR_x86_64_sun_solaris=x86_64-sun-solaris2.10-ar \ | ||
CC_x86_64_sun_solaris=x86_64-sun-solaris2.10-gcc \ | ||
CXX_x86_64_sun_solaris=x86_64-sun-solaris2.10-g++ \ | ||
CC_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-gcc-7 \ | ||
CXX_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-g++-7 \ | ||
CC=gcc-7 \ | ||
CXX=g++-7 | ||
|
||
ENV CARGO_TARGET_X86_64_FUCHSIA_AR /usr/local/bin/llvm-ar | ||
ENV CARGO_TARGET_X86_64_FUCHSIA_RUSTFLAGS \ | ||
-C link-arg=--sysroot=/usr/local/x86_64-fuchsia \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/ci/docker/dist-various-2/x86_64-fortanix-unknown-sgx-clang-wrap.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
args=("$@") | ||
|
||
for i in "${!args[@]}"; do | ||
# x86_64-fortanix-unknown-sgx doesn't have a C sysroot for things like | ||
# stdint.h and the C++ STL. Unlike GCC, clang will not use the host's | ||
# sysroot instead. Force it. | ||
if [ "${args[$i]}" = "--target=x86_64-fortanix-unknown-sgx" ]; then | ||
args[$i]="--target=x86_64-unknown-linux-gnu" | ||
fi | ||
done | ||
|
||
exec "${0/x86_64-fortanix-unknown-sgx-clang/clang}" "${args[@]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I don't think the default that this falls back to (without checking for existence) is good. But I don't want to change it because it might break things.