Port the Modal patches onto upstream v0.16.0 - #10
Draft
dflemstr wants to merge 1 commit into
Draft
Conversation
Rebases the Modal-specific work that lived on fs/pin-bcff57c onto upstream v0.16.0, which is the first upstream release carrying the fix for GHSA-cvmj-47v9-35m9. Because the crate version becomes 0.16.0, this also clears the Dependabot alert that the backport on fs/pin-bcff57c cannot, since that alert matches the crate version against `< 0.16.0`. Carried forward: - FilesystemSession, holding the filesystem impl plus protocol state, extracted from Session so dispatch is transport-agnostic - Request::new and Request::dispatch made public, taking the reply sender as a parameter rather than reaching into a Session's channel - ReplySender implemented for Arc<dyn ReplySender> - FUSE request buffers lowered to the negotiated max_write, with the resize applied before the aligned sub-buffer is recomputed Dropped as redundant, having been fixed upstream: - Making SessionACL public. Upstream also derives Default with Owner as the default, so upstream's definition is kept. - The pre-abi-7-16 access control fallback and the pre-abi-7-9 getattr fallback, both of which upstream deleted. Adapted to upstream changes: - Session::from_fd, new in 0.16, constructs FilesystemSession. - Session stores the mountpoint alongside the mount and unmounts inside its Drop body. Since that unmount would otherwise precede the drop of FilesystemSession, Session::drop now runs the filesystem's destroy hook itself so teardown still happens while the mount is in place. - PollHandle, new in 0.16, was wired to the concrete ChannelSender, which a transport-agnostic dispatch cannot supply. Notifier now holds an Arc<dyn ReplySender>, which is what the Arc<dyn ReplySender> impl above is for. This also means notifications work on any transport. - The init hook's error is propagated with Errno::from_i32 as upstream does. The branch being replaced returned EIO unconditionally, dropping the errno the filesystem reported. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The real
fuserupgrade, to be tested independently of the minimal backport in #9.This rebases the Modal-specific work from
fs/pin-bcff57conto upstreamv0.16.0, the first upstream release carrying the fix for GHSA-cvmj-47v9-35m9. The base branch here is upstreamv0.16.0unchanged, so the diff is exactly the port and nothing else.Unlike the backport, this also clears Dependabot alert modal-labs/modal#149 on its own: that alert matches the crate version against
< 0.16.0, and the version here becomes0.16.0.v0.16.0is the target rather thanv0.17.0orv0.18.0because it is the smallest step that carries the fix — 68 upstream commits from our current base, against 305 and 333 respectively. Given that the previous upgrade attempt was reverted on suspicion of volume reload breakage, the smallest viable delta seemed right.Carried forward
FilesystemSession, holding the filesystem impl plus protocol state, extracted fromSessionso dispatch is transport-agnosticRequest::newandRequest::dispatchmade public, taking the reply sender as a parameter rather than reaching into aSession's channelReplySenderimplemented forArc<dyn ReplySender>max_write, with the resize applied before the aligned sub-buffer is recomputedDropped as redundant
Both were fixed upstream:
SessionACLpublic. Upstream also derivesDefaultwithOwneras the default, so upstream's definition is kept.abi-7-16access control fallback and the pre-abi-7-9getattrfallback, which upstream deleted outright.Adapted to upstream changes
Four places needed judgement rather than mechanical replay:
Session::from_fdis new in 0.16 and constructedSessionwith the flat fields; it now builds aFilesystemSession.Session::drop's body. Since field drops run after the body, that unmount would have precededFilesystemSession's drop and therefore the filesystem'sdestroyhook — inverting the previous order.Session::dropnow runsdestroyitself, so teardown still happens while the mount is in place. This is the change most worth a second pair of eyes, since reordering teardown is the kind of thing that could plausibly explain the earlier volume reload symptoms.PollHandle, new in 0.16, was wired to the concreteChannelSender, which a transport-agnostic dispatch has no way to supply.Notifiernow holds anArc<dyn ReplySender>— which is what theArc<dyn ReplySender>impl above exists for. It only ever neededsend, so this is a narrowing rather than a rewrite, and it means notifications now work on any transport.inithook's error is propagated withErrno::from_i32, as upstream does. Thefs/pin-bcff57ccode being replaced returnedEIOunconditionally, discarding the errno the filesystem reported; that looks like an oversight from adapting to the tuple error type rather than something intentional.Test plan
cargo buildagainst libfuse3 3.17.4cargo test— 53 tests passmodal-labs/modalbuild against this branchFilesystemSessionandNotifierboth changed shapeMade with Cursor