forked from erlang/otp
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request erlang#9441 from garazdawi/lukas/otp/ossf-compiler…
…-flags/OTP-19519 Enable OSSF compiler hardening flags by default
- Loading branch information
Showing
28 changed files
with
12,809 additions
and
5,292 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# %CopyrightBegin% | ||
# | ||
# SPDX-FileCopyrightText: Copyright Ericsson AB 2023-2025. All Rights Reserved. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# %CopyrightEnd% | ||
|
||
name: Open Source Security Foundation | ||
|
||
inputs: | ||
upload: | ||
description: 'Upload sarif results using codeql' | ||
default: false | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/[email protected] | ||
with: | ||
repository: ossf/wg-best-practices-os-developers | ||
sparse-checkout: docs/Compiler-Hardening-Guides/compiler-options-scraper | ||
path: ossf | ||
|
||
- name: Setup compiler options scraper | ||
shell: bash -eo pipefail {0} | ||
run: | | ||
pip3 install -r ossf/docs/Compiler-Hardening-Guides/compiler-options-scraper/requirements.txt | ||
python3 ossf/docs/Compiler-Hardening-Guides/compiler-options-scraper/main.py | ||
cat compiler-options.json | ||
- name: Run compiler flag comparison | ||
shell: bash -eo pipefail {0} | ||
run: | | ||
docker run -v `pwd`/.github/scripts:/github --entrypoint "" otp \ | ||
bash -c "/github/ossf-sarif-generator.es '$(cat compiler-options.json)'" > results.sarif | ||
- name: "Upload artifact" | ||
if: ${{ !cancelled() }} | ||
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # ratchet:actions/[email protected] | ||
with: | ||
name: SARIF file | ||
path: results.sarif | ||
|
||
# Upload the results to GitHub's code scanning dashboard. | ||
- name: "Upload to code-scanning" | ||
if: ${{ !cancelled() && inputs.upload == 'true' }} | ||
uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # ratchet:github/codeql-action/[email protected] | ||
with: | ||
sarif_file: results.sarif |
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 |
---|---|---|
|
@@ -59,7 +59,6 @@ jobs: | |
name: Build Erlang/OTP (64-bit) | ||
runs-on: ubuntu-latest | ||
outputs: | ||
BASE_BUILD: ${{ steps.base-build.outputs.BASE_BUILD }} | ||
changes: ${{ steps.changes.outputs.changes }} | ||
c-code-changes: ${{ steps.c-code-changes.outputs.changes }} | ||
all: ${{ steps.apps.outputs.all }} | ||
|
@@ -385,28 +384,53 @@ jobs: | |
needs: pack | ||
if: needs.pack.outputs.c-code-changes | ||
|
||
strategy: | ||
matrix: | ||
flavor: [jit, emu] | ||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/[email protected] | ||
- uses: ./.github/actions/build-base-image | ||
with: | ||
BASE_BRANCH: ${{ env.BASE_BRANCH }} | ||
- name: Build Erlang/OTP flavors and types | ||
run: | | ||
TYPES="opt debug lcnt" | ||
FLAVORS="emu jit" | ||
TYPES="opt debug lcnt asan gcov valgrind" | ||
FLAVORS="${{ matrix.flavor }}" | ||
for TYPE in ${TYPES}; do | ||
for FLAVOR in ${FLAVORS}; do | ||
echo "::group::{TYPE=$TYPE FLAVOR=$FLAVOR}" | ||
docker run otp "make TYPE=$TYPE FLAVOR=$FLAVOR" | ||
docker run otp \ | ||
"if [ ${TYPE} = \"valgrind\" ]; then sudo apt-get install -y valgrind bc; fi && \ | ||
make TYPE=$TYPE FLAVOR=$FLAVOR && \ | ||
cerl -$TYPE -emu_flavor $FLAVOR -noshell -s init stop" | ||
echo "::endgroup::" | ||
done | ||
done | ||
- name: Build Erlang/OTP JIT Win32 ABI | ||
if: ${{ matrix.flavor == 'jit' }} | ||
run: > | ||
docker run otp './configure CFLAGS="$CFLAGS -DERTS_JIT_ABI_WIN32=1" && | ||
make && make TYPE=debug && | ||
cerl -noshell -s init stop && cerl -debug -noshell -s init stop' | ||
- name: Build Erlang/OTP with LTTNG | ||
if: ${{ matrix.flavor == 'jit' }} | ||
run: > | ||
docker run otp 'sudo apt-get install -y lttng-tools && | ||
./configure --enable-dynamic-trace=lttng && | ||
make && make TYPE=debug && | ||
cerl -noshell -s init stop && cerl -debug -noshell -s init stop' | ||
- name: Start Erlang with various start options | ||
if: ${{ matrix.flavor == 'jit' }} | ||
run: | | ||
OPTIONS=("+JPperf true" "+JMsingle true" "+JDdump true") | ||
for OPTION in "${OPTIONS[@]}"; do | ||
docker run otp "erl ${OPTION} -noshell -s init stop" | ||
done | ||
build: | ||
name: Build Erlang/OTP | ||
runs-on: ubuntu-latest | ||
|
@@ -524,6 +548,8 @@ jobs: | |
## Run dialyzer | ||
- name: Run dialyzer | ||
run: docker run -v $PWD/:/github otp '/github/scripts/run-dialyzer' | ||
- name: Check OSSF compiler flags | ||
uses: ./.github/actions/ossf-compiler-flags-scanner | ||
|
||
test: | ||
name: Test Erlang/OTP | ||
|
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 |
---|---|---|
|
@@ -45,39 +45,10 @@ jobs: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/[email protected] | ||
- name: Create initial pre-release tar | ||
run: .github/scripts/init-pre-release.sh otp_src.tar.gz | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/[email protected] | ||
with: | ||
repository: ossf/wg-best-practices-os-developers | ||
sparse-checkout: docs/Compiler-Hardening-Guides/compiler-options-scraper | ||
path: ossf | ||
|
||
- name: Setup compiler options scraper | ||
run: | | ||
pip3 install -r ossf/docs/Compiler-Hardening-Guides/compiler-options-scraper/requirements.txt | ||
python3 ossf/docs/Compiler-Hardening-Guides/compiler-options-scraper/main.py | ||
cat compiler-options.json | ||
- uses: ./.github/actions/build-base-image | ||
with: | ||
BASE_BRANCH: master | ||
BUILD_IMAGE: true | ||
|
||
- name: Run compiler flag comparison | ||
run: | | ||
docker run -v `pwd`/.github/scripts:/github --entrypoint "" otp \ | ||
bash -c "/github/ossf-sarif-generator.es '$(cat compiler-options.json)'" > results.sarif | ||
- name: "Upload artifact" | ||
if: ${{ !cancelled() }} | ||
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.4.3 ratchet:actions/upload-artifact@v4 | ||
with: | ||
name: SARIF file | ||
path: results.sarif | ||
|
||
# Upload the results to GitHub's code scanning dashboard. | ||
- name: "Upload to code-scanning" | ||
if: ${{ !cancelled() }} | ||
uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # ratchet:github/codeql-action/upload-sarif@v3 | ||
- uses: ./.github/actions/ossf-compiler-flags-scanner | ||
with: | ||
sarif_file: results.sarif | ||
|
||
upload: true |
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
Oops, something went wrong.