ProjFS: only tolerate FilterAttach ACCESS_DENIED for unelevated callers#2051
Open
tyrielv wants to merge 1 commit into
Open
ProjFS: only tolerate FilterAttach ACCESS_DENIED for unelevated callers#2051tyrielv wants to merge 1 commit into
tyrielv wants to merge 1 commit into
Conversation
PR microsoft#1980 made TryAttachToVolume tolerate ACCESS_DENIED from FilterAttach whenever the ProjFS service is running. Because both callers share this method, the elevated GVFS.Service (running as LocalSystem) also began swallowing ACCESS_DENIED — but the service holds SE_LOAD_DRIVER_PRIVILEGE, so ACCESS_DENIED there is never the benign "unprivileged caller" case. It signals a real problem (AV/EDR lock, Group Policy, or driver corruption), and tolerating it lets a broken mount proceed instead of surfacing an actionable error. Before microsoft#1980 the service called raw TryAttach and reported that failure. FilterAttach's ACCESS_DENIED is a privilege gate, not a transient contention error: an unelevated caller always gets it (regardless of the actual attach state), while an elevated caller only gets it when something is genuinely wrong. Narrow the tolerance to unelevated callers so the unelevated `gvfs mount` fix is preserved while the elevated service once again surfaces genuine attach failures. This also aligns the code with the existing comment's stated intent ("when the caller lacks this privilege"). Assisted-by: Claude Opus 4.8 Signed-off-by: Tyrie Vella <tyrielv@gmail.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
Narrows the ACCESS_DENIED tolerance added in #1980 so it only applies to unelevated callers of
ProjFSFilter.TryAttachToVolume. This keeps the unelevatedgvfs mountfix intact while ensuring the elevatedGVFS.Serviceno longer silently swallows a genuine attach failure.Background
#1980 made
TryAttachToVolumetreatACCESS_DENIEDfromFilterAttachas success whenever the ProjFS service is running. Both callers share this method:ProjFSFilter.IsReady()— runs in the (usually unelevated)gvfs mountprocess.EnableAndAttachProjFSHandler.Run()— runs inGVFS.Service, which is elevated (LocalSystem).The problem (error-swallowing risk)
FilterAttachrequiresSE_LOAD_DRIVER_PRIVILEGE, checked as a privilege gate at the API entry point:ACCESS_DENIED, regardless of whether the filter is actually attached. When the service is running, the (elevated) service already attached the filter, so tolerating this is the correct fix — and is the whole point of ProjFS: tolerate ACCESS_DENIED on FilterAttach, remove dead bundled-driver code #1980.ACCESS_DENIEDis never the benign case there. It signals a real problem — AV/EDR lock, Group Policy restriction, or driver corruption — and swallowing it lets the mount proceed in a broken state with no actionable error.Before #1980, the service called raw
TryAttachand reported that failure. After #1980 it swallows it. This PR restores that safety for the elevated path.The fix
Add a
!WindowsPlatform.IsElevatedImplementation()guard to the tolerance condition.ACCESS_DENIEDis a deterministic privilege gate, not a transient contention error, so distinguishing purely on elevation is precise:gvfs mount: still tolerated → ProjFS: tolerate ACCESS_DENIED on FilterAttach, remove dead bundled-driver code #1980 fix preserved.GVFS.Service:ACCESS_DENIEDsurfaces again → genuine failures are reported, not masked.This also aligns the code with the existing comment's stated intent ("when the caller lacks this privilege"), which the merged code never actually checked.
Explicitly out of scope
A bounded retry loop for "transient AV-scan contention" is not included:
FilterAttach'sACCESS_DENIEDis a deterministic privilege gate, not a sharing/contention error (which would surface as a different HRESULT). Retrying would add latency and still mask real failures.Tests
GVFS.Platform.Windows,GVFS.Service, andGVFS.UnitTestsbuild clean (0 warnings, 0 errors).ProjFSFilterTests— 3/3 passed.