<feed xmlns='http://www.w3.org/2005/Atom'>
<title>glibc/elf/Makefile, branch master</title>
<subtitle>Fork of glibc for development</subtitle>
<id>https://git.zx2c4.com/glibc/atom/elf/Makefile?h=master</id>
<link rel='self' href='https://git.zx2c4.com/glibc/atom/elf/Makefile?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/'/>
<updated>2024-07-04T13:09:07Z</updated>
<entry>
<title>elf: Make dl-rseq-symbols Linux only</title>
<updated>2024-07-04T13:09:07Z</updated>
<author>
<name>Adhemerval Zanella</name>
<email>adhemerval.zanella@linaro.org</email>
</author>
<published>2024-07-04T13:09:07Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=9fc639f654dc004736836613be703e6bed0c36a8'/>
<id>urn:sha1:9fc639f654dc004736836613be703e6bed0c36a8</id>
<content type='text'>
And avoid a Hurd build failures.

Checked on x86_64-linux-gnu.
</content>
</entry>
<entry>
<title>nptl: fix potential merge of __rseq_* relro symbols</title>
<updated>2024-07-03T19:40:30Z</updated>
<author>
<name>Michael Jeanson</name>
<email>mjeanson@efficios.com</email>
</author>
<published>2024-07-03T16:35:34Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=2b92982e2369d292560793bee8e730f695f48ff3'/>
<id>urn:sha1:2b92982e2369d292560793bee8e730f695f48ff3</id>
<content type='text'>
While working on a patch to add support for the extensible rseq ABI, we
came across an issue where a new 'const' variable would be merged with
the existing '__rseq_size' variable. We tracked this to the use of
'-fmerge-all-constants' which allows the compiler to merge identical
constant variables. This means that all 'const' variables in a compile
unit that are of the same size and are initialized to the same value can
be merged.

In this specific case, on 32 bit systems 'unsigned int' and 'ptrdiff_t'
are both 4 bytes and initialized to 0 which should trigger the merge.
However for reasons we haven't delved into when the attribute 'section
(".data.rel.ro")' is added to the mix, only variables of the same exact
types are merged. As far as we know this behavior is not specified
anywhere and could change with a new compiler version, hence this patch.

Move the definitions of these variables into an assembler file and add
hidden writable aliases for internal use. This has the added bonus of
removing the asm workaround to set the values on rseq registration.

Tested on Debian 12 with GCC 12.2.

Signed-off-by: Michael Jeanson &lt;mjeanson@efficios.com&gt;
Reviewed-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Reviewed-by: Florian Weimer &lt;fweimer@redhat.com&gt;
</content>
</entry>
<entry>
<title>elf/rtld: Fix auxiliary vector for enable_secure</title>
<updated>2024-07-03T11:01:44Z</updated>
<author>
<name>Stefan Liebler</name>
<email>stli@linux.ibm.com</email>
</author>
<published>2024-07-02T13:25:20Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=d2f6ceaccbae2f645075dedad2b762896da1ec04'/>
<id>urn:sha1:d2f6ceaccbae2f645075dedad2b762896da1ec04</id>
<content type='text'>
Starting with commit
59974938fe1f4add843f5325f78e2a7ccd8db853
elf/rtld: Count skipped environment variables for enable_secure

The new testcase elf/tst-tunables-enable_secure-env segfaults on s390 (31bit).
There _start parses the auxiliary vector for some additional checks.

Therefore it skips over the zeros after the environment variables ...
0x7fffac20:     0x7fffbd17      0x7fffbd32      0x7fffbd69      0x00000000
------------------------------------------------^^^last environment variable

... and then it parses the auxiliary vector and stops at AT_NULL.
0x7fffac30:     0x00000000      0x00000021      0x00000000      0x00000000
--------------------------------^^^AT_SYSINFO_EHDR--------------^^^AT_NULL
----------------^^^newp-----------------------------------------^^^oldp
Afterwards it tries to access AT_PHDR which points to somewhere and segfaults.

Due to not incorporating the skip_env variable in the computation of oldp
when shuffling down the auxv in rtld.c, it just copies one entry with AT_NULL
and value 0x00000021 and stops the loop.  In reality we have skipped
GLIBC_TUNABLES environment variable (=&gt; skip_env=1). Thus we should copy from
here:
0x7fffac40:     0x00000021      0x7ffff000      0x00000010      0x007fffff
----------------^^^fixed-oldp

This patch fixes the computation of oldp when shuffling down auxiliary vector.
It also adds some checks in the testcase.  Those checks also fail on
s390x (64bit) and x86_64 without the fix.

Co-authored-by: Adhemerval Zanella  &lt;adhemerval.zanella@linaro.org&gt;
Reviewed-by: Adhemerval Zanella  &lt;adhemerval.zanella@linaro.org&gt;
</content>
</entry>
<entry>
<title>elf: Support recursive use of dynamic TLS in interposed malloc</title>
<updated>2024-07-01T17:02:11Z</updated>
<author>
<name>Florian Weimer</name>
<email>fweimer@redhat.com</email>
</author>
<published>2024-07-01T15:42:04Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=018f0fc3b818d4d1460a4e2384c24802504b1d20'/>
<id>urn:sha1:018f0fc3b818d4d1460a4e2384c24802504b1d20</id>
<content type='text'>
It turns out that quite a few applications use bundled mallocs that
have been built to use global-dynamic TLS (instead of the recommended
initial-exec TLS).  The previous workaround from
commit afe42e935b3ee97bac9a7064157587777259c60e ("elf: Avoid some
free (NULL) calls in _dl_update_slotinfo") does not fix all
encountered cases unfortunatelly.

This change avoids the TLS generation update for recursive use
of TLS from a malloc that was called during a TLS update.  This
is possible because an interposed malloc has a fixed module ID and
TLS slot.  (It cannot be unloaded.)  If an initially-loaded module ID
is encountered in __tls_get_addr and the dynamic linker is already
in the middle of a TLS update, use the outdated DTV, thus avoiding
another call into malloc.  It's still necessary to update the
DTV to the most recent generation, to get out of the slow path,
which is why the check for recursion is needed.

The bookkeeping is done using a global counter instead of per-thread
flag because TLS access in the dynamic linker is tricky.

All this will go away once the dynamic linker stops using malloc
for TLS, likely as part of a change that pre-allocates all TLS
during pthread_create/dlopen.

Fixes commit d2123d68275acc0f061e73d5f86ca504e0d5a344 ("elf: Fix slow
tls access after dlopen [BZ #19924]").

Reviewed-by: Szabolcs Nagy &lt;szabolcs.nagy@arm.com&gt;
</content>
</entry>
<entry>
<title>Fix conditionals on mtrace-based tests (bug 31892)</title>
<updated>2024-07-01T15:20:30Z</updated>
<author>
<name>Carlos O'Donell</name>
<email>carlos@redhat.com</email>
</author>
<published>2024-06-19T15:48:05Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=a7fe3e805d2ee128ac5f43b2a24201726d41cc04'/>
<id>urn:sha1:a7fe3e805d2ee128ac5f43b2a24201726d41cc04</id>
<content type='text'>
The conditionals for several mtrace-based tests in catgets, elf, libio,
malloc, misc, nptl, posix, and stdio-common were incorrect leading to
test failures when bootstrapping glibc without perl.

The correct conditional for mtrace-based tests requires three checks:
first checking for run-built-tests, then build-shared, and lastly that
PERL is not equal to "no" (missing perl).
Reviewed-by: Adhemerval Zanella  &lt;adhemerval.zanella@linaro.org&gt;
</content>
</entry>
<entry>
<title>elf: Change module-names to modules-names in comments</title>
<updated>2024-06-14T20:29:21Z</updated>
<author>
<name>H.J. Lu</name>
<email>hjl.tools@gmail.com</email>
</author>
<published>2024-06-14T20:29:21Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=0b7f7842f812e7a70a79ce001e22942f7fe200aa'/>
<id>urn:sha1:0b7f7842f812e7a70a79ce001e22942f7fe200aa</id>
<content type='text'>
module-names should be modules-names.

Signed-off-by: H.J. Lu &lt;hjl.tools@gmail.com&gt;
</content>
</entry>
<entry>
<title>elf/Makefile: Split and sort PIE tests</title>
<updated>2024-05-25T21:53:30Z</updated>
<author>
<name>H.J. Lu</name>
<email>hjl.tools@gmail.com</email>
</author>
<published>2024-05-25T21:53:30Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=ab46c6ba6cc43b18daea6f197030e19303c9f012'/>
<id>urn:sha1:ab46c6ba6cc43b18daea6f197030e19303c9f012</id>
<content type='text'>
Put each item on a separate line and sort PIE tests.

Signed-off-by: H.J. Lu &lt;hjl.tools@gmail.com&gt;
</content>
</entry>
<entry>
<title>elf: Also compile dl-misc.os with $(rtld-early-cflags)</title>
<updated>2024-04-25T15:09:49Z</updated>
<author>
<name>H.J. Lu</name>
<email>hjl.tools@gmail.com</email>
</author>
<published>2024-04-25T15:06:52Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=049b7684c912dd32b67b1b15b0f43bf07d5f512e'/>
<id>urn:sha1:049b7684c912dd32b67b1b15b0f43bf07d5f512e</id>
<content type='text'>
Also compile dl-misc.os with $(rtld-early-cflags) to avoid

Program received signal SIGILL, Illegal instruction.
0x00007ffff7fd36ea in _dl_strtoul (nptr=nptr@entry=0x7fffffffe2c9 "2",
    endptr=endptr@entry=0x7fffffffd728) at dl-misc.c:156
156	  bool positive = true;
(gdb) bt
 #0  0x00007ffff7fd36ea in _dl_strtoul (nptr=nptr@entry=0x7fffffffe2c9 "2",
    endptr=endptr@entry=0x7fffffffd728) at dl-misc.c:156
 #1  0x00007ffff7fdb1a9 in tunable_initialize (
    cur=cur@entry=0x7ffff7ffbc00 &lt;tunable_list+2176&gt;,
    strval=strval@entry=0x7fffffffe2c9 "2", len=len@entry=1)
    at dl-tunables.c:131
 #2  0x00007ffff7fdb3a2 in parse_tunables (valstring=&lt;optimized out&gt;)
    at dl-tunables.c:258
 #3  0x00007ffff7fdb5d9 in __GI___tunables_init (envp=0x7fffffffdd58)
    at dl-tunables.c:288
 #4  0x00007ffff7fe44c3 in _dl_sysdep_start (
    start_argptr=start_argptr@entry=0x7fffffffdcb0,
    dl_main=dl_main@entry=0x7ffff7fe5f80 &lt;dl_main&gt;)
    at ../sysdeps/unix/sysv/linux/dl-sysdep.c:110
 #5  0x00007ffff7fe5cae in _dl_start_final (arg=0x7fffffffdcb0) at rtld.c:494
 #6  _dl_start (arg=0x7fffffffdcb0) at rtld.c:581
 #7  0x00007ffff7fe4b38 in _start ()
(gdb)

when setting GLIBC_TUNABLES in glibc compiled with APX.
Reviewed-by: Florian Weimer &lt;fweimer@redhat.com&gt;
</content>
</entry>
<entry>
<title>elf/rtld: Count skipped environment variables for enable_secure</title>
<updated>2024-04-16T20:32:10Z</updated>
<author>
<name>Joe Simmons-Talbott</name>
<email>josimmon@redhat.com</email>
</author>
<published>2024-04-16T20:31:42Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=59974938fe1f4add843f5325f78e2a7ccd8db853'/>
<id>urn:sha1:59974938fe1f4add843f5325f78e2a7ccd8db853</id>
<content type='text'>
When using the glibc.rtld.enable_secure tunable we need to keep track of
the count of environment variables we skip due to __libc_enable_secure
being set and adjust the auxv section of the stack.  This fixes an
assertion when running ld.so directly with glibc.rtld.enable_secure set.
Add a testcase that ensures the assert is not hit.

elf/rtld.c:1324   assert (auxv == sp + 1);

Reviewed-by: Adhemerval Zanella  &lt;adhemerval.zanella@linaro.org&gt;
</content>
</entry>
<entry>
<title>Revert "x86_64: Suppress false positive valgrind error"</title>
<updated>2024-04-13T15:42:13Z</updated>
<author>
<name>Florian Weimer</name>
<email>fweimer@redhat.com</email>
</author>
<published>2024-04-13T14:17:38Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=aea52e3d2b71e89f2ba4fd4d8f1f8d3036d83c1d'/>
<id>urn:sha1:aea52e3d2b71e89f2ba4fd4d8f1f8d3036d83c1d</id>
<content type='text'>
This reverts commit a1735e0aa858f0c8b15e5ee9975bff4279423680.

The test failure is a real valgrind bug that needs to be fixed before
valgrind is usable with a glibc that has been built with
CC="gcc -march=x86-64-v3".  The proposed valgrind patch teaches
valgrind to replace ld.so strcmp with an unoptimized scalar
implementation, thus avoiding any AVX2-related problems.

Valgrind bug: &lt;https://bugs.kde.org/show_bug.cgi?id=485487&gt;

Reviewed-by: H.J. Lu &lt;hjl.tools@gmail.com&gt;
</content>
</entry>
</feed>
