History log of /netbsd-current/tests/libexec/ld.elf_so/t_tls_extern.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.16 23-Jul-2024 riastradh

ld.elf_so aarch64/rtld_start.S: Fix dynamic TLS fast path branch.

Bug found and patch prepared by pho@.

PR lib/58154


# 1.15 22-Jul-2024 riastradh

tests/libexec/ld.elf_so/t_tls_extern: Test PR lib/58154.


# 1.14 11-Jul-2024 kre

Alter prev to just explicitly use 0 instead of NULL, so there's no
need to ensure NULL is defined.


# 1.13 11-Jul-2024 kre

Compensate for change in ATF_REQUIRE_MSG

ATF_REQUIRE_MSG() was recently changed so that ATF_REQUIRE_MSG(x =��y, ..)
would generate a warning message, as it probably intended to be x == y.

In ATF_REQUIRE_DL() the use is always ATF_REQUIRE_DL(var = dlopen(...), ...)
where the '=' is certainly not intended to be ==, but is instead checking
that the result of dlopen() is not NULL (while also saving it for later).

Alter the definition of ATF_REQUIRE_DL() to make that explicit.

(The s/\t/ / is just for 80 column police avoidance)


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base
# 1.12 04-Jun-2023 joerg

branches: 1.12.2; 1.12.4;
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.


# 1.11 02-Jun-2023 riastradh

ld.elf_so: Test dynamic-then-static abuse via ctor.

XXX pullup-10


# 1.10 02-Jun-2023 riastradh

ld.elf_so: Test another edge case of mismatched TLS models.

One library defines a symbol and _doesn't_ use it, so it has no
indication of whether the symbol is for static TLS or dynamic TLS,
and then two other libraries use it in different ways.

XXX pullup-10


# 1.9 02-Jun-2023 riastradh

ld.elf_so: tls_extern dynamic_defabuse_eager must xfail differently.

If a symbol has already been resolved as dynamic TLS, any library
that tries to use it as static TLS cannot be dlopened.

XXX pullup-10


# 1.8 01-Jun-2023 riastradh

ld.elf_so: Separately test eager and lazy resolution of def tls ptr.

eager: before loading use library
lazy: after loading use library

XXX pullup-10


# 1.7 01-Jun-2023 riastradh

ld.elf_so: Shorter test names.

No functional non-cosmetic change intended.

XXX pullup-10


# 1.6 01-Jun-2023 riastradh

ld.elf_so: Test TLS abuse of static def, dynamic use and vice versa.

XXX pullup-10


# 1.5 01-Jun-2023 riastradh

ld.elf_so: Factor out logic in TLS tests to make writing more easier.

No functional change intended.

XXX pullup-10


# 1.4 01-Jun-2023 riastradh

ld.elf_so: Test extern dynamic TLS too.

XXX pullup-10


# 1.3 01-Jun-2023 riastradh

ld.elf_so: Test variations on PR toolchain/50277.

XXX pullup-10


# 1.2 31-May-2023 riastradh

ld.elf_so: Fix extern TLS test to match PR toolchain/50277.

Now it's actually testing the problem.


# 1.1 31-May-2023 riastradh

ld.elf_so: New test for extern initial-exec TLS, PR toolchain/50277.

XXX pullup-10


# 1.16 23-Jul-2024 riastradh

ld.elf_so aarch64/rtld_start.S: Fix dynamic TLS fast path branch.

Bug found and patch prepared by pho@.

PR lib/58154


# 1.15 22-Jul-2024 riastradh

tests/libexec/ld.elf_so/t_tls_extern: Test PR lib/58154.


# 1.14 11-Jul-2024 kre

Alter prev to just explicitly use 0 instead of NULL, so there's no
need to ensure NULL is defined.


# 1.13 11-Jul-2024 kre

Compensate for change in ATF_REQUIRE_MSG

ATF_REQUIRE_MSG() was recently changed so that ATF_REQUIRE_MSG(x =��y, ..)
would generate a warning message, as it probably intended to be x == y.

In ATF_REQUIRE_DL() the use is always ATF_REQUIRE_DL(var = dlopen(...), ...)
where the '=' is certainly not intended to be ==, but is instead checking
that the result of dlopen() is not NULL (while also saving it for later).

Alter the definition of ATF_REQUIRE_DL() to make that explicit.

(The s/\t/ / is just for 80 column police avoidance)


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base
# 1.12 04-Jun-2023 joerg

branches: 1.12.2; 1.12.4;
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.


# 1.11 02-Jun-2023 riastradh

ld.elf_so: Test dynamic-then-static abuse via ctor.

XXX pullup-10


# 1.10 02-Jun-2023 riastradh

ld.elf_so: Test another edge case of mismatched TLS models.

One library defines a symbol and _doesn't_ use it, so it has no
indication of whether the symbol is for static TLS or dynamic TLS,
and then two other libraries use it in different ways.

XXX pullup-10


# 1.9 02-Jun-2023 riastradh

ld.elf_so: tls_extern dynamic_defabuse_eager must xfail differently.

If a symbol has already been resolved as dynamic TLS, any library
that tries to use it as static TLS cannot be dlopened.

XXX pullup-10


# 1.8 01-Jun-2023 riastradh

ld.elf_so: Separately test eager and lazy resolution of def tls ptr.

eager: before loading use library
lazy: after loading use library

XXX pullup-10


# 1.7 01-Jun-2023 riastradh

ld.elf_so: Shorter test names.

No functional non-cosmetic change intended.

XXX pullup-10


# 1.6 01-Jun-2023 riastradh

ld.elf_so: Test TLS abuse of static def, dynamic use and vice versa.

XXX pullup-10


# 1.5 01-Jun-2023 riastradh

ld.elf_so: Factor out logic in TLS tests to make writing more easier.

No functional change intended.

XXX pullup-10


# 1.4 01-Jun-2023 riastradh

ld.elf_so: Test extern dynamic TLS too.

XXX pullup-10


# 1.3 01-Jun-2023 riastradh

ld.elf_so: Test variations on PR toolchain/50277.

XXX pullup-10


# 1.2 31-May-2023 riastradh

ld.elf_so: Fix extern TLS test to match PR toolchain/50277.

Now it's actually testing the problem.


# 1.1 31-May-2023 riastradh

ld.elf_so: New test for extern initial-exec TLS, PR toolchain/50277.

XXX pullup-10


# 1.14 11-Jul-2024 kre

Alter prev to just explicitly use 0 instead of NULL, so there's no
need to ensure NULL is defined.


# 1.13 11-Jul-2024 kre

Compensate for change in ATF_REQUIRE_MSG

ATF_REQUIRE_MSG() was recently changed so that ATF_REQUIRE_MSG(x =��y, ..)
would generate a warning message, as it probably intended to be x == y.

In ATF_REQUIRE_DL() the use is always ATF_REQUIRE_DL(var = dlopen(...), ...)
where the '=' is certainly not intended to be ==, but is instead checking
that the result of dlopen() is not NULL (while also saving it for later).

Alter the definition of ATF_REQUIRE_DL() to make that explicit.

(The s/\t/ / is just for 80 column police avoidance)


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base
# 1.12 04-Jun-2023 joerg

branches: 1.12.2; 1.12.4;
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.


# 1.11 02-Jun-2023 riastradh

ld.elf_so: Test dynamic-then-static abuse via ctor.

XXX pullup-10


# 1.10 02-Jun-2023 riastradh

ld.elf_so: Test another edge case of mismatched TLS models.

One library defines a symbol and _doesn't_ use it, so it has no
indication of whether the symbol is for static TLS or dynamic TLS,
and then two other libraries use it in different ways.

XXX pullup-10


# 1.9 02-Jun-2023 riastradh

ld.elf_so: tls_extern dynamic_defabuse_eager must xfail differently.

If a symbol has already been resolved as dynamic TLS, any library
that tries to use it as static TLS cannot be dlopened.

XXX pullup-10


# 1.8 01-Jun-2023 riastradh

ld.elf_so: Separately test eager and lazy resolution of def tls ptr.

eager: before loading use library
lazy: after loading use library

XXX pullup-10


# 1.7 01-Jun-2023 riastradh

ld.elf_so: Shorter test names.

No functional non-cosmetic change intended.

XXX pullup-10


# 1.6 01-Jun-2023 riastradh

ld.elf_so: Test TLS abuse of static def, dynamic use and vice versa.

XXX pullup-10


# 1.5 01-Jun-2023 riastradh

ld.elf_so: Factor out logic in TLS tests to make writing more easier.

No functional change intended.

XXX pullup-10


# 1.4 01-Jun-2023 riastradh

ld.elf_so: Test extern dynamic TLS too.

XXX pullup-10


# 1.3 01-Jun-2023 riastradh

ld.elf_so: Test variations on PR toolchain/50277.

XXX pullup-10


# 1.2 31-May-2023 riastradh

ld.elf_so: Fix extern TLS test to match PR toolchain/50277.

Now it's actually testing the problem.


# 1.1 31-May-2023 riastradh

ld.elf_so: New test for extern initial-exec TLS, PR toolchain/50277.

XXX pullup-10


# 1.12 04-Jun-2023 joerg

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.


# 1.11 02-Jun-2023 riastradh

ld.elf_so: Test dynamic-then-static abuse via ctor.

XXX pullup-10


# 1.10 02-Jun-2023 riastradh

ld.elf_so: Test another edge case of mismatched TLS models.

One library defines a symbol and _doesn't_ use it, so it has no
indication of whether the symbol is for static TLS or dynamic TLS,
and then two other libraries use it in different ways.

XXX pullup-10


# 1.9 02-Jun-2023 riastradh

ld.elf_so: tls_extern dynamic_defabuse_eager must xfail differently.

If a symbol has already been resolved as dynamic TLS, any library
that tries to use it as static TLS cannot be dlopened.

XXX pullup-10


# 1.8 01-Jun-2023 riastradh

ld.elf_so: Separately test eager and lazy resolution of def tls ptr.

eager: before loading use library
lazy: after loading use library

XXX pullup-10


# 1.7 01-Jun-2023 riastradh

ld.elf_so: Shorter test names.

No functional non-cosmetic change intended.

XXX pullup-10


# 1.6 01-Jun-2023 riastradh

ld.elf_so: Test TLS abuse of static def, dynamic use and vice versa.

XXX pullup-10


# 1.5 01-Jun-2023 riastradh

ld.elf_so: Factor out logic in TLS tests to make writing more easier.

No functional change intended.

XXX pullup-10


# 1.4 01-Jun-2023 riastradh

ld.elf_so: Test extern dynamic TLS too.

XXX pullup-10


# 1.3 01-Jun-2023 riastradh

ld.elf_so: Test variations on PR toolchain/50277.

XXX pullup-10


# 1.2 31-May-2023 riastradh

ld.elf_so: Fix extern TLS test to match PR toolchain/50277.

Now it's actually testing the problem.


# 1.1 31-May-2023 riastradh

ld.elf_so: New test for extern initial-exec TLS, PR toolchain/50277.

XXX pullup-10