Skip to content

Git Bash fails to start in an AppContainer (0xC0000142) #6576

Backlog

Description

@ellipog

Setup

  • Windows 11 24H2 (10.0.26200), and GitHub's windows-latest runner (Windows Server 2025)
  • Git for Windows 2.46.0 (MSYS runtime 3.4.10), and 2.56.1 on the runner

Details

Started inside an AppContainer, which sandboxes use to keep a program to the folders it's given, Git Bash exits before it runs anything:

C:\Program Files\Git\bin\bash.exe -c "echo hi"

On 2.46.0 it exits with 0xC0000142 (STATUS_DLL_INIT_FAILED) and prints nothing. Native programs work in the same container: cmd, PowerShell, git.exe (including git clone), and node.

It looks like three things in msys-2.0.dll:

  1. Relocation. Windows always relocates images in an AppContainer process. The 3.4.10 DLL crashes as it starts. The runner's newer runtime survives the move, but fork then can't lay the child out like the parent.
  2. Named objects. It creates \BaseNamedObjects\msys-2.0S5-<key>, and containers are refused there.
  3. Permissions. With that out of the way, it fails with couldn't create signal pipe, Win32 error 5. Its pipes and shared memory get a security descriptor that grants Everyone, which an AppContainer process doesn't pass, so one confined msys process can't open what another made.

This looks like what git-for-windows/msys2-runtime#148 ("Support running MSYS in an AppContainer") and msys2/msys2-runtime#403 address. I'm filing this so people who hit the crash can find those PRs, and so it can be closed when a release has the fix.

Expected

Git Bash runs in an AppContainer, with what the container is given, as native programs do.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions