Skip to content

Windows LPAC: process launch still turns drive aliases into physical image paths after #1024 #1032

Todo

Description

@dreamyloong2005

Summary

With mcpp 2026.11.27.1, the original home-path problem from
#1024 is no longer the first
failure, but the compiler-version probe still fails in our Windows LPAC
AppContainer:

error: 'Z:/bin/llvm\bin\clang++.exe --version' exited with status 1:
Z:/bin/llvm\bin\clang++.exe: permission denied

The printed command is misleading for this case: argv[0] retains Z:, while
the child module path is physical. The examined Windows process backend
reconstructs executable and cwd paths from handles before spawning. That loses
an alias under which the same compiler works inside this sandbox.

Environment and reproduction

  • Windows x64, LPAC AppContainer with no network capabilities; existing job and
    private staged-files policy unchanged.
  • mcpp 2026.11.27.1; bundled xlings 2026.11.23.1; LLVM 22.1.8.
  • The sandbox maps its private staging tree to Z:. Original host tool files
    are not granted to the AppContainer; only owned staged copies are used.
  • MCPP_TOOLCHAIN=path:Z:/bin/llvm, offline cached package bundle, explicit
    private MCPP_HOME. The missing AppContainer-private Temp layout is created
    inside the sandbox's private home first, so it does not mask this failure.
  • Run mcpp fetch --from Z:/bin/bundle; two independent runs reach the same
    compiler-version error. No task database is involved in the reduced host.

Controlled observations

In the direct WinAPI control experiments, CreateProcessW returns success in
both real-tool cases; the difference is the child result, not a spawn API
access-denied error. We did not intercept this call inside mcpp itself.

lpApplicationName argv[0] clang++ --version
alias Z: alias Z: exit 0
physical staging path physical staging path exit 1, permission denied
physical staging path alias Z: exit 1, permission denied
alias Z: physical staging path exit 0

All-forward, all-backslash and mixed-slash alias spellings also exit 0. The same
alias/physical difference occurs with clang-scan-deps and lld-link.

We replaced only staged clang++.exe with a static-CRT diagnostic program that
prints GetModuleFileNameW, GetCommandLineW, and argv, then deliberately exits
86. The exact same probe binary shows:

direct alias launch: module=Z:\bin\llvm\bin\clang++.exe
mcpp launch: module=<physical-stage>\bin\llvm\bin\clang++.exe
             argv[0]=Z:/bin/llvm\bin\clang++.exe

<physical-stage> abbreviates the per-run directory in this excerpt. Full
local receipts preserve the exact paths and hashes. QueryFullProcessImageNameW
returns physical paths on both sides and is not used as differentiating proof.

Matching upstream implementation

We have not recovered the exact openkal version linked into the release binary,
nor captured its CreateProcessW arguments in a debugger. The fixed-source
mechanism matches the same-binary child-path observations above.

Expected behavior and limits

Preserve a usable sandbox-visible executable/cwd spelling through process
launch while retaining existing handle/path security guarantees. Widening host
ACLs or disabling LPAC is not an acceptable workaround.

This report is limited to compiler-version launch. It does not claim all LLVM
operations work in LPAC, a newly introduced regression, or a passing full
build. The private Temp layout, xlings bootstrap exit 137 and store-root link
warning are separate unresolved observations, not attributed to this mechanism.

Diagnostic child source

Static-CRT probe used for the same-binary path comparison

Compile with MSVC (cl /nologo /EHsc /MT /utf-8 spy.cpp /Fe:spy.exe), and use a
copy as the staged clang++.exe for the diagnostic run only. It intentionally
returns 86; this is not a compiler or a passing build.

#define NOMINMAX
#include <windows.h>
#include <iostream>
#include <string>
std::string utf8(const std::wstring& s) {
    const auto n=WideCharToMultiByte(CP_UTF8,0,s.data(),int(s.size()),nullptr,0,nullptr,nullptr);
    std::string r(n,'\0');
    WideCharToMultiByte(CP_UTF8,0,s.data(),int(s.size()),r.data(),n,nullptr,nullptr);
    return r;
}
int wmain(int argc,wchar_t** argv) {
    wchar_t image[32768]{};
    GetModuleFileNameW(nullptr,image,32768);
    // mcpp retains the last non-empty diagnostic line, so keep this atomic.
    std::cerr << "[DEBUG-launch-spy] module=" << utf8(image)
              << " | command=" << utf8(GetCommandLineW());
    for (int i=0;i<argc;++i) std::cerr << " | argv[" << i << "]=" << utf8(argv[i]);
    std::cerr << '\n';
    // Deliberate failure exposes capture text; this is not a compiler.
    return 86;
}

Full local receipts retain per-run paths and SHA-256 values; they are not attached
to this issue. The controlled results and source above are the public evidence.

Activity

  1. Sunrisepeak commented on Nov 28, 2026

    @Sunrisepeak
    Member

    预计下个版本修复

  2. self-assigned this
    on Nov 28, 2026
  3. added
    bug
    on Nov 28, 2026
  4. added theissue type on Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions