Compare commits

...

No commits in common. "imports/c9/libpmemobj-cpp-1.12-8.el9" and "c8-stream-1_fileformat_v6" have entirely different histories.

5 changed files with 31 additions and 257 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/libpmemobj-cpp-1.12.tar.gz
SOURCES/libpmemobj-cpp-1.13.0.tar.gz

View File

@ -1 +1 @@
35d4c04f961caad179651464ce9dd0c54f36f0ac SOURCES/libpmemobj-cpp-1.12.tar.gz
25d601e0140f3d8db94edb19902826a6b91286e4 SOURCES/libpmemobj-cpp-1.13.0.tar.gz

View File

@ -1,69 +0,0 @@
From 41ddc88a80160050b0ac1a51cb258f8918edf9aa Mon Sep 17 00:00:00 2001
From: "Lucas A. M. Magalhaes" <lamm@linux.ibm.com>
Date: Wed, 23 Jun 2021 15:05:50 -0300
Subject: [PATCH] vector: Fix undefined behaviour on realloc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
On tests listed bellow the reserve method is being called before any
allocation on the object therefore realloc being called without
any previous allocation. Inside realloc _data is being used with the
operator '[]', as it is nullptr at that moment it's an undefined
behaviour.
This patch simply returns a call to alloc if _data is nullptr.
This tests fails on PowerPC with Segmentation Fault because of this
issue:
segment_vector_array_expsize_assign_exceptions_oom_0_none
segment_vector_array_expsize_assign_exceptions_oom_0_memcheck
segment_vector_array_expsize_capacity_exceptions_oom_0_none
segment_vector_array_expsize_capacity_exceptions_oom_0_memcheck
segment_vector_array_expsize_modifiers_exceptions_oom_0_none
segment_vector_array_expsize_modifiers_exceptions_oom_0_memcheck
segment_vector_vector_expsize_assign_exceptions_oom_0_none
segment_vector_vector_expsize_assign_exceptions_oom_0_memcheck
segment_vector_vector_expsize_capacity_exceptions_oom_0_none
segment_vector_vector_expsize_capacity_exceptions_oom_0_memcheck
segment_vector_vector_expsize_modifiers_exceptions_oom_0_none
segment_vector_vector_expsize_modifiers_exceptions_oom_0_memcheck
segment_vector_vector_fixedsize_assign_exceptions_oom_0_none
segment_vector_vector_fixedsize_assign_exceptions_oom_0_memcheck
Signed-off-by: Lucas A. M. Magalhães lamm@linux.ibm.com
---
include/libpmemobj++/container/vector.hpp | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/include/libpmemobj++/container/vector.hpp b/include/libpmemobj++/container/vector.hpp
index f430ed50..9810220b 100644
--- a/include/libpmemobj++/container/vector.hpp
+++ b/include/libpmemobj++/container/vector.hpp
@@ -2362,7 +2362,8 @@ vector<T>::internal_insert(size_type idx, InputIt first, InputIt last)
* Private helper function. Must be called during transaction. Allocates new
* memory for capacity_new number of elements and copies or moves old elements
* to new memory area. If the current size is greater than capacity_new, the
- * container is reduced to its first capacity_new elements.
+ * container is reduced to its first capacity_new elements. If was never
+ * allocated behaves as an alloc call.
*
* param[in] capacity_new new capacity.
*
@@ -2381,6 +2382,13 @@ vector<T>::realloc(size_type capacity_new)
{
assert(pmemobj_tx_stage() == TX_STAGE_WORK);
+ /*
+ * If _data == nullptr this object has never allocated any memory
+ * so we need to behave as alloc instead.
+ */
+ if (_data == nullptr)
+ return alloc(capacity_new);
+
/*
* XXX: future optimization: we don't have to snapshot data
* which we will not overwrite
--
2.27.0

View File

@ -1,73 +0,0 @@
diff --git a/include/libpmemobj++/container/vector.hpp b/include/libpmemobj++/container/vector.hpp
--- a/include/libpmemobj++/container/vector.hpp
+++ b/include/libpmemobj++/container/vector.hpp
@@ -668,7 +668,7 @@ vector<T>::assign(size_type count, const_reference value)
add_data_to_tx(0, size_old);
std::fill_n(
- &_data[0],
+ _data.get(),
(std::min)(count,
static_cast<size_type>(size_old)),
value);
@@ -1600,7 +1600,7 @@ vector<T>::insert(const_iterator pos, size_type count, const value_type &value)
single_element_iterator<value_type>(&value, count));
});
- return iterator(&_data[static_cast<difference_type>(idx)]);
+ return iterator(_data.get() + static_cast<difference_type>(idx));
}
/**
@@ -1843,7 +1843,7 @@ typename vector<T>::iterator
vector<T>::erase(const_iterator first, const_iterator last)
{
size_type idx = static_cast<size_type>(
- std::distance(const_iterator(&_data[0]), first));
+ std::distance(const_iterator(_data.get()), first));
size_type count = static_cast<size_type>(std::distance(first, last));
if (count == 0)
@@ -2306,10 +2306,11 @@ vector<T>::internal_insert(size_type idx, InputIt first, InputIt last)
auto count = static_cast<size_type>(std::distance(first, last));
if (_capacity >= size() + count) {
- pointer dest =
- &_data[static_cast<difference_type>(size() + count)];
- pointer begin = &_data[static_cast<difference_type>(idx)];
- pointer end = &_data[static_cast<difference_type>(size())];
+ pointer dest = _data.get() +
+ static_cast<difference_type>(size() + count);
+ pointer begin = _data.get() + static_cast<difference_type>(idx);
+ pointer end =
+ _data.get() + static_cast<difference_type>(size());
add_data_to_tx(idx, size() - idx + count);
@@ -2327,9 +2328,11 @@ vector<T>::internal_insert(size_type idx, InputIt first, InputIt last)
auto old_data = _data;
auto old_size = _size;
- pointer old_begin = &_data[0];
- pointer old_mid = &_data[static_cast<difference_type>(idx)];
- pointer old_end = &_data[static_cast<difference_type>(size())];
+ pointer old_begin = _data.get();
+ pointer old_mid =
+ _data.get() + static_cast<difference_type>(idx);
+ pointer old_end =
+ _data.get() + static_cast<difference_type>(size());
_data = nullptr;
_size = _capacity = 0;
@@ -2397,7 +2400,7 @@ vector<T>::realloc(size_type capacity_new)
auto old_data = _data;
auto old_size = _size;
- pointer old_begin = &_data[0];
+ pointer old_begin = _data.get();
pointer old_end = capacity_new < _size
? &_data[static_cast<difference_type>(capacity_new)]
: &_data[static_cast<difference_type>(size())];
--
2.27.0

View File

@ -1,10 +1,9 @@
%global __cmake_in_source_build 1
%global min_libpmemobj_ver 1.9
%global upstreamversion 1.12
%global min_libpmemobj_ver 1.11.1
%global upstreamversion 1.13.0
Name: libpmemobj-cpp
Version: 1.12
Release: 8%{?dist}
Version: 1.13.0
Release: 1%{?dist}
Summary: C++ bindings for libpmemobj
# Note: tests/external/libcxx is dual licensed using University of Illinois "BSD-Like" license and the MIT license. It's used only during development/testing and is NOT part of the binary RPM.
License: BSD
@ -12,9 +11,6 @@ URL: http://pmem.io/pmdk/cpp_obj/
Source0: https://github.com/pmem/%{name}/archive/%{upstreamversion}.tar.gz#/%{name}-%{upstreamversion}.tar.gz
Patch0: 0001-vector-Fix-undefined-behaviour-on-realloc.patch
Patch1: 0002-vector-fix-referencing-empty-array-rhel90.patch
BuildRequires: libpmemobj-devel >= %{min_libpmemobj_ver}
BuildRequires: cmake >= 3.3
BuildRequires: glibc-devel
@ -22,16 +18,7 @@ BuildRequires: gcc-c++
BuildRequires: pkgconfig
BuildRequires: doxygen
BuildRequires: perl-Encode
BuildRequires: gdb
BuildRequires: libatomic
# RHEL does not ship SFML-devel. The library is only used for the pmpong
# example program, so the library can be built without this dependency,
# and without losing any features.
%if !0%{?rhel}
BuildRequires: SFML-devel
%endif
BuildRequires: make
BuildRequires: libatomic
# There's nothing x86-64 specific in this package, but we have
# to duplicate what spec for pmdk/libpmemobj has at the moment.
@ -40,7 +27,7 @@ BuildRequires: make
# https://bugzilla.redhat.com/show_bug.cgi?id=1340635
# https://bugzilla.redhat.com/show_bug.cgi?id=1340636
# https://bugzilla.redhat.com/show_bug.cgi?id=1340637
ExclusiveArch: x86_64 ppc64le
ExclusiveArch: x86_64
%description
This package contains header files for libpmemobj C++ bindings and C++
@ -99,15 +86,13 @@ HTML documentation for libpmemobj++.
%global debug_package %{nil}
%prep
%setup -q -n libpmemobj-cpp-%{upstreamversion}
%patch0 -p1
%patch1 -p1
%setup -q
%build
mkdir build
cd build
# CXX_STANDARD=17 matters only for tests, it can be safely disabled in distros without c++17-compliant compiler
%cmake .. -DCMAKE_INSTALL_DOCDIR=%{_docdir}/libpmemobj++ -DBUILD_TESTS=off -DCXX_STANDARD=17
%cmake .. -DCMAKE_INSTALL_DOCDIR=%{_docdir}/libpmemobj++ -DBUILD_TESTS=off -DCXX_STANDARD=17 -DTESTS_USE_VALGRIND=OFF
%make_build
%install
@ -115,99 +100,30 @@ cd build
%make_install
%changelog
* Mon Feb 28 2022 Bryan Gurney <bgurney@redhat.com> - 1.12-8
- Apply patch to fix undefined behavior on realloc
- Also add and apply patch to fix referencing empty array
- Related: rhbz#2034641
* Mon Nov 21 2022 Bryan Gurney <bgurney@redhat.com> - 1.13.0-1
- Update to version 1.13.0
- Related: rhbz#2111428
* Mon Jan 24 2022 Bryan Gurney <bgurney@redhat.com> - 1.12-7
- Add patch to fix undefined behavior on realloc
- Related: rhbz#2034641
* Thu Mar 10 2022 Bryan Gurney <bgurney@redhat.com> - 1.11-2
- Add libatomic to BuildRequires
- Related: rhbz#2061720
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.12-6
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Wed Jan 26 2022 Bryan Gurney <bgurney@redhat.com> - 1.11-1
- Update to upstream version 1.11
- Related: rhbz#2009889
* Mon Aug 2 2021 Jeff Moyer <jmoyer@redhat.com> - 1.12-5.el9
- Get rid of BuildRequires that are only used for testing (Jeff Moyer)
- Resolves: rhbz#1984934
* Mon Feb 1 2021 Jeff Moyer <jmoyer@redhat.com> - 1.9-1
- Update to upstream version 1.9
- get rid of % check, as the builtin tests now require packages we don't ship.
- Related: rhbz#1780389
* Wed Jun 9 2021 Jeff Moyer <jmoyer@redhat.com> - 1.12-4.el9
- Disable make check
- Resolves: rhbz#1970104
* Tue Jun 18 2019 Jeff Moyer <jmoyer@redhat.com> - 1.6-2.el8
- new build to kick off gating tests
- Related: rhbz#1659659
* Wed Jun 9 2021 Jeff Moyer <jmoyer@redhat.com> - 1.12-3.el9
- Enable ppc64le builds
- Resolves: rhbz#1871149
* Mon Jun 17 2019 Jeff Moyer <jmoyer@redhat.com> - 1.6-1.el8
- initial RHEL8 import
- Resolves: rhbz#1659659
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1.12-2
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Mon Feb 15 2021 Adam Borowski <kilobyte@angband.pl> - 1.12-1
- Update to version 1.12.
* Thu Feb 11 2021 Adam Borowski <kilobyte@angband.pl> - 1.11-4
- Make SFML-devel buildrequires dependent on !rhel (jmoyer)
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.11-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Nov 04 2020 Jeff Law <law@redhat.com> - 1.11-2
- Add libatomic to buildrequires
* Fri Oct 9 2020 Adam Borowski <kilobyte@angband.pl> - 1.11-1
- Update to version 1.11.
- Disable enumerable_thread_specific_access_0_drd
- Fix internal find in radix_tree
* Mon Aug 31 2020 Adam Borowski <kilobyte@angband.pl> - 1.10-1
- Update to version 1.10.
* Mon Aug 31 2020 Adam Borowski <kilobyte@angband.pl> - 1.9-5
- Fix FTBFS with new libunwind.
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.9-4
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.9-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jul 24 2020 Jeff Law <law@redhat.com> - 1.9-2
- Use __cmake_in_source_build
* Wed Feb 12 2020 Marcin Ślusarz <marcin.slusarz@intel.com> - 1.9-1
- Update to version 1.9.
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Mon Jan 27 2020 Marcin Ślusarz <marcin.slusarz@intel.com> - 1.8.1-1
- Update to version 1.8.1.
* Fri Oct 04 2019 Marcin Ślusarz <marcin.slusarz@intel.com> - 1.8-2
- Work around https://github.com/pmem/libpmemobj-cpp/issues/469.
* Fri Oct 04 2019 Marcin Ślusarz <marcin.slusarz@intel.com> - 1.8-1
- Update to version 1.8.
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Wed Jun 26 2019 Marcin Ślusarz <marcin.slusarz@intel.com> - 1.7-1
- Update to version 1.7.
* Thu Mar 28 2019 Marcin Ślusarz <marcin.slusarz@intel.com> - 1.6-2
- Bump required PMDK version to 1.6.
* Mon Mar 18 2019 Marcin Ślusarz <marcin.slusarz@intel.com> - 1.6-1
- Update to version 1.6
* Fri Mar 08 2019 Marcin Ślusarz <marcin.slusarz@intel.com> - 1.5.1-1
- Update to version 1.5.1
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Dec 14 2018 Marcin Ślusarz <marcin.slusarz@intel.com> - 1.5-1
* Thu Nov 8 2018 Marcin Ślusarz <marcin.slusarz@intel.com> - 1.5-1
- Initial RPM release