]> git.ipfire.org Git - thirdparty/glibc.git/commit
elf: Refine direct extern access diagnostics to protected symbol
authorFangrui Song <maskray@google.com>
Tue, 14 Jun 2022 20:07:27 +0000 (13:07 -0700)
committerFangrui Song <maskray@google.com>
Tue, 14 Jun 2022 20:07:27 +0000 (13:07 -0700)
commit7374c02b683b7110b853a32496a619410364d70b
treed151b18dc2148f2a62961cf87b05618388484d5e
parent876cdf517d1c464ce3d8f7eaf4199565e5592f16
elf: Refine direct extern access diagnostics to protected symbol

Refine commit 349b0441dab375099b1d7f6909c1742286a67da9:

1. Copy relocations for extern protected data do not work properly,
regardless whether GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS is used.
It makes sense to produce a warning unconditionally.

2. Non-zero value of an undefined function symbol may break pointer
equality, but may be benign in many cases (many programs don't take the
address in the shared object then compare it with the address in the
executable).  Reword the diagnostic to be clearer.

3. Remove the unneeded condition !(undef_map->l_1_needed &
GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS). If the executable does
not not have GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS (can only
occur in error cases), the diagnostic should be emitted as well.

When the defining shared object has
GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS, report an error to apply
the intended enforcement.
sysdeps/generic/dl-protected.h