diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2020-01-16 06:45:36 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-01-16 07:41:53 -0800 |
commit | 5177d85b0c050a2333a0c4165c938dd422013d05 (patch) | |
tree | 533626a2adbf4ce776a29919150d21d1b5925126 /elf | |
parent | 791a08cf378db8cc99baa8c63746c9d2885e7f9a (diff) | |
download | glibc-5177d85b0c050a2333a0c4165c938dd422013d05.tar.gz glibc-5177d85b0c050a2333a0c4165c938dd422013d05.tar.xz glibc-5177d85b0c050a2333a0c4165c938dd422013d05.zip |
Clear GL(dl_initfirst) when freeing its link_map memory [BZ# 25396]
We should clear GL(dl_initfirst) when freeing its link_map memory. Tested on Fedora 31/x86-64 with CET. Reviewed-by: Florian Weimer <fweimer@redhat.com>
Diffstat (limited to 'elf')
-rw-r--r-- | elf/dl-close.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c index 104c299209..73b2817bbf 100644 --- a/elf/dl-close.c +++ b/elf/dl-close.c @@ -756,6 +756,10 @@ _dl_close_worker (struct link_map *map, bool force) if (imap->l_runpath_dirs.dirs != (void *) -1) free (imap->l_runpath_dirs.dirs); + /* Clear GL(dl_initfirst) when freeing its link_map memory. */ + if (imap == GL(dl_initfirst)) + GL(dl_initfirst) = NULL; + free (imap); } } |