Commit d8ae8c6
ldso: harden _dl_tls_get_addr_soft against an unusable DTV
_dl_tls_get_addr_soft (used to fill dl_phdr_info::dlpi_tls_data) is
reached from dl_iterate_phdr, which the unwinder calls during stack
unwinding - including pthread cancellation. In such a context the
calling thread may have no usable thread pointer / DTV, so THREAD_DTV()
can return a near-null bogus pointer and the dtv[-1] dereference faults.
This crashed tst-cancel7, where a thread is cancelled inside system().
dlpi_tls_data is optional information for callers such as libsanitizer,
so return NULL when the DTV pointer is obviously invalid instead of
dereferencing it.
Signed-off-by: Ramin Moussavi <ramin.moussavi@yacoub.de>1 parent 1458f5c commit d8ae8c6
1 file changed
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
900 | 900 | | |
901 | 901 | | |
902 | 902 | | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
903 | 909 | | |
| 910 | + | |
| 911 | + | |
904 | 912 | | |
905 | 913 | | |
906 | 914 | | |
| |||
0 commit comments