3
3
pull_request_target :
4
4
types : [opened, synchronize, reopened, labeled]
5
5
paths : [pocs/linux/kernelctf/**]
6
+ workflow_call :
7
+ inputs :
8
+ prNumber :
9
+ description : ' PR number'
10
+ type : number
11
+ shaHash :
12
+ description : ' SHA hash'
13
+ type : string
14
+ skipRepro :
15
+ description : ' Skip reproduction'
16
+ type : boolean
17
+ required : false
18
+ default : false
6
19
workflow_dispatch :
7
20
inputs :
8
21
prNumber :
9
22
description : ' PR number'
10
23
type : number
11
24
shaHash :
12
25
description : ' SHA hash'
26
+ skipRepro :
27
+ description : ' Skip reproduction'
28
+ type : boolean
29
+ required : false
30
+ default : false
13
31
permissions : {}
14
32
env :
15
- 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 }}
33
+ PR_REF : ${{ contains( github.event_name, 'workflow_') && (inputs.shaHash || format('refs/pull/{0}/merge', inputs.prNumber)) || github.event.pull_request.head.sha }}
16
34
jobs :
17
35
structure_check :
18
36
# if labeling triggered the job then only run in case of the "recheck" label
@@ -84,15 +102,15 @@ jobs:
84
102
if : success()
85
103
uses : actions/upload-artifact@v4
86
104
with :
87
- name : exploit_ ${{ env.RELEASE_ID }}
105
+ name : ${{ needs.structure_check.outputs.artifact_backup_dir }}_exploit_ ${{ env.RELEASE_ID }}
88
106
path : ${{ env.EXPLOIT_DIR }}/exploit
89
107
if-no-files-found : error
90
108
91
109
- name : Upload exploit (original, build failed)
92
110
if : failure() && steps.build_exploit.outcome == 'failure'
93
111
uses : actions/upload-artifact@v4
94
112
with :
95
- name : exploit_ ${{ env.RELEASE_ID }}
113
+ name : ${{ needs.structure_check.outputs.artifact_backup_dir }}_exploit_ ${{ env.RELEASE_ID }}
96
114
path : ./exploit
97
115
if-no-files-found : error
98
116
@@ -104,16 +122,60 @@ jobs:
104
122
if : failure() && steps.build_exploit.outcome == 'failure'
105
123
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
106
124
125
+ exploit_build_debug :
126
+ runs-on : ubuntu-latest
127
+ needs : structure_check
128
+ permissions : {}
129
+ strategy :
130
+ matrix :
131
+ target : ${{ fromJSON(needs.structure_check.outputs.targets) }}
132
+ fail-fast : false # do not cancel other targets
133
+ env :
134
+ RELEASE_ID : ${{ matrix.target }}
135
+ EXPLOIT_DIR : pr/pocs/linux/kernelctf/${{ needs.structure_check.outputs.submission_dir }}/exploit/${{ matrix.target }}
136
+ steps :
137
+ - name : Checkout PR content
138
+ uses : actions/checkout@v4
139
+ with :
140
+ path : pr
141
+ ref : ${{ env.PR_REF }}
142
+ fetch-depth : 0
143
+
144
+ - name : Convert exploit to debug build
145
+ working-directory : ${{ env.EXPLOIT_DIR }}
146
+ run : |
147
+ sed -i '/gcc -g/!s/gcc/gcc -g/g' Makefile
148
+ sed -i '/configure --enable-debug/!s/configure/configure --enable-debug/g' Makefile
149
+ sed -i 's/-o exploit /-o exploit_debug /g' Makefile
150
+ sed -i 's/ -s\b//g' Makefile
151
+ sed -i 's/exploit:/exploit_debug:/g' Makefile
152
+
153
+ - name : Build exploit
154
+ working-directory : ${{ env.EXPLOIT_DIR }}
155
+ run : |
156
+ if make -n prerequisites; then
157
+ make prerequisites
158
+ fi
159
+ make exploit_debug
160
+ file exploit_debug | grep debug_info
161
+
162
+ - name : Upload debug build
163
+ uses : actions/upload-artifact@v4
164
+ with :
165
+ name : ${{ needs.structure_check.outputs.artifact_backup_dir }}_exploit_debug_${{ env.RELEASE_ID }}
166
+ path : ${{ env.EXPLOIT_DIR }}/exploit_debug
167
+ if-no-files-found : error
168
+
107
169
exploit_repro :
108
- runs-on : ubuntu-22.04-4core
170
+ runs-on : ubuntu-latest
109
171
timeout-minutes : 300
110
172
permissions : {}
111
173
needs : [structure_check, exploit_build]
112
174
strategy :
113
175
matrix :
114
176
target : ${{ fromJSON(needs.structure_check.outputs.targets) }}
115
177
fail-fast : false
116
- if : always() && needs.structure_check.result == 'success'
178
+ if : always() && needs.structure_check.result == 'success' && !inputs.skipRepro
117
179
env :
118
180
RELEASE_ID : ${{ matrix.target }}
119
181
SUBMISSION_DIR : ${{ needs.structure_check.outputs.submission_dir }}
@@ -210,7 +272,7 @@ jobs:
210
272
- name : Upload repro QEMU logs as an artifact
211
273
uses : actions/upload-artifact@v4
212
274
with :
213
- name : repro_logs_ ${{ env.RELEASE_ID }}
275
+ name : ${{ needs.structure_check.outputs.artifact_backup_dir }}_repro_logs_ ${{ env.RELEASE_ID }}
214
276
path : ./kernelctf/repro/repro_log_*.txt
215
277
216
278
- name : Reproduction // Summary
@@ -223,13 +285,13 @@ jobs:
223
285
- name : Upload repro summary as an artifact
224
286
uses : actions/upload-artifact@v4
225
287
with :
226
- name : repro_summary_ ${{ env.RELEASE_ID }}
288
+ name : ${{ needs.structure_check.outputs.artifact_backup_dir }}_repro_summary_ ${{ env.RELEASE_ID }}
227
289
path : ./kernelctf/repro/repro_summary.md
228
290
229
291
backup_artifacts :
230
292
runs-on : ubuntu-latest
231
- needs : [structure_check, exploit_build, exploit_repro]
232
- if : always() && needs.structure_check.result == 'success'
293
+ needs : [structure_check, exploit_build, exploit_build_debug, exploit_repro]
294
+ if : always() && needs.structure_check.result == 'success' && github.event_name != 'workflow_call'
233
295
steps :
234
296
- name : Download artifacts
235
297
uses : actions/download-artifact@v4
0 commit comments