Skip to content

Conversation

@jansvoboda11
Copy link
Contributor

This PR propagates the already-configured VFS when handling chained includes, preventing unexpected use of the real FS and sandbox violations.

@llvmbot llvmbot added the clang Clang issues not falling into any other category label Dec 22, 2025
@llvmbot
Copy link
Member

llvmbot commented Dec 22, 2025

@llvm/pr-subscribers-clang

Author: Jan Svoboda (jansvoboda11)

Changes

This PR propagates the already-configured VFS when handling chained includes, preventing unexpected use of the real FS and sandbox violations.


Full diff: https://github.com/llvm/llvm-project/pull/173288.diff

1 Files Affected:

  • (modified) clang/lib/Frontend/ChainedIncludesSource.cpp (+1-1)
diff --git a/clang/lib/Frontend/ChainedIncludesSource.cpp b/clang/lib/Frontend/ChainedIncludesSource.cpp
index 049277c2df7a9..048ce03d09a3e 100644
--- a/clang/lib/Frontend/ChainedIncludesSource.cpp
+++ b/clang/lib/Frontend/ChainedIncludesSource.cpp
@@ -124,7 +124,7 @@ clang::createChainedIncludesSource(CompilerInstance &CI,
 
     auto Clang = std::make_unique<CompilerInstance>(
         std::move(CInvok), CI.getPCHContainerOperations());
-    Clang->createVirtualFileSystem();
+    Clang->setVirtualFileSystem(CI.getVirtualFileSystemPtr());
     Clang->setDiagnostics(Diags);
     Clang->setTarget(TargetInfo::CreateTargetInfo(
         Clang->getDiagnostics(), Clang->getInvocation().getTargetOpts()));

@cachemeifyoucan
Copy link
Collaborator

Is there an existing test case that catches this error?

@jansvoboda11
Copy link
Contributor Author

jansvoboda11 commented Jan 5, 2026

Not a functional test, but this gets caught as sandbox violation by existing test cases.

@jansvoboda11 jansvoboda11 enabled auto-merge (squash) January 5, 2026 19:54
@jansvoboda11 jansvoboda11 merged commit c7fe2f7 into llvm:main Jan 5, 2026
9 of 10 checks passed
@jansvoboda11 jansvoboda11 deleted the chained-includes-vfs branch January 5, 2026 20:34
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Jan 6, 2026
This PR propagates the already-configured VFS when handling chained
includes, preventing unexpected use of the real FS and sandbox
violations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants