179894
commit d2b997c7172e9a00895a9deb379f8782fbd2e36f
179894
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
179894
Date:   Wed Dec 30 23:40:14 2020 +0000
179894
179894
    elf: Fix a DTV setup issue [BZ #27136]
179894
    
179894
    The max modid is a valid index in the dtv, it should not be skipped.
179894
    
179894
    The bug is observable if the last module has modid == 64 and its
179894
    generation is same or less than the max generation of the previous
179894
    modules.  Then dtv[0].counter implies dtv[64] is initialized but
179894
    it isn't. Fixes bug 27136.
179894
    
179894
    Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
179894
179894
diff --git a/elf/dl-tls.c b/elf/dl-tls.c
179894
index cccf74b33481b866..0b96b1dceed99d58 100644
179894
--- a/elf/dl-tls.c
179894
+++ b/elf/dl-tls.c
179894
@@ -590,7 +590,7 @@ _dl_allocate_tls_init (void *result)
179894
 	}
179894
 
179894
       total += cnt;
179894
-      if (total >= GL(dl_tls_max_dtv_idx))
179894
+      if (total > GL(dl_tls_max_dtv_idx))
179894
 	break;
179894
 
179894
       listp = listp->next;