Re: RFH: SIGBUS in buildd but not in porterbox

Felipe Sateler <[email protected]>
Newsgroups gmane.linux.debian.ports.mips,gmane.linux.debian.alioth.multimedia-maintainers
Message-ID <CAAfdZj-oB8hK+apGuDrFb=s+mzhvSPu0y__pw7xRWV2kPKquig@mail.gmail.com>
On Tue, Feb 18, 2014 at 2:50 PM, David Daney <[email protected]> wrote:
> On 02/17/2014 01:28 PM, Andreas Barth wrote:
>>
>> * Felipe Sateler ([email protected]) [140217 20:33]:
>>>
>>> The package liblo runs a test suite at build time. This test suite
>>> failed in mipsel (but not mips)[1]. I tried to reproduce the issue in
>>> eder.d.o but it passed.
>>>
>>> Liblo does use unaligned access (liblo had to be removed from sparc
>>> for this reason).
>>> But I'm confused as to why does the buildd error out and the porterbox
>>> doesn't. Is it possible to (programatically) instruct the kernel to
>>> not raise a SIGBUS?
>>>
>>>
>>> [1]
>>> https://buildd.debian.org/status/fetch.php?pkg=liblo&arch=mipsel&ver=0.28-3&stamp=1392064303
>>
>>
>> rem and eder are different hardware.
>
>
> Yes, Some MIPS CPUs (like OCTEON) can be, and are, configured to handle
> unaligned accesses.  Others cannot.
>
> The kernel may be able to emulate unaligned accesses for integer loads and
> stores, but I think the problem may be that the FPU emulator cannot do
> unaligned accesses.

I'm not sure this is the cause. Liblo doesn't do much math on its own.
What it does do is read 64bit ints or doubles from a 4-byte aligned
data stream.

>
> Really the application that is doing this should be fixed.

Yes, but this is not so easy because on my amd64 I can't enable sigbus
traps as I can't even do a printf without triggering it:

#include <stdio.h>

main() {
#if defined(__GNUC__)
# if defined(__i386__)
         /* Enable Alignment Checking on x86 */
         __asm__("pushf\norl $0x40000,(%esp)\npopf");
# elif defined(__x86_64__)
        /* Enable Alignment Checking on x86_64 */
         __asm__("pushf\norl $0x40000,(%rsp)\npopf");
# endif
#endif

        printf("hello\n");
        printf("goodbye\n");
}


This program never prints goodbye.

-- 

Saludos,
Felipe Sateler
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.