As privately reported by Aaron Conole, and by Jeffrey Walton [0] there's currently a number of undefined behavior instances in the OVS code base. Running the OVS (and OVN) tests with UBSan [1] enabled uncovers these.
This series fixes the issues reported by UBSan and, through the last patch, enables UBSan tests in GitHub Actions CI. [0] https://mail.openvswitch.org/pipermail/ovs-dev/2022-January/390894.html [1] https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html [2] https://patchwork.ozlabs.org/project/openvswitch/list/?series=286494&state=* Changes in v6: - Rebased. - Added acks from Aaron and/or Adrian to patches 3, 4, 5. - Added a new patch, 6/7, addressing another UB instance spotted when running system tests. - Addresses Aaron's comments on patch 2. Changes in v5: - Rebased, dropped patch 'util: Avoid UB when iterating collections.', the proper fix from Adrian was accepted. - Addressed Adrian's comments. Changes in v4: - Rebased, dropping patches that were already applied. - Addressed Ilya's comments. - Added acks from Paolo from v3 as nothing major changed in this revision. - Rephrased the commit message for "util: Avoid UB when iterating collections." Changes in v3: - Added acks to the patches acked by Aaron. - Addressed Aaron's comments. - Split previous patch 07/11 "ofp-actions: ofp-errors: Use aligned structures when decoding ofp actions." into three separate patches addressing independent issues. - Reordered patches such that the ones that might need follow up are towards the end of the series. - Added a new patch, patch 13/14, fixing a typo in the CFLAGS_ASAN variables in the script used for building OVS in CI. This typo was originally copy/pasted in the CFLAGS_UBSAN flags in v1 and v2 of this series. Changes in v2: - Patch 3/11: - Remove cache line size aligment markers instead, as suggested by Ilya. Dumitru Ceara (7): treewide: Fix invalid bit shift operations. treewide: Avoid offsetting NULL pointers. ofp-actions: Ensure aligned accesses to masked fields. ofp-errors: Ensure parsed OFPT_ERROR messages are properly aligned. ofp-actions: Use aligned structures when decoding ofp actions. netdev-linux: Properly access 32-bit aligned rtnl_link_stats64 structs. ci: Add UB Sanitizer. .ci/linux-build.sh | 6 ++ .github/workflows/build-and-test.yml | 5 ++ configure.ac | 1 include/openvswitch/ofp-actions.h | 15 +++-- include/openvswitch/ofpbuf.h | 24 ++++++- include/openvswitch/util.h | 3 + lib/dpif-netlink.c | 2 - lib/dynamic-string.c | 8 ++ lib/meta-flow.c | 4 + lib/netdev-linux.c | 9 ++- lib/ofp-actions.c | 111 ++++++++++++++++++++++++++-------- lib/ofp-errors.c | 2 + lib/ofpbuf.c | 43 +++++++++++++ lib/ovsdb-data.c | 37 ++++++----- lib/ovsdb-data.h | 4 + lib/sset.c | 4 + lib/tnl-ports.c | 2 - ofproto/ofproto-dpif-xlate.c | 3 + ofproto/ofproto.c | 2 - tests/atlocal.in | 16 +++++ tests/automake.mk | 1 tests/daemon.at | 8 ++ tests/ovs-macros.at | 5 ++ tests/ovs-ofctl.at | 2 - tests/ovsdb-server.at | 16 +++++ tests/test-hash.c | 3 + tests/test-util.c | 13 ++-- 27 files changed, 279 insertions(+), 70 deletions(-) _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev