[Pkg-bluetooth-maintainers] Bug#856487: libsbc1: compiling with gcc > 4.9 causes stack corruption

Adrian Bunk bunk at debian.org
Fri Apr 28 13:35:15 UTC 2017


On Mon, Apr 17, 2017 at 05:02:32PM +0100, Paul Brook wrote:
> Package: libsbc1
> Version: 1.3-1+b2
> Followup-For: Bug #856487
> 
> Not a stack corruption.
> 
> This is miscompilation of sbc_analyze_4b_8s_armv6.  gcc appears to look
> into the asm function and decides that it does not clobber r3 (which the
> normal ARM ABI says is call clobbered).  The last out += out_stride ends
> up incrementing the pointer by an arbitrary amount.
> 
> The attached patch works around the bug.

Unfortunately this is not correct since extended asm is not allowed in 
naked functions.

Short-term I'd suggest to use the attached patch, that disables the 
ARMv6 asm implementation and uses the C implementation instead.

> I'm not entirely sure whether this is a gcc bug or not, but at best it's
> surprising behavior from gcc.  I've attached a reduced testcase for the toolchain
> folks to argue over (compile with gcc -O2, tested with gcc 6.3.0-2 from
> sid).

This is either a bug in gcc or insufficient documentation in gcc.

Could you (or did you already) submit that to the gcc bugzilla?

> Paul
>...

Thanks
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

-------------- next part --------------
A non-text attachment was scrubbed...
Name: no-armv6-asm.patch
Type: text/x-diff
Size: 768 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-bluetooth-maintainers/attachments/20170428/eb2e1f6f/attachment.patch>


More information about the Pkg-bluetooth-maintainers mailing list