<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SIGBUS/BUS_ADRALN in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390559#M681750</link>
    <description>&amp;gt; Of course not, system archive libs cause&lt;BR /&gt;&amp;gt; problems if you have both archive and shared&lt;BR /&gt;&amp;gt; in the same application.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I am not sure if I understand what you are saying here, but I would - needless to say - never use both an archive version and a shared version of a certain library for the same executable.&lt;BR /&gt;&lt;BR /&gt;I just commented on the fact that 11.11 systems have both an archive library and a shared library for the functions that we are discussing here, while 11.23 systems do not ( having only a shared version ).&lt;BR /&gt;</description>
    <pubDate>Sun, 05 Apr 2009 13:47:46 GMT</pubDate>
    <dc:creator>Anders Ringaby</dc:creator>
    <dc:date>2009-04-05T13:47:46Z</dc:date>
    <item>
      <title>SIGBUS/BUS_ADRALN</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390550#M681741</link>
      <description>Hello.&lt;BR /&gt;&lt;BR /&gt;I am having a SIGBUS problem with a program, written in C. The program core-dumps with si_code == BUS_ADRALN.&lt;BR /&gt;&lt;BR /&gt;( Environment is HP-UX B.11.11 and HP-UX B.11.23. )&lt;BR /&gt;&lt;BR /&gt;I tried to correct the problem by adding a signal handler. Here are pieces of the code:&lt;BR /&gt;&lt;BR /&gt;struct sigaction sa1;&lt;BR /&gt;....&lt;BR /&gt;....&lt;BR /&gt;void bus_error(int, siginfo_t *, void *);&lt;BR /&gt;....&lt;BR /&gt;....&lt;BR /&gt;sa1.sa_sigaction = bus_error;&lt;BR /&gt;sigemptyset(&amp;amp;sa1.sa_mask);&lt;BR /&gt;sa1.sa_flags = SA_SIGINFO;&lt;BR /&gt;sigaction(SIGBUS, &amp;amp;sa1, (struct sigaction *)0);&lt;BR /&gt;....&lt;BR /&gt;....&lt;BR /&gt;void bus_error(int signo, siginfo_t *info, void *context)&lt;BR /&gt;{&lt;BR /&gt;    if(info-&amp;gt;si_code == BUS_ADRALN)&lt;BR /&gt;    {&lt;BR /&gt;        allow_unaligned_data_access();&lt;BR /&gt;    }&lt;BR /&gt;    else&lt;BR /&gt;    {&lt;BR /&gt;        openlog(progname, 0, LOG_LOCAL7);&lt;BR /&gt;        syslog(LOG_INFO, "BUS ERROR");&lt;BR /&gt;        closelog();&lt;BR /&gt;        bye(1);&lt;BR /&gt;    }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;However, this code did not have the desired effect. The program do not core-dump anymore, but it seems to receive the SIGBUS signal endlessly, causing the signal handling function to kick in forever. Looks like a loop if you look at it with tusc.&lt;BR /&gt;&lt;BR /&gt;I do not know if my code caused this "loop", or if it was there from the beginning - but did not show because it core-dumped.&lt;BR /&gt;&lt;BR /&gt;Any idea, anybody?&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;Anders&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 30 Mar 2009 15:08:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390550#M681741</guid>
      <dc:creator>Anders Ringaby</dc:creator>
      <dc:date>2009-03-30T15:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: SIGBUS/BUS_ADRALN</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390551#M681742</link>
      <description>&amp;gt;I tried to correct the problem by adding a signal handler.&lt;BR /&gt;&lt;BR /&gt;That's not how you fix the problem.  All a signal handler allows you to do is print a nice message, suppress the core file or print a stack trace.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;allow_unaligned_data_access();&lt;BR /&gt;&lt;BR /&gt;This call on PA arms a signal handler to emulate misaligned load/stores.  Your handler will mess this up.  On Integrity, it enables the kernel handler.&lt;BR /&gt;Have you looked at the documentation?&lt;BR /&gt;&lt;A href="http://docs.hp.com/en/14487/pragmas.htm#pragma-pack-ex3" target="_blank"&gt;http://docs.hp.com/en/14487/pragmas.htm#pragma-pack-ex3&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;but it seems to receive the SIGBUS signal endlessly, causing the signal handling function to kick in forever.&lt;BR /&gt;&lt;BR /&gt;That's to be expected.  You can't return from most signal handlers.</description>
      <pubDate>Mon, 30 Mar 2009 23:19:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390551#M681742</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-03-30T23:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: SIGBUS/BUS_ADRALN</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390552#M681743</link>
      <description>&lt;BR /&gt;&amp;gt; Have you looked at the documentation?&lt;BR /&gt;&amp;gt; &lt;A href="http://docs.hp.com/en/14487/pragmas.htm#pragma-pack-ex3" target="_blank"&gt;http://docs.hp.com/en/14487/pragmas.htm#pragma-pack-ex3&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Yes, some of it. And I have tried a couple of #pragma variants, but it did not work ( still getting "Bus error"/BUS_ADRALN ).&lt;BR /&gt;&lt;BR /&gt;Maybe I used the wrong byte-alignment, or maybe I used the #pragma pack directive in the wrong way.&lt;BR /&gt;&lt;BR /&gt;However, a #pragma pack directive can affect the size and mapping of a structure that is declared after the directive, in the same source code. But that is something that I do not have any control over in this case, since the SIGBUS signal is received when the program is running a function ( wcstombs() ) from libc.&lt;BR /&gt;&lt;BR /&gt;Here is the output from gdb:&lt;BR /&gt;&lt;BR /&gt;HP gdb 5.4.0 for HP Itanium (32 or 64 bit) and target HP-UX 11.2x.&lt;BR /&gt;Copyright 1986 - 2001 Free Software Foundation, Inc.&lt;BR /&gt;Hewlett-Packard Wildebeest 5.4.0 (based on GDB) is covered by the&lt;BR /&gt;GNU General Public License. Type "show copying" to see the conditions to&lt;BR /&gt;change it and/or distribute copies. Type "show warranty" for warranty/support.&lt;BR /&gt;..&lt;BR /&gt;Core was generated by `sudosh'.&lt;BR /&gt;Program terminated with signal 10, Bus error.&lt;BR /&gt;BUS_ADRALN - Invalid address alignment&lt;BR /&gt;#0  0xc0000000002e4790:0 in wcstombs+0x790 () from /usr/lib/hpux64/libc.so.1&lt;BR /&gt;(gdb) bt&lt;BR /&gt;#0  0xc0000000002e4790:0 in wcstombs+0x790 () from /usr/lib/hpux64/libc.so.1&lt;BR /&gt;#1  0xc000000000333a20:0 in T_19_462b_cl___doprnt_main+0x4b20 ()&lt;BR /&gt;   from /usr/lib/hpux64/libc.so.1&lt;BR /&gt;#2  0xc000000000326bd0:0 in _doprnt+0x30 () from /usr/lib/hpux64/libc.so.1&lt;BR /&gt;#3  0xc00000000034c2f0:0 in vsnprintf+0x90 () from /usr/lib/hpux64/libc.so.1&lt;BR /&gt;#4  0xc0000000002d4fb0:0 in syslog+0x3d0 () from /usr/lib/hpux64/libc.so.1&lt;BR /&gt;#5  0x400000000000a320:0 in log_master_data (&lt;BR /&gt;    tty=0x87ffffffffffe820 "/dev/pts/10", ufrom=0x6000000000004a50 "andrin", &lt;BR /&gt;    uto=0x6000000000004650 "andrin", &lt;BR /&gt;    iobuf_p=0x87ffffffffffec10 "\r\e[A {\e[B\n\b\e[Amess \"Kan ej h\344mta in tidsuppgifter.\";\e[B\n\r\e[A ERR=1;\e[B\n\r\e[A }\e[B\n\r\e[Aexport YEAR MON MDAY HOUR MIN SEC YDAY IMON WDAY WNO\e[B\n\r\e[A#\e[B\n\b\e[A# Sista arbetsdagen i m\345naden.\e[B\n\r\e[A#\e[B\n\b\e["..., num=849) at sudosh.c:679&lt;BR /&gt;#6  0x4000000000006bb0:0 in main (argc=1, argv=0x87fffffffffff7c0, &lt;BR /&gt;    environ=0x87fffffffffff7d0) at sudosh.c:380&lt;BR /&gt;(gdb) q&lt;BR /&gt;&lt;BR /&gt;The program calls syslog(), but as you can see, there a few calls within libc after that.&lt;BR /&gt;&lt;BR /&gt;I have tried building the program as a 32-bit binary, as well as a 64-bit binary, but it still receives SIGBUS/BUS_ADRALN when running wcstombs().&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Apr 2009 14:03:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390552#M681743</guid>
      <dc:creator>Anders Ringaby</dc:creator>
      <dc:date>2009-04-01T14:03:51Z</dc:date>
    </item>
    <item>
      <title>Re: SIGBUS/BUS_ADRALN</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390553#M681744</link>
      <description>&amp;gt;I have tried a couple of #pragma variants, but it did not work (still getting "Bus error"/BUS_ADRALN).&lt;BR /&gt;&lt;BR /&gt;If you weren't using pragma pack, don't start.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;#pragma pack directive can affect the size and mapping of a structure that is declared after the directive,&lt;BR /&gt;&lt;BR /&gt;If you have to use it, then you may have to use allow_unaligned_data_access.&lt;BR /&gt;&lt;BR /&gt;Have you made sure you have called allow_unaligned_data_access() at the start of your program and in any pthread start routine?&lt;BR /&gt;&lt;BR /&gt;&amp;gt;since the SIGBUS signal is received when the program is running a function wcstombs&lt;BR /&gt;&lt;BR /&gt;What format have you given to syslog?  If you are using %ls, you need to make sure the wchar_t array is aligned.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I have tried building the program as a 32-bit binary, as well as a 64-bit binary, but it still receives SIGBUS&lt;BR /&gt;&lt;BR /&gt;I'm not sure why this would make a difference.&lt;BR /&gt;Also can you set a breakpoint in vsnprintf and print the parms?&lt;BR /&gt;(gdb) b * vsnprintf&lt;BR /&gt;Then when hit:&lt;BR /&gt;(gdb) x /s $r32&lt;BR /&gt;(gdb) p $r33&lt;BR /&gt;(gdb) x /s $r34&lt;BR /&gt;(gdb) p /x $r35&lt;BR /&gt;(gdb) p /x $r36&lt;BR /&gt;(gdb) p /x $r37&lt;BR /&gt;(gdb) p /x $r38&lt;BR /&gt;(gdb) p /x $r39&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Apr 2009 23:21:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390553#M681744</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-04-01T23:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: SIGBUS/BUS_ADRALN</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390554#M681745</link>
      <description>&amp;gt; Have you made sure you have called&lt;BR /&gt;&amp;gt; allow_unaligned_data_access() at the start&lt;BR /&gt;&amp;gt; of your program and in any pthread start routine?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I did call allow_unaligned_data_access() at the start of the program, and that seem to work. I have not had any problems yet, anyway. And I am not using any #pragma.&lt;BR /&gt;&lt;BR /&gt;But there is still one problem.&lt;BR /&gt;&lt;BR /&gt;I have to build the program in two versions: Itanium and PA-RISC, both 64-bit.&lt;BR /&gt;&lt;BR /&gt;The IA-version can be built nicely with "-lunalign -luca".&lt;BR /&gt;&lt;BR /&gt;But I cannot find a 64-bit PA-RISC ELF-library that contain allow_unaligned_data_access().&lt;BR /&gt;&lt;BR /&gt;( The hppa library will not do. )&lt;BR /&gt;&lt;BR /&gt;What library(s) should I use in the PA-RISC case?&lt;BR /&gt;</description>
      <pubDate>Thu, 02 Apr 2009 19:20:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390554#M681745</guid>
      <dc:creator>Anders Ringaby</dc:creator>
      <dc:date>2009-04-02T19:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: SIGBUS/BUS_ADRALN</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390555#M681746</link>
      <description>&amp;gt;But I cannot find a 64-bit PA-RISC ELF-library that contain allow_unaligned_data_access().&lt;BR /&gt;&lt;BR /&gt;They did port to PA64 bit.  Have you installed these patches?&lt;BR /&gt;PHSS_35287 - 11.11&lt;BR /&gt;PHSS_35288 - 11.23</description>
      <pubDate>Thu, 02 Apr 2009 22:32:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390555#M681746</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-04-02T22:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: SIGBUS/BUS_ADRALN</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390556#M681747</link>
      <description>&amp;gt; They did port to PA64 bit. Have you installed these patches?&lt;BR /&gt;&amp;gt; PHSS_35287 - 11.11&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;That patch is installed on some 11.11 systems, but not all, in our environment.&lt;BR /&gt;&lt;BR /&gt;I plan to build the 64-bit PA-RISC version using static linkage ( /usr/lib/pa20_64/libhppa.a ), so that I can copy the binary to all other 11.11 systems without worrying about any dependency.&lt;BR /&gt;&lt;BR /&gt;Funny, there do not seem to be any libunalign.a archive file in 11.23 ia64-systems.&lt;BR /&gt;&lt;BR /&gt;Thank You for all the help.&lt;BR /&gt;</description>
      <pubDate>Fri, 03 Apr 2009 14:26:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390556#M681747</guid>
      <dc:creator>Anders Ringaby</dc:creator>
      <dc:date>2009-04-03T14:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: SIGBUS/BUS_ADRALN</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390557#M681748</link>
      <description>"I have assigned points to 0 of 3 responses to my questions."&lt;BR /&gt;&lt;BR /&gt;Please assign points to your thread.&lt;BR /&gt;A way of saying thanks to the answers</description>
      <pubDate>Fri, 03 Apr 2009 14:59:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390557#M681748</guid>
      <dc:creator>Andres_13</dc:creator>
      <dc:date>2009-04-03T14:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: SIGBUS/BUS_ADRALN</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390558#M681749</link>
      <description>&amp;gt;there do not seem to be any libunalign.a archive file in 11.23 ia64-systems.&lt;BR /&gt;&lt;BR /&gt;Of course not, system archive libs cause problems if you have both archive and shared in the same application.&lt;BR /&gt;There are no archive versions for libc, libunwind, libunalign, etc.</description>
      <pubDate>Fri, 03 Apr 2009 22:13:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390558#M681749</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-04-03T22:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: SIGBUS/BUS_ADRALN</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390559#M681750</link>
      <description>&amp;gt; Of course not, system archive libs cause&lt;BR /&gt;&amp;gt; problems if you have both archive and shared&lt;BR /&gt;&amp;gt; in the same application.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I am not sure if I understand what you are saying here, but I would - needless to say - never use both an archive version and a shared version of a certain library for the same executable.&lt;BR /&gt;&lt;BR /&gt;I just commented on the fact that 11.11 systems have both an archive library and a shared library for the functions that we are discussing here, while 11.23 systems do not ( having only a shared version ).&lt;BR /&gt;</description>
      <pubDate>Sun, 05 Apr 2009 13:47:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390559#M681750</guid>
      <dc:creator>Anders Ringaby</dc:creator>
      <dc:date>2009-04-05T13:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: SIGBUS/BUS_ADRALN</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390560#M681751</link>
      <description>&amp;gt;while 11.23 systems do not (having only a shared version).&lt;BR /&gt;&lt;BR /&gt;That's because we learned our lessons and on Integrity we could change things.</description>
      <pubDate>Sun, 05 Apr 2009 19:01:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sigbus-bus-adraln/m-p/4390560#M681751</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-04-05T19:01:43Z</dc:date>
    </item>
  </channel>
</rss>

