Skip to content

Commit fc114b0

Browse files
authored
[CI] Add new workflow for hardening check (#17938)
We need to perform the hardening check of our binaries (executables and dynamic libs). This patch adds a workflow to perform these checks on linux and windows.
1 parent 3e71779 commit fc114b0

File tree

2 files changed

+108
-0
lines changed

2 files changed

+108
-0
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: SYCL hardening check
2+
3+
permissions: read-all
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
sycl_linux_artifact:
9+
type: string
10+
sycl_linux_archive:
11+
type: string
12+
sycl_linux_decompress_command:
13+
type: string
14+
15+
sycl_windows_artifact:
16+
type: string
17+
sycl_windows_archive:
18+
type: string
19+
20+
jobs:
21+
hardening_check:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Install hardening-check
26+
run: |
27+
sudo apt update
28+
sudo apt install -y devscripts
29+
30+
- name: Download SYCL toolchain
31+
uses: actions/download-artifact@v4
32+
with:
33+
name: ${{ inputs.sycl_linux_artifact }}
34+
35+
- name: Extract SYCL toolchain
36+
run: |
37+
mkdir toolchain
38+
tar -I '${{ inputs.sycl_linux_decompress_command }}' -xf ${{ inputs.sycl_linux_archive }} -C toolchain
39+
40+
- name: Perform checks
41+
run: |
42+
for file in ./toolchain/bin/*; do
43+
hardening-check "$file" | tee -a "./hardening-check.txt"
44+
done
45+
46+
for file in $(find ./toolchain/lib/ -type f -name "*.so*"); do
47+
hardening-check "$file" | tee -a "./hardening-check.txt"
48+
done
49+
50+
- uses: actions/upload-artifact@v4
51+
with:
52+
name: hardening-check
53+
path: hardening-check.txt
54+
55+
winchecksec:
56+
runs-on: windows-latest
57+
58+
steps:
59+
- name: Install winchecksec
60+
run: |
61+
curl -LO https://github.com/trailofbits/winchecksec/releases/download/v3.1.0/windows.x64.Release.zip
62+
mkdir winchecksec
63+
unzip "windows.x64.Release.zip" -d winchecksec
64+
65+
- name: Download SYCL toolchain
66+
uses: actions/download-artifact@v4
67+
with:
68+
name: ${{ inputs.sycl_windows_artifact }}
69+
70+
- name: Extract SYCL toolchain
71+
shell: bash
72+
run: |
73+
mkdir toolchain
74+
tar -xf ${{ inputs.sycl_windows_archive }} -C toolchain
75+
76+
- name: Download and check Windows artifacts
77+
shell: bash
78+
run: |
79+
for file in $(find ./toolchain/bin/ -type f -name "*.exe"); do
80+
./winchecksec/build/Release/winchecksec.exe "$file" | tee -a "./winchecksec.txt"
81+
done
82+
83+
for file in $(find ./toolchain/bin/ -type f -name "*.dll"); do
84+
./winchecksec/build/Release/winchecksec.exe "$file" | tee -a "./winchecksec.txt"
85+
done
86+
87+
- uses: actions/upload-artifact@v4
88+
with:
89+
name: winchecksec
90+
path: winchecksec.txt

.github/workflows/sycl-rel-nightly.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
build_configure_extra_args: '--disable-jit --no-assertions --add_security_flags=sanitize --hip --cuda'
4848
build_image: ghcr.io/intel/llvm/ubuntu2204_build:latest
4949
build_ref: ${{ inputs.testing_branch || 'sycl-rel-6_1_0' }}
50+
pack_release: 'true'
5051

5152
# We upload the build for people to download/use, override its name and
5253
# prefer widespread gzip compression.
@@ -106,6 +107,7 @@ jobs:
106107
with:
107108
ref: ${{ inputs.testing_branch || 'sycl-rel-6_1_0' }}
108109
build_configure_extra_args: '--disable-jit --no-assertions --add_security_flags=sanitize'
110+
pack_release: 'true'
109111

110112
# We upload both Linux/Windows build via Github's "Releases"
111113
# functionality, make sure Linux/Windows names follow the same pattern.
@@ -220,3 +222,19 @@ jobs:
220222
sycl_toolchain_archive: ${{ needs.ubuntu2204_build.outputs.artifact_archive_name }}
221223
sycl_toolchain_decompress_command: ${{ needs.ubuntu2204_build.outputs.artifact_decompress_command }}
222224
sycl_cts_artifact: sycl_cts_bin_linux
225+
226+
hardening-check:
227+
needs: [ubuntu2204_build, build-win]
228+
if: |
229+
always()
230+
&& !cancelled()
231+
&& needs.ubuntu2204_build.outputs.build_conclusion == 'success'
232+
&& needs.build-win.outputs.build_conclusion == 'success'
233+
uses: ./.github/workflows/hardening-check.yml
234+
with:
235+
sycl_linux_artifact: sycl_linux_release
236+
sycl_linux_archive: ${{ needs.ubuntu2204_build.outputs.artifact_archive_name }}
237+
sycl_linux_decompress_command: ${{ needs.ubuntu2204_build.outputs.artifact_decompress_command }}
238+
239+
sycl_windows_artifact: sycl_windows_release
240+
sycl_windows_archive: ${{ needs.build-win.outputs.artifact_archive_name }}

0 commit comments

Comments
 (0)