Commit 2d2be27
drm/xe: fix UAF around queue destruction
We currently do stuff like queuing the final destruction step on a
random system wq, which will outlive the driver instance. With bad
timing we can teardown the driver with one or more work workqueue still
being alive leading to various UAF splats. Add a fini step to ensure
user queues are properly torn down. At this point GuC should already be
nuked so queue itself should no longer be referenced from hw pov.
v2 (Matt B)
- Looks much safer to use a waitqueue and then just wait for the
xa_array to become empty before triggering the drain.
Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2317
Fixes: dd08ebf ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Signed-off-by: Matthew Auld <[email protected]>
Cc: Matthew Brost <[email protected]>
Cc: <[email protected]> # v6.8+
Reviewed-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 8611086)
Signed-off-by: Lucas De Marchi <[email protected]>1 parent 790533e commit 2d2be27
File tree
4 files changed
+35
-2
lines changed- drivers/gpu/drm/xe
4 files changed
+35
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
301 | 304 | | |
302 | 305 | | |
303 | 306 | | |
| |||
363 | 366 | | |
364 | 367 | | |
365 | 368 | | |
| 369 | + | |
366 | 370 | | |
367 | | - | |
| 371 | + | |
368 | 372 | | |
369 | 373 | | |
370 | 374 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
399 | 402 | | |
400 | 403 | | |
401 | 404 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
279 | 294 | | |
280 | 295 | | |
281 | 296 | | |
282 | 297 | | |
| 298 | + | |
283 | 299 | | |
284 | 300 | | |
285 | 301 | | |
| |||
351 | 367 | | |
352 | 368 | | |
353 | 369 | | |
| 370 | + | |
| 371 | + | |
354 | 372 | | |
355 | 373 | | |
356 | 374 | | |
| |||
367 | 385 | | |
368 | 386 | | |
369 | 387 | | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
370 | 391 | | |
371 | 392 | | |
372 | 393 | | |
| |||
1274 | 1295 | | |
1275 | 1296 | | |
1276 | 1297 | | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
1277 | 1301 | | |
1278 | 1302 | | |
1279 | 1303 | | |
1280 | 1304 | | |
1281 | 1305 | | |
1282 | 1306 | | |
1283 | | - | |
| 1307 | + | |
1284 | 1308 | | |
1285 | 1309 | | |
1286 | 1310 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
| |||
0 commit comments