mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
elf: Keep using minimal malloc after early DTV resize (bug 32412)
If an auditor loads many TLS-using modules during startup, it is possible to trigger DTV resizing. Previously, the DTV was marked as allocated by the main malloc afterwards, even if the minimal malloc was still in use. With this change, _dl_resize_dtv marks the resized DTV as allocated with the minimal malloc. The new test reuses TLS-using modules from other auditing tests. Reviewed-by: DJ Delorie <dj@redhat.com>
This commit is contained in:
@@ -566,6 +566,13 @@ _dl_resize_dtv (dtv_t *dtv, size_t max_modid)
|
||||
if (newp == NULL)
|
||||
oom ();
|
||||
memcpy (newp, &dtv[-1], (2 + oldsize) * sizeof (dtv_t));
|
||||
#ifdef SHARED
|
||||
/* Auditors can trigger a DTV resize event while the full malloc
|
||||
is not yet in use. Mark the new DTV allocation as the
|
||||
initial allocation. */
|
||||
if (!__rtld_malloc_is_complete ())
|
||||
GL(dl_initial_dtv) = &newp[1];
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user