Loading ...
Sorry, an error occurred while loading the content.

Asterisk - making tons of misaligned access errors

Expand Messages
  • CORNELIU DOBAN
    Hi Josh, SER is fine but Asterisk has problem with misaligned access. Enabling SIGBUS for misaligned access cause asterisk to die on startup while loading
    Message 1 of 2 , Mar 31, 2005
    View Source
    • 0 Attachment
      Hi Josh,
       
      SER is fine but Asterisk has problem with misaligned access.
       
      Enabling SIGBUS for misaligned access cause asterisk to die on startup while loading various moduled. It looks random, sometime it even starts ok.
       
      When requesting to "fix" the errors ("cat 2 > /proc/cpu/alignment") asterisk is working fine. Voicemail announcements can be heared even with the GSM codec.
       
      Is there any way to fix this kind of problems (any compile flags), or  the entire software has to be debugged ?
       
      Thank you,
      Corneliu

      Josh Parsons <jbparsons@...> wrote:
      On Tue, 2005-03-29 at 11:42 -0800, CORNELIU DOBAN wrote:

      > When compiling SER the following warning is wery frequent:
      > warning: cast increases required alignment of target type

      > Probably the NSLU has different size for long int, short int etc and
      > that is causing the warning...

      > Do you have any idea how to fix this ?

      It's not different sizes of long int and short int that cause the
      warning, but different alignments required when dereferencing pointers
      to those types.

      The trouble is constructions like this (from pass_fd.c:111):

            *(int*)CMSG_DATA(cmsg)=fd;

      What's happening is that the ser sources expect to be able to cast an
      arbitrary pointer to (int*) and still be able to dereference it without
      causing a SIGBUS.  This is not portable, unless the programmer has
      elsewhere taken steps to ensure that the original pointer was aligned to
      whatever alignment is required by the processor (which may be the case
      here, I don't know). Programmers who are used to ia32 often don't think
      of this, as ia32 processors silently fix up misaligned accesses in
      hardware.

      I suggest that you try (as root) "echo 5 >/proc/cpu/alignment" on your
      slug to enable SIGBUS.  Then run ser and see if it dies with a SIGBUS.
      If it does, then it looks like it has portability problems.

      --
      Josh Parsons
      Philosophy Department
      1238 Social Sciences and Humanities Bldg.
      University of California
      Davis, CA 95616-8673
      USA

      Please avoid sending me Word or PowerPoint attachments.
      See http://www.gnu.org/philosophy/no-word-attachments.html



      [ Moderator Note: All static information is slowly moving to the Wiki at http://www.nslu2-linux.org ]



      Yahoo! Messenger
      Show us what our next emoticon should look like. Join the fun.

    • Josh Parsons
      ... Well, it has to be a bug in the source code. However, it seems from the asterisk makefile that it s designed to run on sparc, and sparc is as
      Message 2 of 2 , Apr 1 8:28 AM
      View Source
      • 0 Attachment
        On Thu, 2005-03-31 at 23:16 -0800, CORNELIU DOBAN wrote:

        > SER is fine but Asterisk has problem with misaligned access.
        >
        > Enabling SIGBUS for misaligned access cause asterisk to die on startup
        > while loading various moduled. It looks random, sometime it even
        > starts ok.

        > Is there any way to fix this kind of problems (any compile flags),
        > or the entire software has to be debugged ?

        Well, it has to be a bug in the source code. However, it seems from the
        asterisk makefile that it's designed to run on sparc, and sparc is as
        alignment-fussy as arm is. So there should some configuration under
        which it'll work. I'd suggest running it under gdb and trying to track
        down the bug.

        As a guess, the LOW_MEMORY option might be to blame?

        --
        Josh Parsons
        Philosophy Department
        1238 Social Sciences and Humanities Bldg.
        University of California
        Davis, CA 95616-8673
        USA

        Please avoid sending me Word or PowerPoint attachments.
        See http://www.fsf.org/philosophy/no-word-attachments.html
      Your message has been successfully submitted and would be delivered to recipients shortly.