[Debian-med-packaging] Bug#917851: seqan2 2.4.0+dfsg-9: FTBFS, alignment problem

Steve McIntyre steve at einval.com
Mon Dec 31 02:45:40 GMT 2018


Source: seqan2
Version: 2.4.0+dfsg-9
Severity: important
User: debian-arm at lists.debian.org
Usertags: alignment

Hi!

I've been doing a full rebuild of the Debian archive, building all
source packages targeting armel and armhf using arm64 hardware. We are
planning in future to move all of our 32-bit armel/armhf builds to
using arm64 machines, so this rebuild is to identify packages that
might have problems with this configuration.

A feature of the arm64 kernel is that it does *not* support fixing up
code with broken alignment, so code that might have built and run OK
on our older armel/armhf build machines due to kernel fixups will now
fail.

When building your package, I've found a bus error (aka alignment
fault). The full log is online at

  https://www.einval.com/debian/arm/rebuild-logs/armel/FAIL/seqan2_2.4.0+dfsg-9_armel.log

for reference

I've done a quick bit of debugging to find the source of the
bug. Here's a gdb stacktrace and variable printout to demonstrate the
problem.

(sid-armel)steve at mjolnir:~/debian/build/seqan2/seqan2-2.4.0+dfsg$ gdb obj-arm-linux-gnueabi/bin/test_index_fm_rank_dictionary obj-arm-linux-gnueabi/tests/index/core
...
Core was generated by `/home/steve/debian/build/seqan2/seqan2-2.4.0+dfsg/obj-arm-linux-gnueabi/bin/tes'.
Program terminated with signal SIGBUS, Bus error.
#0  0x00bf7d24 in seqan::_getWordRank<bool, void, seqan::LevelsRDConfig<unsigned int, seqan::Alloc<void>, 2u, 2u>, unsigned long long, unsigned int> (
    word=@0x234df2a: 6741939070857683030, c=true, posInWord=63) at ./include/seqan/misc/bit_twiddling.h:346
346     _popCountImpl(TWord word, WordSize_<64> const & /*tag*/)
(gdb) bt
#0  0x00bf7d24 in seqan::_getWordRank<bool, void, seqan::LevelsRDConfig<unsigned int, seqan::Alloc<void>, 2u, 2u>, unsigned long long, unsigned int> (
    word=@0x234df2a: 6741939070857683030, c=true, posInWord=63) at ./include/seqan/misc/bit_twiddling.h:346
#1  seqan::_getWordRank<bool, void, seqan::LevelsRDConfig<unsigned int, seqan::Alloc<void>, 2u, 2u>, unsigned long long> (dict=..., word=@0x234df2a: 6741939070857683030, 
    c=true) at ./include/seqan/index/index_fm_rank_dictionary_levels.h:1139
#2  seqan::_getValueRank<bool, void, seqan::LevelsRDConfig<unsigned int, seqan::Alloc<void>, 2u, 2u>, seqan::Tuple<seqan::Tuple<bool, 64u, seqan::BitPacked<16u, 16u> >, 2u, void>, unsigned int> (c=true, dict=..., posInBlock=127, values=...) at ./include/seqan/index/index_fm_rank_dictionary_levels.h:1261
#3  seqan::_getValuesRanks<void, seqan::LevelsRDConfig<unsigned int, seqan::Alloc<void>, 2u, 2u>, unsigned int> (pos=<optimized out>, dict=...)
    at ./include/seqan/index/index_fm_rank_dictionary_levels.h:1349
#4  seqan::updateRanks<bool, void, seqan::LevelsRDConfig<unsigned int, seqan::Alloc<void>, 2u, 2u> > (dict=...) at ./include/seqan/index/index_fm_rank_dictionary_levels.h:1711
#5  seqan::createRankDictionary<bool, seqan::Levels<void, seqan::LevelsRDConfig<unsigned int, seqan::Alloc<void>, 2u, 2u> >, seqan::String<bool, seqan::Alloc<void> > > (
    dict=..., text=...) at ./include/seqan/index/index_fm_rank_dictionary_base.h:268
#6  0x00bf8cfc in seqan::RankDictionary<bool, seqan::Levels<void, seqan::LevelsRDConfig<unsigned int, seqan::Alloc<void>, 2u, 2u> > >::RankDictionary<seqan::String<bool, seqan::Alloc<void> > > (text=..., this=0xffd11048) at ./include/seqan/index/index_fm_rank_dictionary_levels.h:430
#7  RankDictionaryTest__Constructor<seqan::RankDictionary<bool, seqan::Levels<void, seqan::LevelsRDConfig<unsigned int, seqan::Alloc<void>, 2u, 2u> > > >::runTest (
    this=0x232df30) at ./tests/index/test_index_fm_rank_dictionary.cpp:186
#8  0x00bc2074 in seqan::TestSystem::runAll () at /usr/include/c++/8/bits/unique_ptr.h:342
#9  0xf783a474 in __libc_start_main (main=0xffd11244, argc=-141082624, argv=0xf783a474 <__libc_start_main+268>, init=<optimized out>, fini=0xc45368 <__libc_csu_fini>, 
    rtld_fini=0xf7c9e66c <_dl_fini>, stack_end=0xffd11244) at libc-start.c:308
#10 0x00bb40ac in _start () at ./include/seqan/basic/debug_test_system.h:502
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) list
341     // GCC or CLANG implementations.
342     // SSE4.2 popcnt is emitted when compiling with -mpopcnt or -march=corei7
343
344     template <typename TWord>
345     inline unsigned
346     _popCountImpl(TWord word, WordSize_<64> const & /*tag*/)
347     {
348         return __builtin_popcountll(static_cast<uint64_t>(word));
349     }
350
(gdb) p word
$1 = (const unsigned long long &) @0x234df2a: 6741939070857683030

This is classic buggy code for alignment faults - simply casting a
uint64_t over the unaligned address 0x234df2a is not safe.

-- System Information:
Debian Release: 9.6
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-debug'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-8-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)



More information about the Debian-med-packaging mailing list