llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-static-analyzer-1 Author: Aviral Goel (aviralg) <details> <summary>Changes</summary> This change validates that plugin paths exist before loading them, producing a clean error message instead of relying on dlopen failure behavior. This fixes test failure on HWSan (aarch64-linux) where dlopen of a nonexistent `.so` triggers a sanitizer crash before the error message is written. --- Full diff: https://github.com/llvm/llvm-project/pull/195992.diff 2 Files Affected: - (modified) clang/lib/ScalableStaticAnalysisFramework/Tool/Utils.cpp (+4) - (modified) clang/test/Analysis/Scalable/ssaf-analyzer/cli-errors.test (+1-1) ``````````diff diff --git a/clang/lib/ScalableStaticAnalysisFramework/Tool/Utils.cpp b/clang/lib/ScalableStaticAnalysisFramework/Tool/Utils.cpp index 6a78620b757e6..f14f34eb3bbb0 100644 --- a/clang/lib/ScalableStaticAnalysisFramework/Tool/Utils.cpp +++ b/clang/lib/ScalableStaticAnalysisFramework/Tool/Utils.cpp @@ -136,6 +136,10 @@ llvm::StringRef clang::ssaf::getToolName() { return ToolName; } void clang::ssaf::loadPlugins(llvm::ArrayRef<std::string> Paths) { for (const std::string &PluginPath : Paths) { + if (!fs::exists(PluginPath)) { + fail(ErrorMessages::FailedToLoadPlugin, PluginPath, + ErrorMessages::PathDoesNotExist); + } std::string ErrMsg; if (llvm::sys::DynamicLibrary::LoadLibraryPermanently(PluginPath.c_str(), &ErrMsg)) { diff --git a/clang/test/Analysis/Scalable/ssaf-analyzer/cli-errors.test b/clang/test/Analysis/Scalable/ssaf-analyzer/cli-errors.test index 3f3abeef63643..0367ba8b8c484 100644 --- a/clang/test/Analysis/Scalable/ssaf-analyzer/cli-errors.test +++ b/clang/test/Analysis/Scalable/ssaf-analyzer/cli-errors.test @@ -26,7 +26,7 @@ // RUN: not clang-ssaf-analyzer --load /nonexistent/path/plugin.so \ // RUN: %S/Inputs/lu.json -o %t/plugin-err.json 2>&1 \ // RUN: | FileCheck %s --check-prefix=BAD-PLUGIN -// BAD-PLUGIN: clang-ssaf-analyzer: error: failed to load plugin '/nonexistent/path/plugin.so': +// BAD-PLUGIN: clang-ssaf-analyzer: error: failed to load plugin '/nonexistent/path/plugin.so': Path does not exist // ============================================================================ // Error: empty analysis name `````````` </details> https://github.com/llvm/llvm-project/pull/195992 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
