git: e9a38ed2fa61 - main - rtld: fix allocate_module_tls() variant I fallback to static allocation

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 09 Jun 2023 12:14:06 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=e9a38ed2fa61fd264a80f24ceb35f39b0ac6463d

commit e9a38ed2fa61fd264a80f24ceb35f39b0ac6463d
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-06-09 00:51:32 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-06-09 12:13:46 +0000

    rtld: fix allocate_module_tls() variant I fallback to static allocation
    
    Submitted by:   Joerg Sonnenberger
    Fixes:  91880e07f605edb90339685bc934699a4344de3bESC
    MFC after:      1 week
---
 libexec/rtld-elf/rtld.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 72a128ccbb81..173dcd4e9878 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -5465,7 +5465,7 @@ allocate_module_tls(int index)
 
 	if (obj->tls_static) {
 #ifdef TLS_VARIANT_I
-		p = (char *)_tcb_get() + obj->tlsoffset;
+		p = (char *)_tcb_get() + obj->tlsoffset + TLS_TCB_SIZE;
 #else
 		p = (char *)_tcb_get() - obj->tlsoffset;
 #endif