Skip to content

Commit 71cdaa2

Browse files
authored
Feature/debug build (#169)
* kernelCTF: GHA: add debug build for exploits * kernelCTF: GHA: add workflow to trigger PR verification on all PRs
1 parent af4dba5 commit 71cdaa2

File tree

2 files changed

+75
-2
lines changed

2 files changed

+75
-2
lines changed

.github/workflows/kernelctf-submission-verification.yaml

+50-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ on:
1010
type: number
1111
shaHash:
1212
description: 'SHA hash'
13+
skipRepro:
14+
description: 'Skip reproduction'
15+
type: boolean
16+
required: false
17+
default: false
1318
permissions: {}
1419
env:
1520
PR_REF: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.shaHash || format('refs/pull/{0}/merge', github.event.inputs.prNumber)) || github.event.pull_request.head.sha }}
@@ -104,6 +109,49 @@ jobs:
104109
if: failure() && steps.build_exploit.outcome == 'failure'
105110
run: printf '❌ The exploit compilation failed.\n\nPlease fix it.\n\nYou can see the build logs by clicking on `...` here and then on "View job logs". Or by selecting `exploit_build (${{ env.RELEASE_ID }})` under Jobs in the left menubar.\n' >> $GITHUB_STEP_SUMMARY
106111

112+
exploit_build_debug:
113+
runs-on: ubuntu-latest
114+
needs: structure_check
115+
permissions: {}
116+
strategy:
117+
matrix:
118+
target: ${{ fromJSON(needs.structure_check.outputs.targets) }}
119+
fail-fast: false # do not cancel other targets
120+
env:
121+
RELEASE_ID: ${{ matrix.target }}
122+
EXPLOIT_DIR: pr/pocs/linux/kernelctf/${{ needs.structure_check.outputs.submission_dir }}/exploit/${{ matrix.target }}
123+
steps:
124+
- name: Checkout PR content
125+
uses: actions/checkout@v4
126+
with:
127+
path: pr
128+
ref: ${{ env.PR_REF }}
129+
fetch-depth: 0
130+
131+
- name: Convert exploit to debug build
132+
working-directory: ${{ env.EXPLOIT_DIR }}
133+
run: |
134+
sed -i '/gcc -g/!s/gcc/gcc -g/g' Makefile
135+
sed -i '/configure --enable-debug/!s/configure/configure --enable-debug/g' Makefile
136+
sed -i 's/-o exploit /-o exploit_debug /g' Makefile
137+
sed -i 's/ -s\b//g' Makefile
138+
sed -i 's/exploit:/exploit_debug:/g' Makefile
139+
140+
- name: Build exploit
141+
working-directory: ${{ env.EXPLOIT_DIR }}
142+
run: |
143+
if make -n prerequisites; then
144+
make prerequisites
145+
fi
146+
make exploit_debug
147+
148+
- name: Upload debug build
149+
uses: actions/upload-artifact@v4
150+
with:
151+
name: exploit_debug_${{ env.RELEASE_ID }}
152+
path: ${{ env.EXPLOIT_DIR }}/exploit_debug
153+
if-no-files-found: error
154+
107155
exploit_repro:
108156
runs-on: ubuntu-latest
109157
timeout-minutes: 300
@@ -113,7 +161,7 @@ jobs:
113161
matrix:
114162
target: ${{ fromJSON(needs.structure_check.outputs.targets) }}
115163
fail-fast: false
116-
if: always() && needs.structure_check.result == 'success'
164+
if: always() && needs.structure_check.result == 'success' && !inputs.skipRepro
117165
env:
118166
RELEASE_ID: ${{ matrix.target }}
119167
SUBMISSION_DIR: ${{ needs.structure_check.outputs.submission_dir }}
@@ -228,7 +276,7 @@ jobs:
228276

229277
backup_artifacts:
230278
runs-on: ubuntu-latest
231-
needs: [structure_check, exploit_build, exploit_repro]
279+
needs: [structure_check, exploit_build, exploit_build_debug, exploit_repro]
232280
if: always() && needs.structure_check.result == 'success'
233281
steps:
234282
- name: Download artifacts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Verify all PRs again
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
prs:
6+
description: 'PRs to verify'
7+
type: string
8+
required: true
9+
skipRepro:
10+
description: 'Skip reproduction'
11+
type: boolean
12+
required: false
13+
default: false
14+
permissions: {}
15+
jobs:
16+
tests:
17+
strategy:
18+
matrix:
19+
pr: ${{ fromJSON(inputs.prs) }}
20+
fail-fast: false # do not cancel test of other targets
21+
uses: ./.github/workflows/kernelctf-submission-verification.yaml
22+
secrets: inherit
23+
with:
24+
prNumber: ${{ matrix.pr }}
25+
skipRepro: ${{ inputs.skipRepro }}

0 commit comments

Comments
 (0)