[Debian-astro-maintainers] Bug#846094: cpl_mask.c: Unaligned access

Iain Lane iain at orangesquash.org.uk
Mon Nov 28 12:56:45 UTC 2016


Source: cpl
Version: 7.0-3
Severity: normal
Tags: upstream

Hi,

I noticed this on Ubuntu, where we build armhf packages on arm64
machines which trigger a SIGBUS on unaligned access.

The test cpl_basic_image-test fails:

> root at ethical-kitten:~/cpl-7.0# ./libtool --mode=execute gdb cplcore/tests/cpl_image_basic-test 
> [...]
> Reading symbols from /root/cpl-7.0/cplcore/tests/.libs/lt-cpl_image_basic-test...done.
> (gdb) run
> Starting program: /root/cpl-7.0/cplcore/tests/.libs/lt-cpl_image_basic-test 
> Cannot parse expression `.L954 4 at r4'.
> warning: Probes-based dynamic linker interface failed.
> Reverting to original interface.
> 
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
> 
> Program received signal SIGBUS, Bus error.
> cpl_mask_count_window (self=self at entry=0x35338, llx=<optimized out>, lly=lly at entry=1, urx=urx at entry=17, ury=15) at cpl_mask.c:1139
> 1139                const size_t countz = *(const size_t*)(pi + i)
> (gdb) bt
> #0  cpl_mask_count_window (self=self at entry=0x35338, llx=<optimized out>, lly=lly at entry=1, urx=urx at entry=17, ury=15) at cpl_mask.c:1139
> #1  0xf772397e in cpl_mask_count (in=in at entry=0x35338) at cpl_mask.c:1087
> #2  0x0001e198 in cpl_image_bitwise_test (nx=<optimized out>, ny=<optimized out>) at cpl_image_basic-test.c:2100
> #3  0x0001234e in main () at cpl_image_basic-test.c:145

This is the code

>         for (; i < (urx & ~CPL_MASK_PAD2); i+= CPL_MASK_WORD2) {
>             const size_t countz = *(const size_t*)(pi + i)
>                                 + *(const size_t*)(pi + i + CPL_MASK_WORD);

I guess this access or the preceeding loop

>        /* FIXME: Should really ensure byte-wise iteration to word-boundary */
>        for (; i < llx - 1 + CPL_MASK_PAD2WORD2(llx - 1); i++) {

needs to become aligned, but it's a bit complicated for me to understand
as someone new to the codebase.

Any ideas? Or could you help & forward upstream please?

Thanks,

-- 
Iain Lane                                  [ iain at orangesquash.org.uk ]
Debian Developer                                   [ laney at debian.org ]
Ubuntu Developer                                   [ laney at ubuntu.com ]



More information about the Debian-astro-maintainers mailing list