<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>


<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">

<p class="details" style="font-style: italic; color: #777;">
<a href="https://gitlab.com/AndreasFuchsSIT">Andreas Fuchs</a> created an issue:
</p>
<div></div>
<h2 dir="auto">
<a id="user-content-description-of-problem" class="anchor" href="#description-of-problem" aria-hidden="true"></a>Description of problem:</h2>
<p dir="auto">Calling <code>p11tool --list-tokens</code> hangs indefinitely; but only when compiled using clang using gcc succeeds as expected.</p>
<h2 dir="auto">
<a id="user-content-version-of-gnutls-used" class="anchor" href="#version-of-gnutls-used" aria-hidden="true"></a>Version of gnutls used:</h2>
<p dir="auto">3.6.10-1.fc30.x86_64</p>
<h2 dir="auto">
<a id="user-content-distributor-of-gnutls-eg-ubuntu-fedora-rhel" class="anchor" href="#distributor-of-gnutls-eg-ubuntu-fedora-rhel" aria-hidden="true"></a>Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)</h2>
<p dir="auto">Fedora 30 Docker</p>
<h2 dir="auto">
<a id="user-content-how-reproducible" class="anchor" href="#how-reproducible" aria-hidden="true"></a>How reproducible:</h2>
<p dir="auto">This branch introduces a p11tool based test to our CI system:
<a href="https://github.com/AndreasFuchsSIT/tpm2-pkcs11/tree/p11tool_tests" rel="nofollow noreferrer noopener" target="_blank">https://github.com/AndreasFuchsSIT/tpm2-pkcs11/tree/p11tool_tests</a></p>
<p dir="auto">This is the build by travis:
<a href="https://travis-ci.org/github/AndreasFuchsSIT/tpm2-pkcs11/builds/669628934" rel="nofollow noreferrer noopener" target="_blank">https://travis-ci.org/github/AndreasFuchsSIT/tpm2-pkcs11/builds/669628934</a></p>
<p dir="auto">To test locally:</p>
<pre class="code highlight js-syntax-highlight shell" lang="shell" v-pre="true"><code><span id="LC1" class="line" lang="shell"><span class="nb">cd </span>tpm2-pkcs11 <span class="c">#and switch to branch</span></span>
<span id="LC2" class="line" lang="shell">docker run <span class="nt">--cap-add</span><span class="o">=</span>SYS_PTRACE <span class="nt">-it</span> <span class="nt">--env-file</span> <span class="s2">"</span><span class="nv">$PWD</span><span class="s2">/.ci/docker.env"</span> <span class="se">\</span></span>
<span id="LC3" class="line" lang="shell">    <span class="nt">-v</span> <span class="s2">"</span><span class="nv">$PWD</span><span class="s2">:/workspace/tpm2-pkcs11"</span> <span class="s2">"tpm2software/tpm2-tss:fedora-30"</span> <span class="se">\</span></span>
<span id="LC4" class="line" lang="shell">    /bin/bash</span>
<span id="LC5" class="line" lang="shell"><span class="c">#inside docker</span></span>
<span id="LC6" class="line" lang="shell"><span class="nb">export </span><span class="nv">CC</span><span class="o">=</span>clang</span>
<span id="LC7" class="line" lang="shell">./.ci/docker.run</span></code></pre>
<p dir="auto">Note: if you <code>export CC=gcc</code> the p11tool tests succeed</p>
<h2 dir="auto">
<a id="user-content-actual-results" class="anchor" href="#actual-results" aria-hidden="true"></a>Actual results:</h2>
<p dir="auto">Program hangs indefinitely.</p>
<p dir="auto">Calltrace:</p>
<pre class="code highlight js-syntax-highlight c" lang="c" v-pre="true"><code><span id="LC1" class="line" lang="c"><span class="err">$</span> <span class="n">gdb</span> <span class="o">-</span><span class="n">p</span> <span class="err">$</span><span class="p">(</span><span class="n">pidof</span> <span class="n">p11tool</span> <span class="o">|</span> <span class="n">cut</span> <span class="o">-</span><span class="n">d</span> <span class="s">" "</span> <span class="o">-</span><span class="n">f</span> <span class="mi">1</span><span class="p">)</span></span>
<span id="LC2" class="line" lang="c"><span class="p">[...</span> <span class="n">a</span> <span class="n">bunch</span> <span class="n">of</span> <span class="n">symbol</span> <span class="n">resolutions</span> <span class="p">...]</span></span>
<span id="LC3" class="line" lang="c"><span class="p">(</span><span class="n">gdb</span><span class="p">)</span> <span class="n">bt</span></span>
<span id="LC4" class="line" lang="c"><span class="cp">#0  futex_abstimed_wait (private=0, abstime=0x0, expected=2, futex_word=<optimized out>) at ../sysdeps/unix/sysv/linux/futex-internal.h:172</span></span>
<span id="LC5" class="line" lang="c"><span class="cp">#1  __pthread_rwlock_wrlock_full (abstime=0x0, rwlock=0x7f0f026779a0 <__libc_setlocale_lock>) at pthread_rwlock_common.c:807</span></span>
<span id="LC6" class="line" lang="c"><span class="cp">#2  __GI___pthread_rwlock_wrlock (rwlock=0x7f0f026779a0 <__libc_setlocale_lock>) at pthread_rwlock_wrlock.c:27</span></span>
<span id="LC7" class="line" lang="c"><span class="cp">#3  0x00007f0f024e5ab7 in __newlocale (category_mask=<optimized out>, category_mask@entry=8127, locale=locale@entry=0x7f0eff1bfd61 "POSIX", base=<optimized out>, base@entry=0x0) at newlocale.c:163</span></span>
<span id="LC8" class="line" lang="c"><span class="cp">#4  0x00007f0eff1b66a1 in p11_library_init_impl () at ../common/library.c:160</span></span>
<span id="LC9" class="line" lang="c"><span class="cp">#5  0x00007f0f03344f4a in call_init (l=<optimized out>, argc=argc@entry=4, argv=argv@entry=0x7ffc034f5cb8, env=env@entry=0x7ffc034f5ce0) at dl-init.c:72</span></span>
<span id="LC10" class="line" lang="c"><span class="cp">#6  0x00007f0f03345051 in call_init (env=0x7ffc034f5ce0, argv=0x7ffc034f5cb8, argc=4, l=<optimized out>) at dl-init.c:30</span></span>
<span id="LC11" class="line" lang="c"><span class="cp">#7  _dl_init (main_map=main_map@entry=0x61a000000080, argc=4, argv=0x7ffc034f5cb8, env=0x7ffc034f5ce0) at dl-init.c:119</span></span>
<span id="LC12" class="line" lang="c"><span class="cp">#8  0x00007f0f03348fae in dl_open_worker (a=a@entry=0x7ffc034f4dc0) at dl-open.c:510</span></span>
<span id="LC13" class="line" lang="c"><span class="cp">#9  0x00007f0f025ece09 in __GI__dl_catch_exception (exception=exception@entry=0x7ffc034f4da0, operate=operate@entry=0x7f0f03348bc0 <dl_open_worker>, args=args@entry=0x7ffc034f4dc0) at dl-error-skeleton.c:196</span></span>
<span id="LC14" class="line" lang="c"><span class="cp">#10 0x00007f0f0334882e in _dl_open (file=0x604000000510 "/usr/lib64/pkcs11/p11-kit-trust.so", mode=-2147483646, caller_dlopen=0x7f0f02910c74 <__interceptor_dlopen(char const*, int)+244>, nsid=-2, argc=4, </span></span>
<span id="LC15" class="line" lang="c">    <span class="n">argv</span><span class="o">=<</span><span class="n">optimized</span> <span class="n">out</span><span class="o">></span><span class="p">,</span> <span class="n">env</span><span class="o">=</span><span class="mh">0x7ffc034f5ce0</span><span class="p">)</span> <span class="n">at</span> <span class="n">dl</span><span class="o">-</span><span class="n">open</span><span class="p">.</span><span class="n">c</span><span class="o">:</span><span class="mi">592</span></span>
<span id="LC16" class="line" lang="c"><span class="cp">#11 0x00007f0f0229b39c in dlopen_doit (a=a@entry=0x7ffc034f4fe0) at dlopen.c:66</span></span>
<span id="LC17" class="line" lang="c"><span class="cp">#12 0x00007f0f025ece09 in __GI__dl_catch_exception (exception=exception@entry=0x7ffc034f4f80, operate=operate@entry=0x7f0f0229b340 <dlopen_doit>, args=args@entry=0x7ffc034f4fe0) at dl-error-skeleton.c:196</span></span>
<span id="LC18" class="line" lang="c"><span class="cp">#13 0x00007f0f025ecea3 in __GI__dl_catch_error (objname=objname@entry=0x7f0f032aedb0 <alloc_memory_for_dlsym+16>, errstring=errstring@entry=0x7f0f032aedb8 <alloc_memory_for_dlsym+24>, </span></span>
<span id="LC19" class="line" lang="c">    <span class="n">mallocedp</span><span class="o">=</span><span class="n">mallocedp</span><span class="err">@</span><span class="n">entry</span><span class="o">=</span><span class="mh">0x7f0f032aeda8</span> <span class="o"><</span><span class="n">alloc_memory_for_dlsym</span><span class="o">+</span><span class="mi">8</span><span class="o">></span><span class="p">,</span> <span class="n">operate</span><span class="o">=</span><span class="n">operate</span><span class="err">@</span><span class="n">entry</span><span class="o">=</span><span class="mh">0x7f0f0229b340</span> <span class="o"><</span><span class="n">dlopen_doit</span><span class="o">></span><span class="p">,</span> <span class="n">args</span><span class="o">=</span><span class="n">args</span><span class="err">@</span><span class="n">entry</span><span class="o">=</span><span class="mh">0x7ffc034f4fe0</span><span class="p">)</span> <span class="n">at</span> <span class="n">dl</span><span class="o">-</span><span class="n">error</span><span class="o">-</span><span class="n">skeleton</span><span class="p">.</span><span class="n">c</span><span class="o">:</span><span class="mi">215</span></span>
<span id="LC20" class="line" lang="c"><span class="cp">#14 0x00007f0f0229bb09 in _dlerror_run (operate=operate@entry=0x7f0f0229b340 <dlopen_doit>, args=args@entry=0x7ffc034f4fe0) at dlerror.c:170</span></span>
<span id="LC21" class="line" lang="c"><span class="cp">#15 0x00007f0f0229b42a in __dlopen (file=<optimized out>, mode=<optimized out>) at dlopen.c:87</span></span>
<span id="LC22" class="line" lang="c"><span class="cp">#16 0x00007f0f02910c74 in __interceptor_dlopen (filename=0x604000000510 "/usr/lib64/pkcs11/p11-kit-trust.so", flag=2)</span></span>
<span id="LC23" class="line" lang="c">    <span class="n">at</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">src</span><span class="o">/</span><span class="n">debug</span><span class="o">/</span><span class="n">compiler</span><span class="o">-</span><span class="n">rt</span><span class="o">-</span><span class="mi">8</span><span class="p">.</span><span class="mi">0</span><span class="p">.</span><span class="mi">0</span><span class="o">-</span><span class="mi">1</span><span class="p">.</span><span class="n">fc30</span><span class="p">.</span><span class="n">x86_64</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">asan</span><span class="o">/</span><span class="p">..</span><span class="o">/</span><span class="n">sanitizer_common</span><span class="o">/</span><span class="n">sanitizer_common_interceptors</span><span class="p">.</span><span class="n">inc</span><span class="o">:</span><span class="mi">5969</span></span>
<span id="LC24" class="line" lang="c"><span class="cp">#17 0x00007f0f0202b4fc in dlopen_and_get_function_list (funcs=0x7ffc034f58a0, path=0x604000000510 "/usr/lib64/pkcs11/p11-kit-trust.so", mod=0x617000000080) at ../p11-kit/modules.c:429</span></span>
<span id="LC25" class="line" lang="c"><span class="cp">#18 load_module_from_file_inlock (path=0x604000000510 "/usr/lib64/pkcs11/p11-kit-trust.so", result=result@entry=0x7ffc034f5928, name=<optimized out>) at ../p11-kit/modules.c:429</span></span>
<span id="LC26" class="line" lang="c"><span class="cp">#19 0x00007f0f0202baa7 in take_config_and_load_module_inlock (verbose=false, critical=false, config=0x7ffc034f5920, name=0x7ffc034f5918) at ../p11-kit/modules.c:597</span></span>
<span id="LC27" class="line" lang="c"><span class="cp">#20 load_registered_modules_unlocked (flags=flags@entry=0) at ../p11-kit/modules.c:682</span></span>
<span id="LC28" class="line" lang="c"><span class="cp">#21 0x00007f0f0202c89f in load_registered_modules_unlocked (flags=0) at ../p11-kit/modules.c:2032</span></span>
<span id="LC29" class="line" lang="c"><span class="cp">#22 p11_modules_load_inlock_reentrant (flags=0, results=0x7ffc034f5a20) at ../p11-kit/modules.c:1987</span></span>
<span id="LC30" class="line" lang="c"><span class="cp">#23 0x00007f0f0202c927 in p11_kit_modules_load (reserved=0x0, flags=0) at ../p11-kit/modules.c:2092</span></span>
<span id="LC31" class="line" lang="c"><span class="cp">#24 0x00007f0f0202ccb2 in p11_kit_modules_load_and_initialize (flags=flags@entry=0) at ../p11-kit/modules.c:2216</span></span>
<span id="LC32" class="line" lang="c"><span class="cp">#25 0x00007f0f0274c3ca in auto_load (trusted=trusted@entry=0) at pkcs11.c:933</span></span>
<span id="LC33" class="line" lang="c"><span class="cp">#26 0x00007f0f0274de37 in gnutls_pkcs11_init (flags=1, deprecated_config_file=0x0) at pkcs11.c:1006</span></span>
<span id="LC34" class="line" lang="c"><span class="cp">#27 0x0000557d8b3c3bf3 in cmd_parser (argv=<optimized out>, argc=8) at p11tool.c:187</span></span>
<span id="LC35" class="line" lang="c"><span class="cp">#28 main (argc=<optimized out>, argv=<optimized out>) at p11tool.c:75</span></span></code></pre>
<h2 dir="auto">
<a id="user-content-expected-results" class="anchor" href="#expected-results" aria-hidden="true"></a>Expected results:</h2>
<p dir="auto">Modules are loaded and tokens listed</p>

</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #777;">

<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/-/issues/965">view it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can
<a href="https://gitlab.com/-/sent_notifications/e46513bf64987a5348871578ff541016/unsubscribe">unsubscribe</a>
from this thread or
adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.com/gnutls/gnutls/-/issues/965"}}</script>


</p>
</div>
</body>
</html>