Repository navigation
Commit 32c0c2b
fuse: fail FUSE_INIT when init wants flags the client did not offer
Session::dispatch_init asserted that the flags which Fuse::init wants
are among those that the client offered (microsoft/nvx#1630). A file
system whose init wants a flag that the guest did not offer thus
panicked, which aborts the VMM process, since its profiles abort on
panic, instead of failing FUSE_INIT. And dispatch_init read the
client's capabilities back from the SessionInfo that init may replace,
as with the public SessionInfo::from(SessionInfoState): an init that
claimed every capability passed the check, sent the guest flags that
it never offered, and left in save_state a version and capabilities
that the client never sent.
dispatch_init now keeps the version and the client's capabilities that
it sets before init, and restores them after it, whatever init did to
the SessionInfo. When init wants a flag that the client did not offer,
or an extended flag that it did not offer while init keeps
FUSE_INIT_EXT, without which dispatch_init discards the extended
flags, dispatch_init logs a rate-limited error, resets the
SessionInfo, so that the session stays uninitialized and saves no
negotiation, and replies with EIO, as for its other FUSE_INIT
failures. Fuse::init documents both. VirtioFs::init wants only flags
that the client offers, so its negotiation does not change.
Tests, in fuse's session tests of init:
- init_rejects_flags_the_client_did_not_offer, with a file system that
wants a flag or an extended flag that the client did not offer,
panics at feature/microvm/dev 51e9af7 on the assertion of each.
- init_keeps_the_client_version_and_capabilities, with one whose init
claims version 8.0 and every capability, there replies without an
error to a want beyond the offer, and saves that version and those
capabilities.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 51e9af7 commit 32c0c2b
3 files changed
Lines changed: 137 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
260 | 266 | | |
261 | 267 | | |
262 | 268 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
485 | 485 | | |
486 | 486 | | |
487 | 487 | | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
488 | 495 | | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
489 | 502 | | |
490 | | - | |
491 | 503 | | |
492 | 504 | | |
493 | 505 | | |
494 | 506 | | |
495 | 507 | | |
496 | | - | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
497 | 520 | | |
498 | 521 | | |
499 | 522 | | |
| |||
670 | 693 | | |
671 | 694 | | |
672 | 695 | | |
| 696 | + | |
673 | 697 | | |
674 | 698 | | |
675 | 699 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 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 | + | |
0 commit comments