<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - libpulsecommon.so alignment memory access issue"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=65474">65474</a>
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>lennart@poettering.net
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>pulseaudio-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>libpulsecommon.so alignment memory access issue
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>pulseaudio-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>major
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>changyp6@gmail.com
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>ARM
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>core
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>PulseAudio
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I cross compiled PulseAudio 4.0 using codesourcery 2011.09 to ARM platform with
the following CFLAGS
-march=armv6k -mtune=arm1136j-s -msoft-float -O3 -fPIC

pulseaudio daemon runs perfectly without any problem, but when I start to run
client application like pactl info, the connection always fail with the
following error messages:

# pactl  info
I: [pulseaudio][pulsecore/client.c:80 pa_client_new()] Created 0 "Native client
(UNIX socket client)"
D: [pulseaudio][pulsecore/protocol-dbus.c:773 pa_dbus_protocol_add_interface()]
Interface org.PulseAudio.Core1.Client added for object
/org/pulseaudio/core1/client0
D: [pulseaudio][pulsecore/protocol-native.c:2599 command_auth()] Protocol
version: remote 28, local 28
I: [pulseaudio][pulsecore/protocol-native.c:2632 command_auth()] Got
credentials: uid=0 gid=0 success=1
D: [pulseaudio][pulsecore/protocol-native.c:2662 command_auth()] SHM possible:
yes
D: [pulseaudio][pulsecore/protocol-native.c:2680 command_auth()] Negotiated
SHM: yes
E: [pulseaudio][pulsecore/protocol-native.c:1939 protocol_error()] protocol
error, kicking client
I: [pulseaudio][pulsecore/client.c:102 pa_client_free()] Freed 0 "Native client
(UNIX socket client)"
D: [pulseaudio][pulsecore/protocol-dbus.c:835
pa_dbus_protocol_remove_interface()] Interface org.PulseAudio.Core1.Client
removed from object /org/pulseaudio/core1/client0
Connection failure: Connection terminated

I did some digging on this error, I found connection is terminated on function:
command_set_client_name(), and the root failure is in function:
pa_tagstruct_get_arbitrary(), on this check "if (t->data[t->rindex] !=
PA_TAG_ARBITRARY)".

Then I print out t->data[t->rindex] value to see if it's PA_TAG_ARBITRARY, what
is strange is that this value is a randome value.

I go back to check the compiling log, and found the following warnings:
pulsecore/hashmap.c: In function 'remove_entry':
pulsecore/hashmap.c:94:9: warning: cast increases required alignment of target
type [-Wcast-align]
pulsecore/hashmap.c: In function 'hash_scan':
pulsecore/hashmap.c:116:14: warning: cast increases required alignment of
target type [-Wcast-align]
pulsecore/hashmap.c: In function 'pa_hashmap_put':
pulsecore/hashmap.c:141:22: warning: cast increases required alignment of
target type [-Wcast-align]
pulsecore/hashmap.c:143:9: warning: cast increases required alignment of target
type [-Wcast-align]
pulsecore/hashmap.c:144:9: warning: cast increases required alignment of target
type [-Wcast-align]
pulsecore/hashmap.c:145:5: warning: cast increases required alignment of target
type [-Wcast-align]

These files are included in libpulsecommon.so

Then I have to add -mno-unaligned-access to CLFAGS, then re-compile pulseaudio
again. I replaced the original one with newly compiled libpulsecommon.so,
leaving other libraries untouched, everything goes well without any issue.

So I think this must be an unaligned memory access issue in libpulsecommon.so

Please help to fix this!!</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>