NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
PR/50277 CVS commit: src
The following reply was made to PR toolchain/50277; it has been noted by GNATS.
From: "Joerg Sonnenberger" <joerg%netbsd.org@localhost>
To: gnats-bugs%gnats.NetBSD.org@localhost
Cc:
Subject: PR/50277 CVS commit: src
Date: Sun, 4 Jun 2023 01:24:59 +0000
Module Name: src
Committed By: joerg
Date: Sun Jun 4 01:24:58 UTC 2023
Modified Files:
src/libexec/ld.elf_so: README.TLS map_object.c rtld.h tls.c
src/libexec/ld.elf_so/arch/aarch64: mdreloc.c
src/libexec/ld.elf_so/arch/alpha: alpha_reloc.c
src/libexec/ld.elf_so/arch/arm: mdreloc.c
src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c
src/libexec/ld.elf_so/arch/i386: mdreloc.c
src/libexec/ld.elf_so/arch/m68k: mdreloc.c
src/libexec/ld.elf_so/arch/mips: mips_reloc.c
src/libexec/ld.elf_so/arch/or1k: mdreloc.c
src/libexec/ld.elf_so/arch/powerpc: ppc_reloc.c
src/libexec/ld.elf_so/arch/riscv: mdreloc.c
src/libexec/ld.elf_so/arch/sh3: mdreloc.c
src/libexec/ld.elf_so/arch/sparc: mdreloc.c
src/libexec/ld.elf_so/arch/sparc64: mdreloc.c
src/libexec/ld.elf_so/arch/x86_64: mdreloc.c
src/tests/libexec/ld.elf_so: t_tls_extern.c
Log Message:
Fix interactions of initial-exec TLS model and dlopen
(1) If an initial-exec relocation was used for a non-local symbol
(i.e. the definition of the symbol is in a different DSO), the
computation of the static TLS offset used the wrong DSO.
This would effectively mean the wrong address was computed
(PR toolchain/50277, PR pkg/57445).
Fix this by forcing the computation of the correct DSO (the one defining
the symbol).
This code uses __UNCONST to avoid the vast interface changes for this
special case.
(2) If symbols from a DSO loaded via dlopen are used with both
global-dynamic/local-dynamic and initial-exec relocations AND
a initial-exec relocation was resolved first in a thread, a split brain
situation could exist where the dynamic relocations would use one memory
block (separate allocation) and the initial-exec relocations the static
per-thread TLS space.
(3) If the initial-exec relocation in (2) is seen after any thread has
already used a GD/LD allocation, bail out. Since IE relocations are used
only in the GOT, this will prevent the dlopen. This is a bit more
aggressive than necessary, but a full blown reference counting doesn't
seem to be justified.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/libexec/ld.elf_so/README.TLS
cvs rdiff -u -r1.66 -r1.67 src/libexec/ld.elf_so/map_object.c
cvs rdiff -u -r1.145 -r1.146 src/libexec/ld.elf_so/rtld.h
cvs rdiff -u -r1.17 -r1.18 src/libexec/ld.elf_so/tls.c
cvs rdiff -u -r1.17 -r1.18 src/libexec/ld.elf_so/arch/aarch64/mdreloc.c
cvs rdiff -u -r1.43 -r1.44 src/libexec/ld.elf_so/arch/alpha/alpha_reloc.c
cvs rdiff -u -r1.45 -r1.46 src/libexec/ld.elf_so/arch/arm/mdreloc.c
cvs rdiff -u -r1.49 -r1.50 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c
cvs rdiff -u -r1.41 -r1.42 src/libexec/ld.elf_so/arch/i386/mdreloc.c
cvs rdiff -u -r1.33 -r1.34 src/libexec/ld.elf_so/arch/m68k/mdreloc.c
cvs rdiff -u -r1.74 -r1.75 src/libexec/ld.elf_so/arch/mips/mips_reloc.c
cvs rdiff -u -r1.3 -r1.4 src/libexec/ld.elf_so/arch/or1k/mdreloc.c
cvs rdiff -u -r1.62 -r1.63 src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c
cvs rdiff -u -r1.8 -r1.9 src/libexec/ld.elf_so/arch/riscv/mdreloc.c
cvs rdiff -u -r1.35 -r1.36 src/libexec/ld.elf_so/arch/sh3/mdreloc.c
cvs rdiff -u -r1.56 -r1.57 src/libexec/ld.elf_so/arch/sparc/mdreloc.c
cvs rdiff -u -r1.69 -r1.70 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c
cvs rdiff -u -r1.47 -r1.48 src/libexec/ld.elf_so/arch/x86_64/mdreloc.c
cvs rdiff -u -r1.11 -r1.12 src/tests/libexec/ld.elf_so/t_tls_extern.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Home |
Main Index |
Thread Index |
Old Index