[clang] Bypass sandbox in ModuleDependencyCollector#175220
Merged
jansvoboda11 merged 1 commit intollvm:mainfrom Jan 12, 2026
Merged
[clang] Bypass sandbox in ModuleDependencyCollector#175220jansvoboda11 merged 1 commit intollvm:mainfrom
ModuleDependencyCollector#175220jansvoboda11 merged 1 commit intollvm:mainfrom
Conversation
Member
|
@llvm/pr-subscribers-clang-modules @llvm/pr-subscribers-clang Author: Jan Svoboda (jansvoboda11) ChangesThis PR disables the sandbox for file collection within Full diff: https://github.com/llvm/llvm-project/pull/175220.diff 1 Files Affected:
diff --git a/clang/lib/Frontend/ModuleDependencyCollector.cpp b/clang/lib/Frontend/ModuleDependencyCollector.cpp
index ff37065885289..38415377c8b9b 100644
--- a/clang/lib/Frontend/ModuleDependencyCollector.cpp
+++ b/clang/lib/Frontend/ModuleDependencyCollector.cpp
@@ -16,6 +16,7 @@
#include "clang/Serialization/ASTReader.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/IOSandbox.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
@@ -161,11 +162,16 @@ std::error_code ModuleDependencyCollector::copyToRoot(StringRef Src,
}
// Copy the file into place.
- if (std::error_code EC = fs::create_directories(path::parent_path(CacheDst),
- /*IgnoreExisting=*/true))
- return EC;
- if (std::error_code EC = fs::copy_file(Paths.CopyFrom, CacheDst))
- return EC;
+ {
+ // FIXME(sandboxing): Implement this via vfs::{FileSystem,OutputBackend}.
+ auto BypassSandbox = sandbox::scopedDisable();
+
+ if (std::error_code EC = fs::create_directories(path::parent_path(CacheDst),
+ /*IgnoreExisting=*/true))
+ return EC;
+ if (std::error_code EC = fs::copy_file(Paths.CopyFrom, CacheDst))
+ return EC;
+ }
// Always map a canonical src path to its real path into the YAML, by doing
// this we map different virtual src paths to the same entry in the VFS
|
benlangmuir
approved these changes
Jan 9, 2026
Priyanshu3820
pushed a commit
to Priyanshu3820/llvm-project
that referenced
this pull request
Jan 18, 2026
This PR disables the sandbox for file collection within `ModuleDependencyCollector`. This is typically only invoked when the `-module-dependency-dir` option is specified for generating a crash report, where the sandbox is not as crucial as for regular compilation.
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.
This PR disables the sandbox for file collection within
ModuleDependencyCollector. This is typically only invoked when the-module-dependency-diroption is specified for generating a crash report, where the sandbox is not as crucial as for regular compilation.