[clang] [llvm] [clang] Prevent sandbox violations in `CrossTranslationUnitContext` (PR #175097)

Ben Langmuir via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 9 11:52:07 PST 2026


================
@@ -620,6 +621,8 @@ CrossTranslationUnitContext::ASTLoader::loadFromSource(
   auto Diags = llvm::makeIntrusiveRefCnt<DiagnosticsEngine>(DiagID, *DiagOpts,
                                                             DiagClient);
 
+  // This runs the driver which isn't expected to be free of sandbox violations.
+  auto BypassSandbox = llvm::sys::sandbox::scopedDisable();
----------------
benlangmuir wrote:

I'm not really concerned about the driver itself, that is when it is parsing arguments for and then coordinating the frontend execution, it's the possibility of the driver being called back by the frontend specifically that seems (potentially) problematic if it allows the frontend to indirectly depend on unsandboxed FS access.  Probably this is more of a caching issue than a general VFS issue, and it would need special handling to cache correctly anyway, so maybe it's fine to ignore it for now?

https://github.com/llvm/llvm-project/pull/175097


More information about the cfe-commits mailing list