macOS/FUSE-T: Terminate auxiliary FUSE service on dismount - #1866
Open
mimoex wants to merge 1 commit into
Open
Conversation
Add an authenticated shutdown endpoint to the auxiliary FUSE filesystem and wait for the matching service process to terminate before removing the mount point.
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.
This PR fixes the FUSE-T service remaining alive after a VeraCrypt volume is dismounted on macOS.
It addresses the FUSE-T process/session leak reported in #1845.
Problem
With FUSE-T, the auxiliary mount can disappear while the corresponding VeraCrypt FUSE service is still running in
fuse_main().As a result, VeraCrypt may report that a volume has been dismounted even though the FUSE-T session is still alive and access to the decrypted volume has not been fully revoked.
This has two serious consequences.
1. The dismounted volume can become accessible again without a password
With the official VeraCrypt 1.26.29 FUSE-T build, the following sequence is reproducible:
.pngfile from the mounted volume in Preview.app, then close Preview.app.Open Recentmenu.The volume disappears from the VeraCrypt volume list and appears to have been dismounted. However, selecting the same file from Preview's
Open Recentmenu causes the stale FUSE-T session to reconnect, allowing the file to be opened without entering the VeraCrypt password.If the remaining VeraCrypt/FUSE-T processes are terminated after dismount, this reconnection does not occur, and the file can no longer be opened from
Open Recentwithout remounting the VeraCrypt volume normally.This means that dismount does not reliably revoke access as long as the auxiliary FUSE service remains alive.
2. The leaked service can keep the raw device open across sleep/wake
For device-hosted volumes, the remaining VeraCrypt/FUSE-T processes may continue holding
/dev/rdiskNor/dev/rdiskNsNafter dismount.This prevents normal device eject.
On affected systems, putting the Mac to sleep while the raw device remains held can also lead to a kernel panic after wake:
In testing reported in #1845, the panic stopped reproducing when the leaked VeraCrypt/FUSE-T processes were terminated before sleep.
Therefore, successful
umountalone is not sufficient to complete the VeraCrypt dismount operation.Solution
This patch explicitly terminates the corresponding auxiliary FUSE service during dismount.
The shutdown sequence is:
SerialInstanceNumber, and slot number.fuse_exit()andfuse_unmount().The shutdown handler runs asynchronously after a short delay so that the FUSE write response can complete before the channel is closed.
Testing
Tested on a MacBook Air M4 running macOS 26.6.2 with FUSE-T 1.2.7.
I compared the official VeraCrypt 1.26.29 FUSE-T build with this patch using the same container and the same FUSE-T SMB backend.
VeraCrypt 1.26.29
After mounting the container, the mount-specific processes included:
The auxiliary filesystem was mounted through FUSE-T/SMB, and
hdiutil infoshowed the VeraCryptvolume.dmg.After dismounting from the VeraCrypt GUI, the auxiliary SMB mount disappeared and the
volume.dmgwas detached.However, the mount-specific VeraCrypt processes and
go-nfsv4remained alive.Thus, the macOS-visible mount was gone while the corresponding FUSE-T service was still running.
Patched build
I repeated the same test with the existing
backend=smbbehavior unchanged.After dismounting from the GUI:
volume.dmgwas detached,go-nfsv4process terminated.Only the VeraCrypt GUI processes that existed before the mount remained.
This confirms that explicitly terminating the auxiliary FUSE-T service fixes the leak without changing the FUSE-T backend selection.