microsoft / microsoft/VFSForGit

Cannot access 4 GB or bigger files through the ProjFS driver

Open
#263 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.1k
Forks
474
Avg merge
2d 4h
Merged PRs (30d)
8

Description

There seem to be an arithmetic overflow somewhere. The IVirtualizationInstance.OnGetFileStream (from ProjectedFSLib.Managed.dll) callback is invoked with:

  • for a 4 GB file: a byteOffset of 0 and length of 0
  • for a 4 GB file + 1 byte: a byteOffset of 0 and length of 1
  • for a 4 GB file - 1 byte: a byteOffset of 0 and length of 4294967295

Steps to reproduce:

  1. Build the MirrorProvider by running MirrorProvider\Scripts\Windows\Build.bat.
  2. Create a C:\PathToMirror folder.
  3. Generate a 4 GB file, for exemple by running the following Python code:
    with open('C:\\PathToMirror\\huge_file_4GB.bin', 'wb') as f:
        f.seek(4*1024*1024*1024 - 1)
        f.write(b"\0")
    
  4. Clone and mount the MirrorProvider by running MirrorProvider\Scripts\Windows\MirrorProvider_Clone.bat and then MirrorProvider\Scripts\Windows\MirrorProvider_Mirror.bat.
  5. Open and read data from the mirrored file C:\TestRoot\src\huge_file_4GB.bin, for exemple by running the following Python code:
    with open('C:\\TestRoot\\src\\huge_file_4GB.bin', 'rb') as f:
        something = f.read(1)
    
  6. Notice the following failure in the MirrorProvider output:
    GetPlaceholderInformation: `huge_file_4GB.bin`
    GetFileStream: `huge_file_4GB.bin`
    WriteFile faild: -2147024362
    GetFileStream: `huge_file_4GB.bin`
    WriteFile faild: -2147024362
    GetFileStream: `huge_file_4GB.bin`
    WriteFile faild: -2147024362
    GetFileStream: `huge_file_4GB.bin`
    WriteFile faild: -2147024362
    GetFileStream: `huge_file_4GB.bin`
    WriteFile faild: -2147024362
    GetFileStream: `huge_file_4GB.bin`
    WriteFile faild: -2147024362
    GetFileStream: `huge_file_4GB.bin`
    WriteFile faild: -2147024362
    
    Note that the -2147024362 HResult is E_ARITHMETIC_OVERFLOW.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with MirrorProvider\Scripts\Windows\Build.bat, MirrorProvider_Clone.bat, and MirrorProvider_Mirror.bat, then inspect IVirtualizationInstance.OnGetFileStream and the MirrorProvider output. Compare byteOffset and length for files around 4 GB and trace where the arithmetic overflow produces E_ARITHMETIC_OVERFLOW. Done means reads from 4 GB and larger files succeed without overflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.