Your message dated Thu, 05 Jun 2014 15:52:41 +0000
with message-id <e1wszy5-0001tf...@franck.debian.org>
and subject line Bug#749975: fixed in lcms2 2.6-2
has caused the Debian Bug report #749975,
regarding lcms2: unaligned access on mips/mipsel causing colord to FTBFS
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
749975: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=749975
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: lcms2
Version: 2.6-1
Severity: important
Tags: patch upstream

colord fails to build from source on both mips/mipsel due to an
unaligned access (SIGBUS):

https://buildd.debian.org/status/fetch.php?pkg=colord&arch=mips&ver=1.2.0-3&stamp=1401475533
https://buildd.debian.org/status/fetch.php?pkg=colord&arch=mipsel&ver=1.2.0-3&stamp=1401374635

The MIPS architecture requires that load/stores are done with an
alignment corresponding to the type, so even if it is a 32-bit
architecture accesses to double values (8-bytes) require a 64-bit
alignment.

Currently the lcms2 memory allocator only guarantee an alignment
corresponding the size of (void *). Since version 2.6, lcms2 now also
store double values (called cmsFloat64Number), causing some random
issues on mips/mipsel, depending on how lucky we are about the
alignement. SPARC is likely to also be affected, as the same
alignment requirement applies.


There are two ways of fixing that, either increasing the alignment to
64-bit on mips/mipsel/sparc:

--- a/src/lcms2_internal.h
+++ b/src/lcms2_internal.h
@@ -56,8 +56,13 @@
 // Alignment of ICC file format uses 4 bytes (cmsUInt32Number)
 #define _cmsALIGNLONG(x) (((x)+(sizeof(cmsUInt32Number)-1)) & 
~(sizeof(cmsUInt32Number)-1))
 
-// Alignment to memory pointer
-#define _cmsALIGNMEM(x)  (((x)+(sizeof(void *) - 1)) & ~(sizeof(void *) - 1))
+// Alignment to maximum required alignment
+// On MIPS and SPARC, access to double values need to be 8-bytes aligned
+#if defined(__mips__) || defined(__sparc__)
+#   define _cmsALIGNMEM(x)  ((x + 7) & ~7)
+#else
+#   define _cmsALIGNMEM(x)  (((x)+(sizeof(void *) - 1)) & ~(sizeof(void *) - 
1))
+#endif
 
 // Maximum encodeable values in floating point
 #define MAX_ENCODEABLE_XYZ  (1.0 + 32767.0/32768.0)



As it seems storing 64-bit values is not the common case, the other
alternative is to tell GCC that the stored double values are aligned
to (void *), so that it generate code to do unaligned access if needed.
This can be specified independently of the architecture as this is
always true, and might even help GCC to generate better code. This is
what the patch below does:

--- a/src/lcms2_internal.h
+++ b/src/lcms2_internal.h
@@ -479,11 +479,13 @@
                             const struct _cmsContext_struct* src);
 
 // Container for adaptation state -- not a plug-in
+// The chunks are only guaranteed to be aligned to void *, tell that to the
+// compiler so that it can generate unaligned access instructions if needed.
 typedef struct {
     
     cmsFloat64Number  AdaptationState;
 
-} _cmsAdaptationStateChunkType;
+} _cmsAdaptationStateChunkType __attribute__ ((__aligned__(__alignof__(void 
*))));
 
 // The global Context0 storage for adaptation state
 extern  _cmsAdaptationStateChunkType    _cmsAdaptationStateChunk;


-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: mipsel (mips64)

Kernel: Linux 3.2.0-4-5kc-malta
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

--- End Message ---
--- Begin Message ---
Source: lcms2
Source-Version: 2.6-2

We believe that the bug you reported is fixed in the latest version of
lcms2, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 749...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Thomas Weber <twe...@debian.org> (supplier of updated lcms2 package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmas...@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Thu, 05 Jun 2014 14:51:56 +0000
Source: lcms2
Binary: liblcms2-dev liblcms2-dbg liblcms2-2 liblcms2-utils
Architecture: source amd64
Version: 2.6-2
Distribution: unstable
Urgency: medium
Maintainer: Oleksandr Moskalenko <ma...@debian.org>
Changed-By: Thomas Weber <twe...@debian.org>
Description: 
 liblcms2-2 - Little CMS 2 color management library
 liblcms2-dbg - debugging symbols for lcms2
 liblcms2-dev - Little CMS 2 color management library development headers
 liblcms2-utils - Little CMS 2 color management library (utilities)
Closes: 749975
Changes: 
 lcms2 (2.6-2) unstable; urgency=medium
 .
   * New patch: fix-unaligned-access.patch: Align access to double values.
     Thanks to Aurelien Jarno <aure...@debian.org> (Closes: #749975)
Checksums-Sha1: 
 9e9bfc372823931939f63a586c75288bc921b4c7 2094 lcms2_2.6-2.dsc
 f7f9ac4c4de830d1c459989155a04cf14c12c498 2416100 lcms2_2.6-2.debian.tar.xz
 efd8a3aee8a7aac34aa48435e850148ed6e12628 4662016 liblcms2-dev_2.6-2_amd64.deb
 c22ba86974bb8f3456e9d93f4a49dbb8c6a45f8a 468262 liblcms2-dbg_2.6-2_amd64.deb
 560032b0dcae909ffc0a331eca506591967d6a1f 138790 liblcms2-2_2.6-2_amd64.deb
 e7fc75014a149eec3621977dc419c91b16cea385 44238 liblcms2-utils_2.6-2_amd64.deb
Checksums-Sha256: 
 0b867a072bbe6bdd6e4c6c679c8885c7a1f36b07ad13cbb8183fc4f8d84c0c1f 2094 
lcms2_2.6-2.dsc
 6f91272360db8aaef5c93a3d073fa550c2bfddfa94e23a9136be038a6f627785 2416100 
lcms2_2.6-2.debian.tar.xz
 5be18d07a3d0c5cfbb5af54a92ac326d38d22fad386a03df434271399927e224 4662016 
liblcms2-dev_2.6-2_amd64.deb
 1930dc4a663b489cc7aeffc516c13a611ceb8c5c6cc869d1515dffb78a2f617a 468262 
liblcms2-dbg_2.6-2_amd64.deb
 18d80caafbfcd29181635f31843118506a2abe5423b28d1d5aa4fd5962685fe0 138790 
liblcms2-2_2.6-2_amd64.deb
 a2a9e0507c9e7f0404dbc54b3ba7864b4df6855a78542fc4e36470a0e5064116 44238 
liblcms2-utils_2.6-2_amd64.deb
Files: 
 b3bb09f74fc07d28f7af3b116f3ffd8a 4662016 libdevel optional 
liblcms2-dev_2.6-2_amd64.deb
 9746a002d5ff8268a50422d1c3ac575f 468262 debug extra 
liblcms2-dbg_2.6-2_amd64.deb
 2781b7787f6b98588bc43b78a7da064c 138790 libs optional 
liblcms2-2_2.6-2_amd64.deb
 c8729547a6c3d368e94bc21a526664aa 44238 utils optional 
liblcms2-utils_2.6-2_amd64.deb
 5f6857221cda0bafcbce280811e02da5 2094 libs optional lcms2_2.6-2.dsc
 381fdd9fa349e2acfda9eb94c9ea529f 2416100 libs optional 
lcms2_2.6-2.debian.tar.xz

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCgAGBQJTkIp2AAoJEMf/k4scGj5JxcoQALCEwaEiEHL29F5L+hDclNFs
56nG2K1PN0Ghyf6DYE3RTTT1yderWskp8caefTH4TWjLa/wImgAp7Ak6q+8daCfU
YiZ8MinDkAsRtBCd6BqKBT9Iuuu8gC7MaZ1chJD0cGV0hnFWz44rWA/G36qMvgHw
2Qbz1UudgR6jJ2Zuu05WwUcdvPJarnAQtur5DURF1VHbY3DYHfPJBoaGG5AL9rt9
YNrnSWD6jVbhmSmiXaI7PYbPJ+HO3sYf3lXrsubGe4cjW0SgPFVPGcFp6TK0IPmv
h4EhXIaYsDQyvT6AKbEFciMrhSrJ+UuIxiE84hcP9aajiLzxooT36nCTX0CJCRlG
oUoxy8qCFGsVZTNX6I3dXAJAoz7EsNjPhw08i5I8GS8Z7CNBFzAuVASkxQdF4Inm
e9pBDEpwcZcD53rq5tfKTtN6k7OAnrnXL5Ad5p8O9Hn33dAQNF4l2KuDrLESjERx
IQ9WkoFXmc/Wp8PBksTiPWr6ONkI7J5nGOJxlak2L3Ov8wJENX80VIvFbRHVEzMk
SMzf5daXjT/ZNjfrzzVr/IquNJNmiNXvZnis/+LPcvAPQW3K/IEBSPH35r6JYSoK
9kYeW57kF8nt9cI+ajzZRiZ4favAqNBXlQAMsquyGRTPgtApw3isPy5PeUjyXzsM
xmokfBrX4SJFOLRH/oDy
=/f6P
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to