diff options
Diffstat (limited to 'external/mdds')
-rw-r--r-- | external/mdds/0001-cid-1546160-COPY_INSTEAD_OF_MOVE.patch.1 | 62 | ||||
-rw-r--r-- | external/mdds/UnpackedTarball_mdds.mk | 3 | ||||
-rw-r--r-- | external/mdds/gcc-12-silence-use-after-free.patch.1 | 42 | ||||
-rw-r--r-- | external/mdds/use-after-free.patch | 12 |
4 files changed, 119 insertions, 0 deletions
diff --git a/external/mdds/0001-cid-1546160-COPY_INSTEAD_OF_MOVE.patch.1 b/external/mdds/0001-cid-1546160-COPY_INSTEAD_OF_MOVE.patch.1 new file mode 100644 index 000000000000..9c47e1d22767 --- /dev/null +++ b/external/mdds/0001-cid-1546160-COPY_INSTEAD_OF_MOVE.patch.1 @@ -0,0 +1,62 @@ +From f7d8d7eaf2b4160354887ac740a1efed9b6fc23b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolan.mcnamara@collabora.com> +Date: Sun, 14 Jan 2024 21:03:12 +0000 +Subject: [PATCH] cid#1546160 COPY_INSTEAD_OF_MOVE + +and + +cid#1545547 COPY_INSTEAD_OF_MOVE +cid#1545642 COPY_INSTEAD_OF_MOVE +cid#1557206 COPY_INSTEAD_OF_MOVE +--- + include/mdds/flat_segment_tree.hpp | 2 +- + include/mdds/flat_segment_tree_def.inl | 6 +++--- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/include/mdds/flat_segment_tree.hpp b/include/mdds/flat_segment_tree.hpp +index bf8e0956..317eb279 100644 +--- a/include/mdds/flat_segment_tree.hpp ++++ b/include/mdds/flat_segment_tree.hpp +@@ -767,7 +767,7 @@ private: + { + node_ptr next_node = cur_node->next; + disconnect_all_nodes(cur_node.get()); +- cur_node = next_node; ++ cur_node = std::move(next_node); + } + last_node->next = end_node; + end_node->prev = last_node; +diff --git a/include/mdds/flat_segment_tree_def.inl b/include/mdds/flat_segment_tree_def.inl +index 76350656..d07cae82 100644 +--- a/include/mdds/flat_segment_tree_def.inl ++++ b/include/mdds/flat_segment_tree_def.inl +@@ -114,7 +114,7 @@ + // Move on to the next destination node, and have the next node point + // back to the previous node. + node_ptr old_node = dest_node; +- dest_node->next->prev = old_node; ++ dest_node->next->prev = std::move(old_node); + dest_node = dest_node->next; + + if (src_node == r.m_right_leaf.get()) +@@ -380,7 +380,7 @@ + + p = get_insertion_pos_leaf(start_key, p); + node_ptr start_pos(const_cast<node*>(p)); +- return insert_to_pos(start_pos, start_key, end_key, val); ++ return insert_to_pos(std::move(start_pos), start_key, end_key, val); + } + + template<typename Key, typename Value> +@@ -456,7 +456,7 @@ + last_seg_value = node_pos->value_leaf.value; + node_ptr next = node_pos->next; + disconnect_all_nodes(node_pos.get()); +- node_pos = next; ++ node_pos = std::move(next); + } + + start_pos->value_leaf.value = last_seg_value; +-- +2.42.0 + diff --git a/external/mdds/UnpackedTarball_mdds.mk b/external/mdds/UnpackedTarball_mdds.mk index c015f4c13f5a..ce1ba745be43 100644 --- a/external/mdds/UnpackedTarball_mdds.mk +++ b/external/mdds/UnpackedTarball_mdds.mk @@ -14,6 +14,9 @@ $(eval $(call gb_UnpackedTarball_set_tarball,mdds,$(MDDS_TARBALL))) $(eval $(call gb_UnpackedTarball_set_patchlevel,mdds,0)) $(eval $(call gb_UnpackedTarball_add_patches,mdds,\ + external/mdds/use-after-free.patch \ + external/mdds/gcc-12-silence-use-after-free.patch.1 \ + external/mdds/0001-cid-1546160-COPY_INSTEAD_OF_MOVE.patch.1 \ )) # vim: set noet sw=4 ts=4: diff --git a/external/mdds/gcc-12-silence-use-after-free.patch.1 b/external/mdds/gcc-12-silence-use-after-free.patch.1 new file mode 100644 index 000000000000..94f7ba979e61 --- /dev/null +++ b/external/mdds/gcc-12-silence-use-after-free.patch.1 @@ -0,0 +1,42 @@ +Workaround for gcc-toolset-12 on almalinux8 on a release/optimized build: +[build CXX] sc/source/core/data/column2.cxx +In file included from /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/flat_segment_tree.hpp:37, + from /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/sc/inc/columnspanset.hxx:16, + from /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/sc/inc/column.hxx:25, + from /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/sc/source/core/data/column2.cxx:20: +In function ‘void mdds::__st::intrusive_ptr_release(node<T>*) [with T = mdds::flat_segment_tree<int, bool>]’, + inlined from ‘boost::intrusive_ptr<T>::~intrusive_ptr() [with T = mdds::__st::node<mdds::flat_segment_tree<int, bool> >]’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/boost/boost/smart_ptr/intrusive_ptr.hpp:100:44, + inlined from ‘std::pair<mdds::flat_segment_tree<Key, Value>::const_iterator, bool> mdds::flat_segment_tree<Key, Value>::insert_segment_impl(key_type, key_type, value_type, bool) [with Key = int; Value = bool]’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/flat_segment_tree_def.inl:225:1: +/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/node.hpp:247:10: error: pointer used after ‘void operator delete(void*, std::size_t)’ [-Werror=use-after-free] + 247 | --p->refcount; + | ~~~^~~~~~~~ +In function ‘void mdds::__st::intrusive_ptr_release(node<T>*) [with T = mdds::flat_segment_tree<int, bool>]’, + inlined from ‘void mdds::__st::intrusive_ptr_release(node<T>*) [with T = mdds::flat_segment_tree<int, bool>]’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/node.hpp:245:13, + inlined from ‘boost::intrusive_ptr<T>::~intrusive_ptr() [with T = mdds::__st::node<mdds::flat_segment_tree<int, bool> >]’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/boost/boost/smart_ptr/intrusive_ptr.hpp:100:44, + inlined from ‘std::pair<mdds::flat_segment_tree<Key, Value>::const_iterator, bool> mdds::flat_segment_tree<Key, Value>::insert_segment_impl(key_type, key_type, value_type, bool) [with Key = int; Value = bool]’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/flat_segment_tree_def.inl:224:93: +/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/node.hpp:249:9: note: call to ‘void operator delete(void*, std::size_t)’ here + 249 | delete p; + | ^~~~~~~~ +cc1plus: all warnings being treated as errors + +diff -ur mdds.org/include/mdds/node.hpp mdds/include/mdds/node.hpp +--- mdds.org/include/mdds/node.hpp 2023-07-24 18:27:14.427139325 +0000 ++++ mdds/include/mdds/node.hpp 2023-07-24 18:26:54.554461294 +0000 +@@ -244,9 +244,15 @@ + template<typename T> + inline void intrusive_ptr_release(node<T>* p) + { +- --p->refcount; +- if (!p->refcount) ++#if defined __GNUC__ && __GNUC__ == 12 && __GNUC_MINOR__ <= 3 && !defined __clang__ ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wuse-after-free" ++#endif ++ if(--p->refcount == 0) + delete p; ++#if defined __GNUC__ && __GNUC__ == 12 && __GNUC_MINOR__ <= 3 && !defined __clang__ ++#pragma GCC diagnostic pop ++#endif + } + + template<typename T> diff --git a/external/mdds/use-after-free.patch b/external/mdds/use-after-free.patch new file mode 100644 index 000000000000..981c945821a7 --- /dev/null +++ b/external/mdds/use-after-free.patch @@ -0,0 +1,12 @@ +--- include/mdds/flat_segment_tree_def.inl ++++ include/mdds/flat_segment_tree_def.inl +@@ -84,8 +84,8 @@ + // Move on to the next destination node, and have the next node point + // back to the previous node. + node_ptr old_node = dest_node; ++ dest_node->next->prev = old_node; + dest_node = dest_node->next; +- dest_node->prev = old_node; + + if (src_node == r.m_right_leaf.get()) + { |