Commit 6ced254
authored
[24.0.4] backport
* fix(wasip1): prevent duplicate FD usage
The implementation assumed that only the runtime could ever issue FDs,
however that's not the case in p1, where guests can choose arbitrary
FDs to use (e.g. via `fd_renumber`).
Due to incorrect accounting, guests could "mark" arbitrary FDs as "free"
and trigger a panic in the host by requesting a new FD.
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* test(wasip1): expand `fd_renumber` test
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* refactor(wasip1): do not modify descriptors on `fd_renumber(n, n)`
Since `remove` is now only used once, remove it.
As a sideffect, this makes the implementation more explicit .
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* fix(wasip1-adapter): prevent `unreachable` panic on `fd_renumber`
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* doc: add release notes
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* doc: reference the CVE
prtest:full
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* doc: add PR reference
prtest:full
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* chore: run `cargo fmt --all`
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
---------
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>fd_renumber fixes (#11278)1 parent 6f07581 commit 6ced254
File tree
4 files changed
+99
-55
lines changed- crates
- test-programs/src/bin
- wasi-preview1-component-adapter/src
- wasi/src
4 files changed
+99
-55
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
1 | 13 | | |
2 | 14 | | |
3 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
75 | 115 | | |
76 | 116 | | |
77 | 117 | | |
| |||
Lines changed: 17 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
330 | | - | |
| 329 | + | |
| 330 | + | |
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
| 340 | + | |
346 | 341 | | |
347 | 342 | | |
348 | 343 | | |
| |||
362 | 357 | | |
363 | 358 | | |
364 | 359 | | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
370 | 374 | | |
371 | 375 | | |
372 | 376 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | | - | |
82 | 81 | | |
83 | 82 | | |
84 | 83 | | |
| |||
318 | 317 | | |
319 | 318 | | |
320 | 319 | | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
| 320 | + | |
336 | 321 | | |
337 | 322 | | |
338 | 323 | | |
| |||
409 | 394 | | |
410 | 395 | | |
411 | 396 | | |
412 | | - | |
| 397 | + | |
413 | 398 | | |
414 | 399 | | |
415 | 400 | | |
416 | 401 | | |
417 | | - | |
| 402 | + | |
418 | 403 | | |
419 | 404 | | |
420 | 405 | | |
421 | 406 | | |
422 | 407 | | |
423 | | - | |
| 408 | + | |
424 | 409 | | |
425 | 410 | | |
426 | 411 | | |
427 | 412 | | |
428 | 413 | | |
429 | 414 | | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | 415 | | |
439 | 416 | | |
440 | 417 | | |
441 | 418 | | |
442 | | - | |
| 419 | + | |
443 | 420 | | |
444 | 421 | | |
445 | 422 | | |
446 | 423 | | |
447 | | - | |
| 424 | + | |
448 | 425 | | |
449 | 426 | | |
450 | 427 | | |
| |||
485 | 462 | | |
486 | 463 | | |
487 | 464 | | |
488 | | - | |
| 465 | + | |
489 | 466 | | |
490 | 467 | | |
491 | 468 | | |
492 | 469 | | |
493 | 470 | | |
494 | 471 | | |
495 | 472 | | |
496 | | - | |
| 473 | + | |
497 | 474 | | |
498 | 475 | | |
499 | 476 | | |
| |||
503 | 480 | | |
504 | 481 | | |
505 | 482 | | |
506 | | - | |
| 483 | + | |
507 | 484 | | |
508 | 485 | | |
509 | 486 | | |
| |||
517 | 494 | | |
518 | 495 | | |
519 | 496 | | |
520 | | - | |
| 497 | + | |
521 | 498 | | |
522 | 499 | | |
523 | 500 | | |
| |||
550 | 527 | | |
551 | 528 | | |
552 | 529 | | |
553 | | - | |
| 530 | + | |
554 | 531 | | |
555 | 532 | | |
556 | 533 | | |
| |||
1360 | 1337 | | |
1361 | 1338 | | |
1362 | 1339 | | |
1363 | | - | |
1364 | | - | |
1365 | | - | |
1366 | | - | |
1367 | | - | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
1368 | 1347 | | |
1369 | 1348 | | |
1370 | 1349 | | |
| |||
1900 | 1879 | | |
1901 | 1880 | | |
1902 | 1881 | | |
1903 | | - | |
1904 | | - | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
1905 | 1893 | | |
1906 | 1894 | | |
1907 | 1895 | | |
| |||
0 commit comments