Bug#892288: arrayfire FTBFS on i386: test segfaults

2018-08-02 Thread Bernhard Übelacker
Hello,
tried to reproduce this, but unfortunately it fails to build against
gcc-8, for which #897707 is already open.

Therefore tried to reproduce it with gcc-7.
I think this is what happens:

- test Asssign_LinearAssignGenSeq_Test::TestBody allocates a buffer
- buffer gets deleted
- the same buffer gets deleted again - therefore in the linked list we
  have now an entry that points to itself.
- test allocates again and receives the twice deleted buffer and
  writes a value to it - therefore the first entry in the linked list
  is our already allocated buffer and the next pointer points to the
  value the test has written before.
- next allocation crashes because the next pointer contains no valid
  address.


(gdb) bt
#0  0xb6abce2a in tcache_put (tc_idx=5, chunk=0x5fd798) at malloc.c:2932
#1  _int_free (av=0xb6c1b7a0 , p=0x5fd798, have_lock=0) at 
malloc.c:4173
#2  0xb6cd1668 in operator delete (ptr=0x5fd7a0) at 
../../../../src/libstdc++-v3/libsupc++/del_op.cc:49
#3  0xb6e65477 in cpu::destroyArray (A=0x5fd7a0) at 
./src/backend/cpu/Array.cpp:223
#4  0xb77f7a6e in releaseHandle (arr=0x5fd7a0) at 
./src/api/c/handle.hpp:109
#5  af_release_array (arr=0x5fd7a0) at ./src/api/c/array.cpp:189
#6  0xb78625d5 in af_assign_seq (out=0xb328, lhs=0x5faea0, ndims=, index=0x5fd800, rhs=) at ./src/api/c/assign.cpp:135
#7  0xb7865bd7 in af_assign_gen (out=0xb328, lhs=0x5faea0, ndims=1, 
indexs=0xb35c, rhs_=0x5fae20) at ./src/api/c/assign.cpp:223
#8  0x00429b7c in Asssign_LinearAssignGenSeq_Test::TestBody (this=0x5faf90) at 
./test/assign.cpp:926
#9  0x00563605 in 
testing::internal::HandleSehExceptionsInMethodIfSupported 
(location=0x574590 "the test body", method= testing::Test::TestBody(), 
object=0x5faf90) at /usr/src/gtest/src/gtest.cc:2402
#10 testing::internal::HandleExceptionsInMethodIfSupported 
(object=0x5faf90, method= testing::Test::TestBody(), location=0x574590 
"the test body") at /usr/src/gtest/src/gtest.cc:2438
#11 0x00557c0e in testing::Test::Run (this=this@entry=0x5faf90) at 
/usr/src/gtest/src/gtest.cc:2474
#12 0x00557ed4 in testing::Test::Run (this=0x5faf90) at 
/usr/src/gtest/src/gtest.cc:2466
#13 testing::TestInfo::Run (this=0x5f9410) at /usr/src/gtest/src/gtest.cc:2656
#14 0x00558087 in testing::TestInfo::Run (this=) at 
/usr/src/gtest/src/gtest.cc:2631
#15 testing::TestCase::Run (this=0x5f9230) at /usr/src/gtest/src/gtest.cc:2776
#16 0x00558695 in testing::TestCase::Run (this=) at 
/usr/src/gtest/src/gtest.cc:2762
#17 testing::internal::UnitTestImpl::RunAllTests (this=) at 
/usr/src/gtest/src/gtest.cc:4651
#18 0x0055889d in 
testing::internal::HandleSehExceptionsInMethodIfSupported (location=0x573adc "auxiliary test code (environments or event 
listeners)", method=, object=0x5ddc60) at 
/usr/src/gtest/src/gtest.cc:2402
#19 
testing::internal::HandleExceptionsInMethodIfSupported (location=0x573adc "auxiliary test code (environments or event 
listeners)", method=(bool 
(testing::internal::UnitTestImpl::*)(testing::internal::UnitTestImpl * const)) 
0x5581f0 , object=0x5ddc60) at 
/usr/src/gtest/src/gtest.cc:2438
#20 testing::UnitTest::Run (this=0x5c91e0 
) at 
/usr/src/gtest/src/gtest.cc:4259
#21 0x00423f1a in RUN_ALL_TESTS () at /usr/src/gtest/include/gtest/gtest.h:2233
#22 main (argc=, argv=0xb654) at 
/usr/src/gtest/src/gtest_main.cc:37



> Whatever broke it was not yet in unstable on 2017-12-31,
> but likely entered buster before 2018-01-31:

Was that probably the time as buster switched to libstdc++6 from gcc-8 ?
(But did still have gcc-7 as default compile?)


Built the package with "DEB_BUILD_MAINT_OPTIONS = hardening=+all 
sanitize=+address"
But then Test_assign_cpu succeeded, but tests 43 and 78 failed.


Nevertheless, because gcc-8 is default in buster this report
should probably be marked as blocked by #897707 ?


Kind regards,
Bernhard



# with MEMORY="-m 14G", SMP="-smp 16"



apt update

apt install devscripts dpkg-dev mc htop gcc-7 g++-7 gdb valgrind 
libstdc++6-8-dbg

apt install cmake libboost-dev libblas-dev libclblas-dev libclfft-dev 
libfftw3-dev libfreeimage-dev libgtest-dev liblapack-dev liblapacke-dev 
ocl-icd-opencl-dev pkg-config doxygen

mkdir -p glibc/orig; cd glibc/orig
apt source libc6
cd ../..

mkdir -p gcc-8/orig; cd gcc-8/orig
apt source libstdc++6
cd gcc-8-8.2.0; tar axf gcc-8.2.0-dfsg.tar.xz; cd ..
cd ../..

mkdir -p arrayfire/orig; cd arrayfire/orig
dget 
http://192.168.178.25:/debian-unstable-ftp.de.debian.org/pool/main/a/arrayfire/arrayfire_3.3.2+dfsg1-4.dsc
# 
http://http.debian.net/debian/pool/main/a/arrayfire/arrayfire_3.3.2+dfsg1-4.dsc
cd arrayfire-3.3.2+dfsg1


CC=gcc-7 CXX=g++-7 dpkg-buildpackage -uc
CC=gcc-7 CXX=g++-7 DEB_BUILD_OPTIONS=parallel=16 dpkg-buildpackage -uc -nc



cd obj-i686-linux-gnu/test
$ gdb -q --args ./assign_cpu
set height 0
set width 0
set pagination off
directory /home/benutzer/glibc/orig/glibc-2.27/malloc
directory /home/benutzer/gcc-8/orig/gcc-8-8.2.0/gcc-8.2.0/libstdc++-v3/libsupc++
directory 

Bug#892288: arrayfire FTBFS on i386: test segfaults

2018-03-07 Thread Adrian Bunk
Source: arrayfire
Version: 3.3.2+dfsg1-4
Severity: serious
Tags: buster sid

https://tests.reproducible-builds.org/debian/rb-pkg/unstable/i386/arrayfire.html

...
98% tests passed, 2 tests failed out of 95

Total Test time (real) =  53.16 sec

The following tests FAILED:
  4 - Test_assign_cpu (SEGFAULT)
 43 - Test_index_cpu (SEGFAULT)
Errors while running CTest
Makefile:143: recipe for target 'test' failed
make[2]: *** [test] Error 8


Whatever broke it was not yet in unstable on 2017-12-31,
but likely entered buster before 2018-01-31:
https://tests.reproducible-builds.org/debian/history/arrayfire.html