diff options
author | Florian Weimer <fweimer@redhat.com> | 2020-11-16 19:33:30 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2020-11-16 19:33:30 +0100 |
commit | 1daccf403b1bd86370eb94edca794dc106d02039 (patch) | |
tree | e54bc8ee71eb92b7114df79e2f378a477c470029 /nptl_db/td_thr_validate.c | |
parent | aac0f62c47beee5b546bacc330acc2dd21cda0dc (diff) | |
download | glibc-1daccf403b1bd86370eb94edca794dc106d02039.tar.gz glibc-1daccf403b1bd86370eb94edca794dc106d02039.tar.xz glibc-1daccf403b1bd86370eb94edca794dc106d02039.zip |
nptl: Move stack list variables into _rtld_global
Now __thread_gscope_wait (the function behind THREAD_GSCOPE_WAIT, formerly __wait_lookup_done) can be implemented directly in ld.so, eliminating the unprotected GL (dl_wait_lookup_done) function pointer. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'nptl_db/td_thr_validate.c')
-rw-r--r-- | nptl_db/td_thr_validate.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/nptl_db/td_thr_validate.c b/nptl_db/td_thr_validate.c index c709c5e9be..d2f4107cf2 100644 --- a/nptl_db/td_thr_validate.c +++ b/nptl_db/td_thr_validate.c @@ -20,6 +20,41 @@ #include "thread_dbP.h" #include <stdbool.h> +td_err_e +__td_ta_stack_user (td_thragent_t *ta, psaddr_t *plist) +{ + if (__td_ta_rtld_global (ta)) + return DB_GET_FIELD_ADDRESS (*plist, ta, ta->ta_addr__rtld_global, + rtld_global, _dl_stack_user, 0); + else + { + if (ta->ta_addr__dl_stack_user == 0 + && td_mod_lookup (ta->ph, NULL, SYM__dl_stack_user, + &ta->ta_addr__dl_stack_user) != PS_OK) + return TD_ERR; + *plist = ta->ta_addr__dl_stack_user; + return TD_OK; + } +} + +td_err_e +__td_ta_stack_used (td_thragent_t *ta, psaddr_t *plist) +{ + + if (__td_ta_rtld_global (ta)) + return DB_GET_FIELD_ADDRESS (*plist, ta, ta->ta_addr__rtld_global, + rtld_global, _dl_stack_used, 0); + else + { + if (ta->ta_addr__dl_stack_used == 0 + && td_mod_lookup (ta->ph, NULL, SYM__dl_stack_used, + &ta->ta_addr__dl_stack_used) != PS_OK) + return TD_ERR; + *plist = ta->ta_addr__dl_stack_used; + return TD_OK; + } +} + static td_err_e check_thread_list (const td_thrhandle_t *th, psaddr_t head, bool *uninit) { @@ -62,7 +97,7 @@ td_thr_validate (const td_thrhandle_t *th) /* First check the list with threads using user allocated stacks. */ bool uninit = false; - err = DB_GET_SYMBOL (list, th->th_ta_p, __stack_user); + err = __td_ta_stack_user (th->th_ta_p, &list); if (err == TD_OK) err = check_thread_list (th, list, &uninit); @@ -70,7 +105,7 @@ td_thr_validate (const td_thrhandle_t *th) using implementation allocated stacks. */ if (err == TD_NOTHR) { - err = DB_GET_SYMBOL (list, th->th_ta_p, stack_used); + err = __td_ta_stack_used (th->th_ta_p, &list); if (err == TD_OK) err = check_thread_list (th, list, &uninit); |