Compare commits
No commits in common. "c8-stream-1_fileformat_v6" and "c0c465de23e9701521b871c3944b65fa322d1938" have entirely different histories.
c8-stream-
...
c0c465de23
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
SOURCES/libpmemobj-cpp-1.13.0.tar.gz
|
SOURCES/libpmemobj-cpp-1.13.0.tar.gz
|
||||||
|
/libpmemobj-cpp-1.13.0.tar.gz
|
||||||
|
@ -1 +1 @@
|
|||||||
25d601e0140f3d8db94edb19902826a6b91286e4 SOURCES/libpmemobj-cpp-1.13.0.tar.gz
|
25d601e0140f3d8db94edb19902826a6b91286e4 libpmemobj-cpp-1.13.0.tar.gz
|
||||||
|
69
0001-vector-Fix-undefined-behaviour-on-realloc.patch
Normal file
69
0001-vector-Fix-undefined-behaviour-on-realloc.patch
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
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
|
||||||
|
|
73
0002-vector-fix-referencing-empty-array-rhel90.patch
Normal file
73
0002-vector-fix-referencing-empty-array-rhel90.patch
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
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
|
||||||
|
|
6
gating.yaml
Normal file
6
gating.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
--- !Policy
|
||||||
|
product_versions:
|
||||||
|
- rhel-9
|
||||||
|
decision_context: osci_compose_gate
|
||||||
|
rules:
|
||||||
|
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
|
4
libpmemobj-cpp.rpmlintrc
Normal file
4
libpmemobj-cpp.rpmlintrc
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# SPELLING ERRORS
|
||||||
|
|
||||||
|
addFilter(r'spelling-error .* en_US (libpmemobj|transactional)')
|
||||||
|
addFilter(r'spelling-error .*\(en_US\) (libpmemobj|transactional)')
|
1
sources
Normal file
1
sources
Normal file
@ -0,0 +1 @@
|
|||||||
|
SHA512 (libpmemobj-cpp-1.13.0.tar.gz) = 3968ab725fc439dd00638fd3306d8e9229bb36bf9cfa3faf97a78e41ef05293deff1e4f147f6b4c0a6164f7d153cb21764617b5a39bf4164a6b325d620cf1441
|
1
tests/.fmf/version
Normal file
1
tests/.fmf/version
Normal file
@ -0,0 +1 @@
|
|||||||
|
1
|
12
tests/libpmemobj-test-installed-libs.patch
Normal file
12
tests/libpmemobj-test-installed-libs.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
--- libpmemobj-cpp-1.12/CMakeLists.txt.orig 2021-08-04 11:05:28.909569992 -0400
|
||||||
|
+++ libpmemobj-cpp-1.12/CMakeLists.txt 2021-08-04 11:06:02.922687943 -0400
|
||||||
|
@@ -272,9 +272,6 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/libpmemobj++/cmake)
|
||||||
|
|
||||||
|
|
||||||
|
-# set up project's include dir (our source 'include' dir)
|
||||||
|
-include_directories(include)
|
||||||
|
-
|
||||||
|
# Run checks for known issues, it's required to enable/disable some tests and examples.
|
||||||
|
# It has to be executed (included) here, when environment is fully set up,
|
||||||
|
# all packages are found and all paths/variables are set.
|
5
tests/provision.fmf
Normal file
5
tests/provision.fmf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
standard-inventory-qcow2:
|
||||||
|
qemu:
|
||||||
|
m: 2G
|
16
tests/run_test.sh
Normal file
16
tests/run_test.sh
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
NRCPUS=$(getconf _NPROCESSORS_ONLN)
|
||||||
|
patchfile="$PWD/libpmemobj-test-installed-libs.patch"
|
||||||
|
|
||||||
|
cd source
|
||||||
|
|
||||||
|
patch -p1 < $patchfile
|
||||||
|
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake .. -DTESTS_USE_VALGRIND=OFF -DTESTS_LONG=OFF -DTESTS_USE_FORCED_PMEM=ON
|
||||||
|
make -j $NRCPUS
|
||||||
|
|
||||||
|
ctest --output-on-failure
|
24
tests/tests.yml
Normal file
24
tests/tests.yml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
- hosts: localhost
|
||||||
|
roles:
|
||||||
|
- role: standard-test-source
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
- role: standard-test-basic
|
||||||
|
tags:
|
||||||
|
- atomic
|
||||||
|
- classic
|
||||||
|
required_packages:
|
||||||
|
- libpmemobj-devel
|
||||||
|
- libpmemobj++-devel
|
||||||
|
- gcc-c++
|
||||||
|
- cmake
|
||||||
|
- make
|
||||||
|
- glibc-devel
|
||||||
|
- pkgconfig
|
||||||
|
- doxygen
|
||||||
|
- gdb
|
||||||
|
- perl-Encode
|
||||||
|
tests:
|
||||||
|
- regression: # Run tests
|
||||||
|
dir: .
|
||||||
|
run: ./run_test.sh
|
Loading…
Reference in New Issue
Block a user