Pick up latest OVS UB fixes too, specifically:
  c8c49a9db9f2 ("netdev-linux: Properly access 32-bit aligned rtnl_link_stats64 
structs.")
  a5cc859a4228 ("ofp-actions: Use aligned structures when decoding ofp 
actions.")
  08c3e5e37eee ("ofp-errors: Ensure parsed OFPT_ERROR messages are properly 
aligned.")
  933aaf9444a6 ("ofp-actions: Ensure aligned accesses to masked fields.")
  471babb8117a ("treewide: Avoid offsetting NULL pointers.")
  3764f5188af0 ("treewide: Fix invalid bit shift operations.")

Signed-off-by: Dumitru Ceara <[email protected]>
---
 .ci/linux-build.sh         | 18 +++++++++++++-----
 .github/workflows/test.yml |  4 ++++
 ovs                        |  2 +-
 tests/atlocal.in           |  5 +++++
 tests/automake.mk          |  1 +
 tests/ovs-macros.at        |  5 +++++
 6 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index c526e614d..570ddbace 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -28,12 +28,20 @@ function configure_ovn()
 save_OPTS="${OPTS} $*"
 OPTS="${EXTRA_OPTS} ${save_OPTS}"
 
-# If AddressSanitizer is requested, enable it, but only for OVN, not for OVS.
-# However, disable some optimizations for OVS, to make AddressSanitizer
-# reports user friendly.
+# If AddressSanitizer or UdefinedBehaviorSanitizer is requested, enable it,
+# but only for OVN, not for OVS.  However, disable some optimizations for
+# OVS, to make sanitizer reports user friendly.
 if [ "$ASAN" ]; then
-    CFLAGS="-fno-omit-frame-pointer -fno-common"
-    OVN_CFLAGS="-fsanitize=address"
+    CFLAGS="-O1 -fno-omit-frame-pointer -fno-common"
+    CFLAGS_ASAN="-fsanitize=address"
+    OVN_CFLAGS="${OVN_CFLAGS} ${CFLAGS_ASAN}"
+fi
+
+if [ "$UBSAN" ]; then
+    # Use the default options configured in tests/atlocal.in, in UBSAN_OPTIONS.
+    CFLAGS="-O1 -fno-omit-frame-pointer -fno-common"
+    CFLAGS_UBSAN="-fsanitize=undefined"
+    OVN_CFLAGS="${OVN_CFLAGS} ${CFLAGS_UBSAN}"
 fi
 
 if [ "$CC" = "clang" ]; then
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 7b3648116..b24bc7a3b 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -21,6 +21,7 @@ jobs:
       OPTS:        ${{ matrix.opts }}
       TESTSUITE:   ${{ matrix.testsuite }}
       ASAN:        ${{ matrix.asan }}
+      UBSAN:       ${{ matrix.ubsan }}
 
     name: linux ${{ join(matrix.*, ' ') }}
     runs-on: ubuntu-20.04
@@ -41,6 +42,9 @@ jobs:
           - compiler:     clang
             testsuite:    test
             asan:         asan
+          - compiler:     clang
+            testsuite:    test
+            ubsan:        ubsan
 
           - compiler:     gcc
             testsuite:    test
diff --git a/ovs b/ovs
index d94cd0d3e..d7c0b90fa 160000
--- a/ovs
+++ b/ovs
@@ -1 +1 @@
-Subproject commit d94cd0d3eec33e4290d7ca81918f5ac61444886e
+Subproject commit d7c0b90fa360a694f0f3b4f4ce1c514fec4e4359
diff --git a/tests/atlocal.in b/tests/atlocal.in
index eb80cbd1b..d2edea4ea 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -214,6 +214,11 @@ export OVS_CTL_TIMEOUT
 ASAN_OPTIONS=detect_leaks=1:abort_on_error=true:log_path=asan:$ASAN_OPTIONS
 export ASAN_OPTIONS
 
+# Add some default flags for UndefinedBehaviorSanitizer, if it was used
+# for the build.
+UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=true:log_path=ubsan:$UBSAN_OPTIONS
+export UBSAN_OPTIONS
+
 # Check whether we should run ddlog tests.
 if test '@DDLOGLIBDIR@' != no; then
     TEST_DDLOG="yes"
diff --git a/tests/automake.mk b/tests/automake.mk
index a5934d2b9..9733e8fa0 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -81,6 +81,7 @@ check-local:
        set $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH); \
        "$$@" $(TESTSUITEFLAGS) || \
        (test -z "$$(find $(TESTSUITE_DIR) -name 'asan.*')" && \
+        test -z "$$(find $(TESTSUITE_DIR) -name 'ubsan.*')" && \
         test X'$(RECHECK)' = Xyes && "$$@" --recheck)
 
 # Python Coverage support.
diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at
index 0482b7f5b..09c05cf16 100644
--- a/tests/ovs-macros.at
+++ b/tests/ovs-macros.at
@@ -233,6 +233,11 @@ ovs_cleanup() {
         cat asan.*
         AT_FAIL_IF([:])
     fi
+    if test "$(echo ubsan.*)" != 'ubsan.*'; then
+        echo "Undefined Behavior Sanitizer reported errors in:" ubsan.*
+        cat ubsan.*
+        AT_FAIL_IF([:])
+    fi
 }
 
 ovs_wait () {
-- 
2.27.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to