]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
elf: Fix a DTV setup issue [BZ #27136]
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Wed, 30 Dec 2020 23:40:14 +0000 (23:40 +0000)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Mon, 15 Feb 2021 12:05:21 +0000 (12:05 +0000)
The max modid is a valid index in the dtv, it should not be skipped.

The bug is observable if the last module has modid == 64 and its
generation is same or less than the max generation of the previous
modules.  Then dtv[0].counter implies dtv[64] is initialized but
it isn't. Fixes bug 27136.

elf/dl-tls.c

index dd76829e74156bdaa604974017c421bdb56b0cde..79b93ad91bd929555b641a6288251cae268e3018 100644 (file)
@@ -590,7 +590,7 @@ _dl_allocate_tls_init (void *result)
        }
 
       total += cnt;
-      if (total >= GL(dl_tls_max_dtv_idx))
+      if (total > GL(dl_tls_max_dtv_idx))
        break;
 
       listp = listp->next;