<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - daemon re-execs itself unnecessarily on startup to disable lazy linking"
href="https://bugs.freedesktop.org/show_bug.cgi?id=104789">104789</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>daemon re-execs itself unnecessarily on startup to disable lazy linking
</td>
</tr>
<tr>
<th>Product</th>
<td>PulseAudio
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>minor
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>daemon
</td>
</tr>
<tr>
<th>Assignee</th>
<td>pulseaudio-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>vivek@collabora.co.uk
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>pulseaudio-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>CC</th>
<td>lennart@poettering.net
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=136961" name="attach_136961" title="Patch to #if out the re-exec code when the linker supports ‘-z now’">attachment 136961</a> <a href="attachment.cgi?id=136961&action=edit" title="Patch to #if out the re-exec code when the linker supports ‘-z now’">[details]</a></span> <a href='page.cgi?id=splinter.html&bug=104789&attachment=136961'>[review]</a>
Patch to #if out the re-exec code when the linker supports ‘-z now’
Hi:
While debugging an unrelated matter, I noticed that pulseaudio was
re-execing itself very soon after startup. Upon investigating further
I discovered this:
src/daemon/main.c:398
============================================================================
#if defined(__linux__) && defined(__OPTIMIZE__)
/*
Disable lazy relocations to make usage of external libraries
more deterministic for our RT threads. We abuse __OPTIMIZE__ as
a check whether we are a debug build or not. This all is
admittedly a bit snake-oilish.
*/
if (!getenv("LD_BIND_NOW")) {
⋮
pa_set_env("LD_BIND_NOW", "1");
if ((canonical_rp = pa_realpath(PA_BINARY))) {
if ((rp = pa_readlink("/proc/self/exe"))) {
if (pa_streq(rp, canonical_rp))
pa_assert_se(execv(rp, argv) == 0)
============================================================================
However pulseaudio is linked with ‘-z now’:
vivek@noise:~$ readelf -a $(which pulseaudio) | grep NOW
0x000000000000001e (FLAGS) BIND_NOW
0x000000006ffffffb (FLAGS_1) Flags: NOW PIE
So relocations will happen early anyway, making the re-exec (I believe)
unnecessary.</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>