glibc:fw/bug25486

Last commit made on 2020-02-15
Get this branch:
git clone -b fw/bug25486 https://git.launchpad.net/glibc

Branch merges

Branch information

Name:
fw/bug25486
Repository:
lp:glibc

Recent commits

0552fff... by Florian Weimer on 2020-02-15

elf: Rework exception handling in the dynamic loader [BZ #25486]

The old exception handling implementation used function interposition
to replace the dynamic loader implementation (no TLS support) with the
libc implementation (TLS support). This results in problems if the
link order between the dynamic loader and libc is reversed (bug 25486).

The new implementation moves the entire implementation of the
exception handling functions back into the dynamic loader, using
THREAD_GETMEM and THREAD_SETMEM for thread-local data support.
These depends on Hurd support for these macros, added in commit
b65a82e4e757c1e6cb7073916 ("hurd: Add THREAD_GET/SETMEM/_NC").

One small obstacle is that the exception handling facilities are used
before the TCB has been set up, so a check is needed if the TCB is
available. If not, a regular global variable is used to store the
exception handling information.

Also rename dl-error.c to dl-catch.c, to avoid confusion with the
dlerror function.

cecc925... by Florian Weimer on 2020-02-15

scripts/localplt.awk: Handle DT_JMPREL with empty PLT (for C-SKY)

On csky-linux-gnuabiv2, binutils 2.33 produces a DT_JMPREL entry
for the dynamic loader if it does not contain any PLT relocations:

Dynamic section at offset 0x1df48 contains 19 entries:
  Tag Type Name/Value
 0x0000000e (SONAME) Library soname: [ld-linux-cskyv2-hf.so.1]
 0x00000004 (HASH) 0xd4
 0x6ffffef5 (GNU_HASH) 0x1a8
 0x00000005 (STRTAB) 0x4ac
 0x00000006 (SYMTAB) 0x28c
 0x0000000a (STRSZ) 527 (bytes)
 0x0000000b (SYMENT) 16 (bytes)
 0x00000003 (PLTGOT) 0x1f000
 0x00000002 (PLTRELSZ) 0 (bytes)
 0x00000014 (PLTREL) RELA
 0x00000017 (JMPREL) 0xaa4
 0x00000007 (RELA) 0x75c
 0x00000008 (RELASZ) 840 (bytes)
 0x00000009 (RELAENT) 12 (bytes)
 0x6ffffffc (VERDEF) 0x700
 0x6ffffffd (VERDEFNUM) 3
 0x6ffffff0 (VERSYM) 0x6bc
 0x6ffffff9 (RELACOUNT) 68
 0x00000000 (NULL) 0x0

This confuses the script:

Unexpected output from check-localplt: …/elf/ld.so.jmprel:
*** DT_JMPREL does not match any section's address

This commit changes the script to record the DT_PLTRELSZ value and
reject DT_JMPREL values not a section boundary only if DT_PLTRELSZ
is present with a non-zero value.

d3397c7... by Florian Weimer on 2020-02-15

ld.so: Export tls_init_tp_called as __rtld_tls_init_tp_called

This allows the rest of dynamic loader to check whether the TCB
has been set up (and THREAD_GETMEM and THREAD_SETMEM will work).

ca843de... by Samuel thibault on 2020-02-15

htl: Only check pthread_self coherency when DEBUG is set

htl has been widely tested for a long time now with this coherency
checked successfully.

b65a82e... by Samuel thibault on 2020-02-15

hurd: Add THREAD_GET/SETMEM/_NC

Store them in the TCB, and use them for accessing _hurd_sigstate.

fe66db9... by Samuel thibault on 2020-02-15

hurd tls: update comment about fields at the end of tcbhead

3a0eccc... by Florian Weimer on 2020-02-08

ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486]

Exporting functions and relying on symbol interposition from libc.so
makes the choice of implementation dependent on DT_NEEDED order, which
is not what some compiler drivers expect.

This commit replaces one magic mechanism (symbol interposition) with
another one (preprocessor-/compiler-based redirection). This makes
the hand-over from the minimal malloc to the full malloc more
explicit.

Removing the ABI symbols is backwards-compatible because libc.so is
always in scope, and the dynamic loader will find the malloc-related
symbols there since commit f0b2132b35248c1f4a80f62a2c38cddcc802aa8c
("ld.so: Support moving versioned symbols between sonames
[BZ #24741]").

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

2efa52c... by Florian Weimer on 2020-02-08

Remove weak declaration of free from <inline-hashtab.h>

elf/dl-minimal.c provides a definition of free, so the function
pointer is always non-null, even before the final relocation
of the loader.

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

c76147a... by Florian Weimer on 2020-02-08

elf: Extract _dl_sym_post, _dl_sym_find_caller_map from elf/dl-sym.c

The definitions are moved into a new file, elf/dl-sym-post.h, so that
this code can be used by the dynamic loader as well.

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

abcc039... by Florian Weimer on 2020-02-07

elf: Introduce the rtld-stubbed-symbols makefile variable

This generalizes a mechanism used for stack-protector support, so
that it can be applied to other symbols if required.

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