[llvm] 77f5a3f - [Bitstream] Temporarily disable UBSan for invalid bitcode tests. This fixes failing sanitizer buildbots.

Andrew Browne via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 7 13:56:07 PST 2022


Author: Andrew Browne
Date: 2022-02-07T13:55:15-08:00
New Revision: 77f5a3fbba7a5405085553d14df1aac174235dfc

URL: https://github.com/llvm/llvm-project/commit/77f5a3fbba7a5405085553d14df1aac174235dfc
DIFF: https://github.com/llvm/llvm-project/commit/77f5a3fbba7a5405085553d14df1aac174235dfc.diff

LOG: [Bitstream] Temporarily disable UBSan for invalid bitcode tests. This fixes failing sanitizer buildbots.

Tests added by
  https://github.com/llvm/llvm-project/commit/3c86642edd28f1ce970882edaba8dce468ec7401
  https://github.com/llvm/llvm-project/commit/f4fca0fbb052e55935b483c8955c440b59511ce8
cause existing code to exhibit UB:
  https://github.com/llvm/llvm-project/blob/b4c6d1bb379192cb5b712fda9f60cd105f21194f/llvm/include/llvm/Bitstream/BitstreamReader.h#L244

llvm/include/llvm/Bitstream/BitstreamReader.h:244:51:
runtime error: shift exponent 35 is too large for 32-bit type 'unsigned int'

Hitting the UBSan error before the expected error causes the test to fail under UBSan:

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D119182

Added: 
    llvm/test/Bitcode/invalid-no-ubsan.test

Modified: 
    llvm/test/Bitcode/invalid.test

Removed: 
    


################################################################################
diff  --git a/llvm/test/Bitcode/invalid-no-ubsan.test b/llvm/test/Bitcode/invalid-no-ubsan.test
new file mode 100644
index 0000000000000..2cc8e057ac7fb
--- /dev/null
+++ b/llvm/test/Bitcode/invalid-no-ubsan.test
@@ -0,0 +1,19 @@
+# These tests cover invalid inputs.
+# When running under UBSan these tests hit UBSan issues before the validity
+# checks that the test is intending to exercise.
+# Under UBSan these tests fail because UBSan error is not the expected error.
+#
+# TODO: This code should be fixed to not exhibit UB, and these tests should be
+# incorporated back into invalid.test and run under UBSan again.
+
+UNSUPPORTED: ubsan
+
+RUN: not llvm-dis -disable-output %p/Inputs/size-not-plausible.bc 2>&1 | \
+RUN:   FileCheck --check-prefix=SIZE-NOT-PLAUSIBLE %s
+
+SIZE-NOT-PLAUSIBLE: Size is not plausible
+
+RUN: not llvm-dis -disable-output %p/Inputs/invalid-value-symbol-table-2.bc 2>&1 | \
+RUN:   FileCheck --check-prefix=INVALID-VALUE-SYMBOL-TABLE-2 %s
+
+INVALID-VALUE-SYMBOL-TABLE-2: Expected value symbol table subbloc

diff  --git a/llvm/test/Bitcode/invalid.test b/llvm/test/Bitcode/invalid.test
index fd0fae93171ec..c5cbabfd80ba1 100644
--- a/llvm/test/Bitcode/invalid.test
+++ b/llvm/test/Bitcode/invalid.test
@@ -252,11 +252,6 @@ RUN:   FileCheck --check-prefix=INVALID-ABBREV-NUMBER %s
 
 INVALID-ABBREV-NUMBER: Invalid abbrev number
 
-RUN: not llvm-dis -disable-output %p/Inputs/size-not-plausible.bc 2>&1 | \
-RUN:   FileCheck --check-prefix=SIZE-NOT-PLAUSIBLE %s
-
-SIZE-NOT-PLAUSIBLE: Size is not plausible
-
 RUN: not llvm-dis -disable-output %p/Inputs/invalid-attribute-group-entry.bc 2>&1 | \
 RUN:   FileCheck --check-prefix=INVALID-ATTRIBUTE-GROUP-ENTRY %s
 
@@ -271,8 +266,3 @@ RUN: not llvm-dis -disable-output %p/Inputs/invalid-value-symbol-table.bc 2>&1 |
 RUN:   FileCheck --check-prefix=INVALID-VALUE-SYMBOL-TABLE %s
 
 INVALID-VALUE-SYMBOL-TABLE: Invalid value reference in symbol table
-
-RUN: not llvm-dis -disable-output %p/Inputs/invalid-value-symbol-table-2.bc 2>&1 | \
-RUN:   FileCheck --check-prefix=INVALID-VALUE-SYMBOL-TABLE-2 %s
-
-INVALID-VALUE-SYMBOL-TABLE-2: Expected value symbol table subblock


        


More information about the llvm-commits mailing list