glibc:fw/bug25112

Last commit made on 2019-10-29
Get this branch:
git clone -b fw/bug25112 https://git.launchpad.net/glibc

Branch merges

Branch information

Name:
fw/bug25112
Repository:
lp:glibc

Recent commits

8c59ed1... by Florian Weimer on 2019-10-28

Remove all loaded objects if dlopen fails [BZ #20839]

93e07b2... by Florian Weimer on 2019-10-28

Avoid late dlopen failure due to scope, TLS slotinfo updates [BZ #25112]

This change splits the scope and TLS slotinfo updates in dlopen into
two parts: one to resize the data structures, and one to actually apply
the update. The call to add_to_global_prepare in dl_open_worker is moved
before the demarcation point at which no further memory allocations are
allowed.

_dl_add_to_slotinfo is adjusted to make the list update optional. There
is some optimization possibility here because we could grow the slotinfo
list of arrays in a single call, one the largest TLS modid is known.

This commit does not fix the fatal meory allocation failure in
_dl_update_slotinfo. Ideally, this error during dlopen should be
recoverable.

The update order of scopes and TLS data structures is retained, although
it appears to be more correct to fully initialize TLS first, and then
expose symbols in the newly loaded objects via the scope update.

Tested on x86_64-linux-gnu.

f0ead7b... by Florian Weimer on 2019-10-17

Avoid late failure in dlopen in global scope update [BZ #25112]

The call to add_to_global in dl_open_worker happens after running ELF
constructors for new objects. At this point, proper recovery from
malloc failure would be quite complicated: We would have to run the
ELF destructors and close all opened objects, something that we
currently do not do.

Instead, this change splits add_to_global into two phases,
add_to_global_prepare (which can raise an exception, called before ELF
constructors run), and add_to_global_finish (which cannot, called
after ELF constructors). A complication arises due to recursive
dlopen: After the inner dlopen consumes some space, the pre-allocation
in the outer dlopen may no longer be sufficient. A new member in the
namespace structure, _ns_global_scope_pending_adds keeps track of the
maximum number of objects that need to be added to the global scope.
This enables the inner add_to_global_prepare call to take into account
the needs of an outer dlopen.

Most code in the dynamic linker assumes that the number of global
scope entries fits into an unsigned int (matching the r_nlist member
of struct r_scop_elem). Therefore, change the type of
_ns_global_scope_alloc to unsigned int (from size_t), and add overflow
checks.

Tested on x86_64-linux-gnu and i686-linux-gnu.

7f1de88... by Florian Weimer on 2019-10-17

Lazy binding failures during dlopen/dlclose must be fatal [BZ #24304]

If a lazy binding failure happens during the execution of an ELF
constructor or destructor, the dynamic loader catches the error
and reports it using the dlerror mechanism. This is undesirable
because there could be other constructors and destructors that
need processing (which are skipped), and the process is in an
inconsistent state at this point. Therefore, we have to issue
a fatal dynamic loader error error and terminate the process.

To temporarily disable exception handling (turning exceptions
into fatal errors), _dl_catch_exception is changed to accept
a null exception argument, which indicates that it should call
the operate function with exception handling disabled.

_dl_fini does not need changes because it does not install an error
handler, so errors are already fatal there.

Tested on x86_64-linux-gnu and i686-linux-gnu.

7d3db43... by Florian Weimer on 2019-10-17

Rename and split elf/tst-dlopen-aout collection of tests

From the beginning, elf/tst-dlopen-aout has exercised two different
bugs: (a) failure to report errors for a dlopen of the executable
itself in some cases (bug 24900) and (b) incorrect rollback of the
TLS modid allocation in case of a dlopen failure (bug 16634).

This commit replaces the test with elf/tst-dlopen-self for (a) and
elf/tst-dlopen-tlsmodid for (b). The latter tests use the
elf/tst-dlopen-self binaries (or iconv) with dlopen, so they are
no longer self-dlopen tests.

Tested on x86_64-linux-gnu and i686-linux-gnu, with a toolchain that
does not default to PIE.

eb77a1f... by Florian Weimer on 2019-10-16

dlfcn: Remove remnants of caller sensitivity from dlinfo

dlinfo operates on a specific handle, which means that there is no
caller sensivity involved.

58e8f5f... by Andreas Schwab <email address hidden> on 2019-10-09

ldconfig: handle .dynstr located in separate segment (bug 25087)

To determine the load offset of the DT_STRTAB section search for the
segment containing it, instead of using the load offset of the first
segment.

e7c8ffe... by Florian Weimer on 2019-10-15

ldd: Print "not a dynamic executable" on standard error [BZ #24150]

Tested with the testsuite on x86_64-linux-gnu, and manually.

Reviewed-By: Richard W.M. Jones <email address hidden>

d1e411e... by Joseph Myers <email address hidden> on 2019-10-14

Add PTRACE_GET_SYSCALL_INFO from Linux 5.3 to sys/ptrace.h.

Linux 5.3 adds a PTRACE_GET_SYSCALL_INFO constant, with an associated
structure and PTRACE_SYSCALL_INFO_* constants.

This patch adds these to sys/ptrace.h in glibc
(PTRACE_GET_SYSCALL_INFO in each architecture version, the rest in
bits/ptrace-shared.h). As with previous such constants and associated
structures, the glibc version of the structure is named struct
__ptrace_syscall_info.

Tested for x86_64, and with build-many-glibcs.py.

2e4e757... by Florian Weimer on 2019-10-11

Move ChangeLog to ChangeLog.old/ChangeLog.19

We no longer maintain a manually-written ChangeLog file:

  <https://sourceware.org/ml/libc-alpha/2019-09/msg00333.html>
  <https://sourceware.org/ml/libc-alpha/2019-10/msg00131.html>

Instead the release manager is expected to generate a ChangeLog-like
file using scripts/gitlog_to_changelog.py. For further details,
see commit f2144b7874b23be7c7eb184ec601633ec6fa8fac ("Script to
generate ChangeLog-like output from git log").

Reviewed-by: Carlos O'Donell <email address hidden>