macOS: harden volume discovery and FUSE-T teardown

Run display discovery asynchronously and bound batched disk-image inventory
queries. Filter auxiliary mounts by basename, filesystem and owner, and
keep unresolved candidates separate from verified volumes. Allow targeted
dismounts despite incomplete discovery while requiring complete results
for slot allocation and empty-inventory decisions.

Use nonthrowing GUI snapshots with monotonic freshness, completion events
and safe window lifetimes. Suspend inactivity decisions while the snapshot
is stale, without restarting idle timers: activity counters are cumulative
per volume instance. Refresh logout targets and retry only failed ones.
Show a progress dialog for interactive unmounts, but keep automatic ones
synchronous, so a quit or logout request that arrives meanwhile is handled
afterwards rather than refused. Guard core operations against reentry and
route wait-dialog requests only from worker threads, so a main-thread
message cannot wait for itself.

Bind teardown to captured mount and service identities, including process
start time. Report a service exit that cannot be confirmed after auxiliary
mount removal as a distinct error that keeps the original details. Such
volumes are not retried, and a multi-volume unmount reports all of them
together with any other failure or a declined prompt. Warn about it after
automatic unmounts and at quit, and keep the background application until
the warning is acknowledged. Keep rollback responsive, and let services
remove their auxiliary directories without probing mounted paths. Preserve
released /control compatibility and perform best-effort cleanup for older
services.

Reap bounded subprocesses as soon as their output ends. A child that
survives SIGKILL is reaped by a later call, which starts no new child until
then. Keep subjects and subprocess command, status and error output when
formatting exceptions for wrapping and logs. Clarify discovery and rollback
diagnostics. Fix the localization-dependent busy-volume regression
assertion and extend discovery, snapshot, process identity, cleanup, GUI
lifecycle, inactivity and teardown coverage.
This commit is contained in:
Mounir IDRASSI committed 2026-09-28 03:17:28 +02:00
1 parent aedb2ef863
commit 596beb82a1
38 files changed
+2551 -311

No files matched your search

+19 -2
View File
@@ -23,15 +23,32 @@ namespace VeraCrypt
class VolumeInfo;
typedef list < shared_ptr <VolumeInfo> > VolumeInfoList;
// Unreadable candidates are not VolumeInfo objects: their slot and identity
// are unknown. Callers may act on verified volumes without claiming that an
// incomplete inventory proves absence (or that every volume was unmounted).
struct VolumeDiscoveryResult
{
VolumeInfoList Volumes;
list <DirectoryPath> UnresolvedMounts;
bool IsComplete () const { return UnresolvedMounts.empty(); }
};
class VolumeInfo : public Serializable
{
public:
VolumeInfo () { }
VolumeInfo () : Discovery (DiscoveryUnknown) { }
virtual ~VolumeInfo () { }
TC_SERIALIZABLE (VolumeInfo);
static bool FirstVolumeMountedAfterSecond (shared_ptr <VolumeInfo> first, shared_ptr <VolumeInfo> second);
void Set (const Volume &volume);
shared_ptr <VolumeInfo> Clone () const { return shared_ptr <VolumeInfo> (new VolumeInfo (*this)); }
// Local discovery hints only. Never serialized into the legacy control
// file or used as authority for a destructive operation. A GUI-retained
// entry whose control metadata is now unreadable has no current counters.
enum DiscoveryState { DiscoveryUnknown, ImageAttached, ImageAbsent, ControlUnavailable };
DiscoveryState Discovery;
// Modifying this structure can introduce incompatibility with previous versions
DirectoryPath AuxMountPoint;
@@ -63,7 +80,7 @@ namespace VeraCrypt
int Pim;
bool MasterKeyVulnerable;
private:
VolumeInfo (const VolumeInfo &);
VolumeInfo (const VolumeInfo &) = default;
VolumeInfo &operator= (const VolumeInfo &);
};
}