<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    We have seen severe mutex issues with sasl_client init on super-fast
    machines.    We temporarily solved it by patching openldap to ensure
    it never calls sasl_client_init more than once,  but when I get out
    from under my current non-cyrus-sasl load, I had planned to test and
    submit changes to sasl_*_init to use a static mutext that is
    pre-initialized, which is what I found online as the solution for
    LIBRARY issues with passed in or even local mutexts.<br>
    <div class="moz-forward-container"> <br>
      The issue is that the mutex needs a mutex, which needs a mutex,
      and it's turtles all the way down unless a static mutex is used at
      that top level.<br>
      <br>
      For some reason I have not understood, I've been told to not even
      THINK of doing anything like that to the mutexes used in gssapi.<br>
      <br>
      <br>
      <div class="moz-cite-prefix">On 12/10/2018 7:53 AM, Alexander
        Sagen wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:cyrusimap%2Fcyrus-sasl%2Fissues%2F547@github.com">
        <meta http-equiv="content-type" content="text/html;
          charset=UTF-8">
        <p>Trying to set up a temporary shared email server to replace
          an old server with a dying disk while we move all our
          customers to a new email solution. Configured saslauthd the
          same way it was configured on the old server.</p>
        <p>Somehow, during the authentication process, saslauthd manages
          to segfault, seemingly due to a mutex lock issue.</p>
        <p>Installed latest sasl2-bin (version 2.1.27) from APT (source:
          <a href="http://eu-central-1.ec2.archive.ubuntu.com/ubuntu"
            rel="nofollow" moz-do-not-send="true">http://eu-central-1.ec2.archive.ubuntu.com/ubuntu</a>
          bionic/main amd64 Packages).</p>
        <p>Running linux kernel 4.15.0-1021-aws.</p>
        <p>gdb output during crash:</p>
        <pre><code>root@mail1:~# gdb --args /usr/sbin/saslauthd -a pam -c -m /var/spool/postfix/var/run/saslauthd -r -n 0 -d
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <a class="moz-txt-link-rfc2396E" href="http://gnu.org/licenses/gpl.html" moz-do-not-send="true"><http://gnu.org/licenses/gpl.html></a>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<a class="moz-txt-link-rfc2396E" href="http://www.gnu.org/software/gdb/bugs/" moz-do-not-send="true"><http://www.gnu.org/software/gdb/bugs/></a>.
Find the GDB manual and other documentation resources online at:
<a class="moz-txt-link-rfc2396E" href="http://www.gnu.org/software/gdb/documentation/" moz-do-not-send="true"><http://www.gnu.org/software/gdb/documentation/></a>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/sbin/saslauthd...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/sbin/saslauthd -a pam -c -m /var/spool/postfix/var/run/saslauthd -r -n 0 -d
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
saslauthd[4767] :num_procs  : 0
saslauthd[4767] :mech_option: NULL
saslauthd[4767] :run_path   : /var/spool/postfix/var/run/saslauthd
saslauthd[4767] :auth_mech  : pam
saslauthd[4767] :mmaped shared memory segment on file: /var/spool/postfix/var/run/saslauthd/cache.mmap
saslauthd[4767] :bucket size: 96 bytes
saslauthd[4767] :stats size : 36 bytes
saslauthd[4767] :timeout    : 28800 seconds
saslauthd[4767] :cache table: 985828 total bytes
saslauthd[4767] :cache table: 1711 slots
saslauthd[4767] :cache table: 10266 buckets
saslauthd[4767] :flock file opened at /var/spool/postfix/var/run/saslauthd/cache.flock
saslauthd[4767] :master pid is: 0
saslauthd[4767] :listening on socket: /var/spool/postfix/var/run/saslauthd/mux
saslauthd[4767] :attempting a read lock on slot: 1501
saslauthd[4767] :[<a class="moz-txt-link-abbreviated" href="mailto:login=someuser@example.com" moz-do-not-send="true">login=someuser@example.com</a>] [service=smtp] [realm=example.com]: not found, update pending
saslauthd[4767] :attempting to release lock on slot: 1501

Program received signal SIGSEGV, Segmentation fault.
__GI___pthread_mutex_lock (mutex=0x20) at ../nptl/pthread_mutex_lock.c:65
65      ../nptl/pthread_mutex_lock.c: No such file or directory.
(gdb)
</code></pre>
        <p>saslauthd configuration:</p>
        <pre><code>START=yes
DESC="SASL Authentication Daemon"
NAME="saslauthd"
MECHANISMS="pam"
MECH_OPTIONS=""
THREADS=0
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"
</code></pre>
        <p
          style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>
          You are receiving this because you are subscribed to this
          thread.<br>
          Reply to this email directly, <a
            href="https://github.com/cyrusimap/cyrus-sasl/issues/547"
            moz-do-not-send="true">view it on GitHub</a>, or <a
href="https://github.com/notifications/unsubscribe-auth/AWZUI0ZGTgvWKrnlTVe7ITW3y_TJIodyks5u3oOXgaJpZM4ZLpVt"
            moz-do-not-send="true">mute the thread</a>.<img
src="https://github.com/notifications/beacon/AWZUI4RCAGKMZOvU64A6od9Nl7EyQDD6ks5u3oOXgaJpZM4ZLpVt.gif"
            alt="" moz-do-not-send="true" width="1" height="1"></p>
        <script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/cyrusimap/cyrus-sasl","title":"cyrusimap/cyrus-sasl","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/cyrusimap/cyrus-sasl"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"PAM auth causes segfault for unknown reason (#547)"}],"action":{"name":"View Issue","url":"https://github.com/cyrusimap/cyrus-sasl/issues/547"}}}</script>
        <script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/cyrusimap/cyrus-sasl/issues/547",
"url": "https://github.com/cyrusimap/cyrus-sasl/issues/547",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
},
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"hideOriginalBody": "false",
"originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB",
"title": "PAM auth causes segfault for unknown reason (#547)",
"sections": [
{
"text": "",
"activityTitle": "**Alexander Sagen**",
"activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png",
"activitySubtitle": "@alexrsagen",
"facts": [
{
"name": "Repository: ",
"value": "cyrusimap/cyrus-sasl"
},
{
"name": "Issue #: ",
"value": 547
}
]
}
],
"potentialAction": [
{
"name": "Add a comment",
"@type": "ActionCard",
"inputs": [
{
"isMultiLine": true,
"@type": "TextInput",
"id": "IssueComment",
"isRequired": false
}
],
"actions": [
{
"name": "Comment",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"cyrusimap/cyrus-sasl\",\n\"issueId\": 547,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}"
}
]
},
{
"name": "Close issue",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueClose\",\n\"repositoryFullName\": \"cyrusimap/cyrus-sasl\",\n\"issueId\": 547\n}"
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/cyrusimap/cyrus-sasl/issues/547"
}
],
"@type": "OpenUri",
"name": "View on GitHub"
},
{
"name": "Unsubscribe",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 422483309\n}"
}
],
"themeColor": "26292E"
}
]</script> </blockquote>
      <br>
      <pre class="moz-signature" cols="72">-- 
Jan Parcel, Software Developer
Oracle Systems Server & Cloud Engineering</pre>
    </div>
  </body>
</html>