[Debian-med-packaging] Bug#889147: abyss: PairedDBG_LoadAlgorithm test fails on sparc64 due to strict alignment violation

David Matthew Mattli dmm at mattli.us
Fri Feb 2 14:46:30 UTC 2018


Package: abyss
Severity: normal
Tags: patch upstream
Usertags: sparc64

Dear Maintainer,

This package currently FTBFS on sparc64 due to the
PairedDBG_LoadAlgorithm test failing with a SIGBUS. The Kmer.load and
Kmer.storeReverse methods in the Common/Kmer.cpp file cast a uint8_t*
to a size_t* without ensuring the pointer value has the proper
alignment.

To fix this I added an aligned stack allocated buffer and memcpy to
that. Stack allocated is appropriate because the buffer size is
small(32 bytes) and known at compile time.

-- System Information:
Debian Release: buster/sid
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: sparc64

Kernel: Linux 4.14.0-3-sparc64-smp (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
-------------- next part --------------
--- a/Common/Kmer.cpp
+++ b/Common/Kmer.cpp
@@ -188,9 +188,10 @@
 	Seq seq;
 #if MAX_KMER > 96
 # if WORDS_BIGENDIAN
-	const size_t *s = reinterpret_cast<const size_t*>(src);
+	size_t buf[Kmer::NUM_BYTES];
+	memcpy(buf, src, Kmer::NUM_BYTES);
 	size_t *d = reinterpret_cast<size_t*>(&seq + 1);
-	copy(s, s + Kmer::NUM_BYTES/sizeof(size_t), reverse_iterator<size_t*>(d));
+	copy(buf, buf + Kmer::NUM_BYTES/sizeof(size_t), reverse_iterator<size_t*>(d));
 # else
 	uint8_t *d = reinterpret_cast<uint8_t*>(&seq);
 	memcpy(d, src, sizeof seq);
@@ -235,9 +236,10 @@
 #if MAX_KMER > 96
 # if WORDS_BIGENDIAN
 	const size_t *s = reinterpret_cast<const size_t*>(&seq);
-	size_t *d = reinterpret_cast<size_t*>(dest);
+	size_t d[Kmer::NUM_BYTES];
 	copy(s, s + Kmer::NUM_BYTES/sizeof(size_t),
 			reverse_iterator<size_t*>(d +  Kmer::NUM_BYTES/sizeof(size_t)));
+	memcpy(dest, d, Kmer::NUM_BYTES);
 	reverse(dest, dest + Kmer::NUM_BYTES);
 # else
 	memcpy(dest, &seq, Kmer::NUM_BYTES);


More information about the Debian-med-packaging mailing list