Skip to content

Conversation

@balazske
Copy link
Collaborator

Read the 'mmap' flags from macro values and use a better test for the error situation.

Read the 'mmap' flags from macro values and use a better test
for the error situation .
@balazske balazske requested review from NagyDonat and steakhal June 28, 2024 16:04
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:static analyzer labels Jun 28, 2024
@llvmbot
Copy link
Member

llvmbot commented Jun 28, 2024

@llvm/pr-subscribers-clang-static-analyzer-1

Author: Balázs Kéri (balazske)

Changes

Read the 'mmap' flags from macro values and use a better test for the error situation.


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

2 Files Affected:

  • (modified) clang/lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp (+33-16)
  • (modified) clang/test/Analysis/mmap-writeexec.c (+5-4)
diff --git a/clang/lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp
index cd1dd1b2fc511..a5a2bd62b47d6 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp
@@ -21,30 +21,55 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h"
 
 using namespace clang;
 using namespace ento;
 
 namespace {
-class MmapWriteExecChecker : public Checker<check::PreCall> {
+class MmapWriteExecChecker
+    : public Checker<check::BeginFunction, check::PreCall> {
   CallDescription MmapFn{CDM::CLibrary, {"mmap"}, 6};
   CallDescription MprotectFn{CDM::CLibrary, {"mprotect"}, 3};
-  static int ProtWrite;
-  static int ProtExec;
-  static int ProtRead;
   const BugType BT{this, "W^X check fails, Write Exec prot flags set",
                    "Security"};
 
+  mutable bool FlagsInitialized = false;
+  mutable int ProtRead = 0x01;
+  mutable int ProtWrite = 0x02;
+  mutable int ProtExec = 0x04;
+
 public:
+  void checkBeginFunction(CheckerContext &C) const;
   void checkPreCall(const CallEvent &Call, CheckerContext &C) const;
+
   int ProtExecOv;
   int ProtReadOv;
 };
 }
 
-int MmapWriteExecChecker::ProtWrite = 0x02;
-int MmapWriteExecChecker::ProtExec  = 0x04;
-int MmapWriteExecChecker::ProtRead  = 0x01;
+void MmapWriteExecChecker::checkBeginFunction(CheckerContext &C) const {
+  if (FlagsInitialized)
+    return;
+
+  FlagsInitialized = true;
+
+  const std::optional<int> FoundProtRead =
+          tryExpandAsInteger("PROT_READ", C.getPreprocessor());
+  const std::optional<int> FoundProtWrite =
+          tryExpandAsInteger("PROT_WRITE", C.getPreprocessor());
+  const std::optional<int> FoundProtExec =
+          tryExpandAsInteger("PROT_EXEC", C.getPreprocessor());
+  if (FoundProtRead && FoundProtWrite && FoundProtExec) {
+    ProtRead = *FoundProtRead;
+    ProtWrite = *FoundProtWrite;
+    ProtExec = *FoundProtExec;
+  } else {
+    // FIXME: Are these useful?
+    ProtRead = ProtReadOv;
+    ProtExec = ProtExecOv;
+  }
+}
 
 void MmapWriteExecChecker::checkPreCall(const CallEvent &Call,
                                          CheckerContext &C) const {
@@ -54,16 +79,8 @@ void MmapWriteExecChecker::checkPreCall(const CallEvent &Call,
     if (!ProtLoc)
       return;
     int64_t Prot = ProtLoc->getValue().getSExtValue();
-    if (ProtExecOv != ProtExec)
-      ProtExec = ProtExecOv;
-    if (ProtReadOv != ProtRead)
-      ProtRead = ProtReadOv;
-
-    // Wrong settings
-    if (ProtRead == ProtExec)
-      return;
 
-    if ((Prot & (ProtWrite | ProtExec)) == (ProtWrite | ProtExec)) {
+    if ((Prot & ProtWrite) && (Prot & ProtExec)) {
       ExplodedNode *N = C.generateNonFatalErrorNode();
       if (!N)
         return;
diff --git a/clang/test/Analysis/mmap-writeexec.c b/clang/test/Analysis/mmap-writeexec.c
index 8fd86ceb9d2a2..88fcc7788e683 100644
--- a/clang/test/Analysis/mmap-writeexec.c
+++ b/clang/test/Analysis/mmap-writeexec.c
@@ -1,13 +1,14 @@
 // RUN: %clang_analyze_cc1 -triple i686-unknown-linux -analyzer-checker=alpha.security.MmapWriteExec -analyzer-config alpha.security.MmapWriteExec:MmapProtExec=1 -analyzer-config alpha.security.MmapWriteExec:MmapProtRead=4 -DUSE_ALTERNATIVE_PROT_EXEC_DEFINITION -verify %s
 // RUN: %clang_analyze_cc1 -triple x86_64-unknown-apple-darwin10 -analyzer-checker=alpha.security.MmapWriteExec -verify %s
 
-#define PROT_WRITE  0x02
 #ifndef USE_ALTERNATIVE_PROT_EXEC_DEFINITION
-#define PROT_EXEC   0x04
-#define PROT_READ   0x01
-#else
 #define PROT_EXEC   0x01
+#define PROT_WRITE  0x02
 #define PROT_READ   0x04
+#else
+#define PROT_EXEC   0x08
+#define PROT_WRITE  0x04
+#define PROT_READ   0x02
 #endif
 #define MAP_PRIVATE 0x0002
 #define MAP_ANON    0x1000

@llvmbot
Copy link
Member

llvmbot commented Jun 28, 2024

@llvm/pr-subscribers-clang

Author: Balázs Kéri (balazske)

Changes

Read the 'mmap' flags from macro values and use a better test for the error situation.


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

2 Files Affected:

  • (modified) clang/lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp (+33-16)
  • (modified) clang/test/Analysis/mmap-writeexec.c (+5-4)
diff --git a/clang/lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp
index cd1dd1b2fc511..a5a2bd62b47d6 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp
@@ -21,30 +21,55 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h"
 
 using namespace clang;
 using namespace ento;
 
 namespace {
-class MmapWriteExecChecker : public Checker<check::PreCall> {
+class MmapWriteExecChecker
+    : public Checker<check::BeginFunction, check::PreCall> {
   CallDescription MmapFn{CDM::CLibrary, {"mmap"}, 6};
   CallDescription MprotectFn{CDM::CLibrary, {"mprotect"}, 3};
-  static int ProtWrite;
-  static int ProtExec;
-  static int ProtRead;
   const BugType BT{this, "W^X check fails, Write Exec prot flags set",
                    "Security"};
 
+  mutable bool FlagsInitialized = false;
+  mutable int ProtRead = 0x01;
+  mutable int ProtWrite = 0x02;
+  mutable int ProtExec = 0x04;
+
 public:
+  void checkBeginFunction(CheckerContext &C) const;
   void checkPreCall(const CallEvent &Call, CheckerContext &C) const;
+
   int ProtExecOv;
   int ProtReadOv;
 };
 }
 
-int MmapWriteExecChecker::ProtWrite = 0x02;
-int MmapWriteExecChecker::ProtExec  = 0x04;
-int MmapWriteExecChecker::ProtRead  = 0x01;
+void MmapWriteExecChecker::checkBeginFunction(CheckerContext &C) const {
+  if (FlagsInitialized)
+    return;
+
+  FlagsInitialized = true;
+
+  const std::optional<int> FoundProtRead =
+          tryExpandAsInteger("PROT_READ", C.getPreprocessor());
+  const std::optional<int> FoundProtWrite =
+          tryExpandAsInteger("PROT_WRITE", C.getPreprocessor());
+  const std::optional<int> FoundProtExec =
+          tryExpandAsInteger("PROT_EXEC", C.getPreprocessor());
+  if (FoundProtRead && FoundProtWrite && FoundProtExec) {
+    ProtRead = *FoundProtRead;
+    ProtWrite = *FoundProtWrite;
+    ProtExec = *FoundProtExec;
+  } else {
+    // FIXME: Are these useful?
+    ProtRead = ProtReadOv;
+    ProtExec = ProtExecOv;
+  }
+}
 
 void MmapWriteExecChecker::checkPreCall(const CallEvent &Call,
                                          CheckerContext &C) const {
@@ -54,16 +79,8 @@ void MmapWriteExecChecker::checkPreCall(const CallEvent &Call,
     if (!ProtLoc)
       return;
     int64_t Prot = ProtLoc->getValue().getSExtValue();
-    if (ProtExecOv != ProtExec)
-      ProtExec = ProtExecOv;
-    if (ProtReadOv != ProtRead)
-      ProtRead = ProtReadOv;
-
-    // Wrong settings
-    if (ProtRead == ProtExec)
-      return;
 
-    if ((Prot & (ProtWrite | ProtExec)) == (ProtWrite | ProtExec)) {
+    if ((Prot & ProtWrite) && (Prot & ProtExec)) {
       ExplodedNode *N = C.generateNonFatalErrorNode();
       if (!N)
         return;
diff --git a/clang/test/Analysis/mmap-writeexec.c b/clang/test/Analysis/mmap-writeexec.c
index 8fd86ceb9d2a2..88fcc7788e683 100644
--- a/clang/test/Analysis/mmap-writeexec.c
+++ b/clang/test/Analysis/mmap-writeexec.c
@@ -1,13 +1,14 @@
 // RUN: %clang_analyze_cc1 -triple i686-unknown-linux -analyzer-checker=alpha.security.MmapWriteExec -analyzer-config alpha.security.MmapWriteExec:MmapProtExec=1 -analyzer-config alpha.security.MmapWriteExec:MmapProtRead=4 -DUSE_ALTERNATIVE_PROT_EXEC_DEFINITION -verify %s
 // RUN: %clang_analyze_cc1 -triple x86_64-unknown-apple-darwin10 -analyzer-checker=alpha.security.MmapWriteExec -verify %s
 
-#define PROT_WRITE  0x02
 #ifndef USE_ALTERNATIVE_PROT_EXEC_DEFINITION
-#define PROT_EXEC   0x04
-#define PROT_READ   0x01
-#else
 #define PROT_EXEC   0x01
+#define PROT_WRITE  0x02
 #define PROT_READ   0x04
+#else
+#define PROT_EXEC   0x08
+#define PROT_WRITE  0x04
+#define PROT_READ   0x02
 #endif
 #define MAP_PRIVATE 0x0002
 #define MAP_ANON    0x1000

Copy link
Contributor

@steakhal steakhal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I only had some minor remarks.

Copy link
Contributor

@NagyDonat NagyDonat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, straightforward change. Thanks!

EDIT: I posted this review without noticing that in the meantime @steakhal did his own review with some valuable suggestions. I'd still say that the PR would be acceptable without those stylistic tweaks, but if you apply them, then it'll be even better.

ProtWrite = *FoundProtWrite;
ProtExec = *FoundProtExec;
} else {
// FIXME: Are these useful?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are not too useful (and it's a little bit surprising that there is no "ProtWriteOv"), but they're harmless and they don't require complex code, so let's keep them for now.

@balazske
Copy link
Collaborator Author

I removed the options to specify PROT_ values. These should not be needed because detection from macro value should work in normal cases (probably this functionality was not available when the options were added).

Copy link
Contributor

@steakhal steakhal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!
Nice cleanup.

@@ -1,13 +1,14 @@
// RUN: %clang_analyze_cc1 -triple i686-unknown-linux -analyzer-checker=alpha.security.MmapWriteExec -analyzer-config alpha.security.MmapWriteExec:MmapProtExec=1 -analyzer-config alpha.security.MmapWriteExec:MmapProtRead=4 -DUSE_ALTERNATIVE_PROT_EXEC_DEFINITION -verify %s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, isn't the -analyzer-config alpha.security.MmapWriteExec:MmapProtRead=4 obsolete?
Why does this not error out with such a config?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was really a test failure, fixed now.

@steakhal
Copy link
Contributor

Please make sure that the premerge bots are happy before merging.

@balazske balazske merged commit 9440a49 into llvm:main Jul 26, 2024
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 26, 2024

LLVM Buildbot has detected a new failure on builder sanitizer-x86_64-linux-bootstrap-asan running on sanitizer-buildbot1 while building clang at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/52/builds/1169

Here is the relevant piece of the build log for the reference:

Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
llvm-lit: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:508: note: using lld-link: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:508: note: using ld64.lld: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:508: note: using wasm-ld: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:508: note: using ld.lld: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld
llvm-lit: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:508: note: using lld-link: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:508: note: using ld64.lld: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:508: note: using wasm-ld: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 84689 of 84690 tests, 88 workers --
Testing:  0.. 10.. 20
FAIL: Clang Tools :: clang-doc/basic-project.test (19740 of 84689)
******************** TEST 'Clang Tools :: clang-doc/basic-project.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
Emiting docs in html format.
Mapping decls...
Collecting infos...
Reducing 5 infos...
Generating docs...
Generating assets for docs...

--
Command Output (stderr):
--
RUN: at line 1: rm -rf /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp && mkdir -p /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/build
+ rm -rf /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp
+ mkdir -p /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/build
RUN: at line 2: sed 's|$test_dir|/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc|g' /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/Inputs/basic-project/database_template.json > /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/build/compile_commands.json
+ sed 's|$test_dir|/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc|g' /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/Inputs/basic-project/database_template.json
RUN: at line 3: clang-doc --format=html --output=/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs --executor=all-TUs /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/build/compile_commands.json
+ clang-doc --format=html --output=/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs --executor=all-TUs /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/build/compile_commands.json
[1/3] Processing file /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/Inputs/basic-project/src/Circle.cpp
[2/3] Processing file /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/Inputs/basic-project/src/Rectangle.cpp
[3/3] Processing file /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/Inputs/basic-project/src/Calculator.cpp
RUN: at line 4: FileCheck /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/basic-project.test -input-file=/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs/index_json.js -check-prefix=JSON-INDEX
+ FileCheck /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/basic-project.test -input-file=/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs/index_json.js -check-prefix=JSON-INDEX
RUN: at line 5: FileCheck /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/basic-project.test -input-file=/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs/GlobalNamespace/Shape.html -check-prefix=HTML-SHAPE
+ FileCheck /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/basic-project.test -input-file=/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs/GlobalNamespace/Shape.html -check-prefix=HTML-SHAPE
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/basic-project.test:64:16: error: HTML-SHAPE: expected string not found in input
// HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">area</h3>
               ^
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs/GlobalNamespace/Shape.html:32:53: note: scanning from here
 <p>Defined at line 13 of file ./include/Shape.h</p>
                                                    ^
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs/GlobalNamespace/Shape.html:47:41: note: possible intended match here
 <a href="#12896F9255F880ECD4A6482CCFA58B238FA2CC49">area</a>
                                        ^
Step 10 (stage2/asan check) failure: stage2/asan check (failure)
...
llvm-lit: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:508: note: using lld-link: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:508: note: using ld64.lld: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:508: note: using wasm-ld: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:508: note: using ld.lld: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld
llvm-lit: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:508: note: using lld-link: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:508: note: using ld64.lld: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:508: note: using wasm-ld: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 84689 of 84690 tests, 88 workers --
Testing:  0.. 10.. 20
FAIL: Clang Tools :: clang-doc/basic-project.test (19740 of 84689)
******************** TEST 'Clang Tools :: clang-doc/basic-project.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
Emiting docs in html format.
Mapping decls...
Collecting infos...
Reducing 5 infos...
Generating docs...
Generating assets for docs...

--
Command Output (stderr):
--
RUN: at line 1: rm -rf /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp && mkdir -p /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/build
+ rm -rf /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp
+ mkdir -p /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/build
RUN: at line 2: sed 's|$test_dir|/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc|g' /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/Inputs/basic-project/database_template.json > /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/build/compile_commands.json
+ sed 's|$test_dir|/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc|g' /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/Inputs/basic-project/database_template.json
RUN: at line 3: clang-doc --format=html --output=/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs --executor=all-TUs /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/build/compile_commands.json
+ clang-doc --format=html --output=/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs --executor=all-TUs /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/build/compile_commands.json
[1/3] Processing file /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/Inputs/basic-project/src/Circle.cpp
[2/3] Processing file /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/Inputs/basic-project/src/Rectangle.cpp
[3/3] Processing file /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/Inputs/basic-project/src/Calculator.cpp
RUN: at line 4: FileCheck /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/basic-project.test -input-file=/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs/index_json.js -check-prefix=JSON-INDEX
+ FileCheck /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/basic-project.test -input-file=/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs/index_json.js -check-prefix=JSON-INDEX
RUN: at line 5: FileCheck /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/basic-project.test -input-file=/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs/GlobalNamespace/Shape.html -check-prefix=HTML-SHAPE
+ FileCheck /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/basic-project.test -input-file=/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs/GlobalNamespace/Shape.html -check-prefix=HTML-SHAPE
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang-tools-extra/test/clang-doc/basic-project.test:64:16: error: HTML-SHAPE: expected string not found in input
// HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">area</h3>
               ^
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs/GlobalNamespace/Shape.html:32:53: note: scanning from here
 <p>Defined at line 13 of file ./include/Shape.h</p>
                                                    ^
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/clang/tools/extra/test/clang-doc/Output/basic-project.test.tmp/docs/GlobalNamespace/Shape.html:47:41: note: possible intended match here
 <a href="#12896F9255F880ECD4A6482CCFA58B238FA2CC49">area</a>
                                        ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:static analyzer clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants