mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: [PATCH] fix tls access on arm targets before armv6k
Date: Thu, 23 Aug 2018 16:10:29 +0200	[thread overview]
Message-ID: <20180823141029.GB4418@port70.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 216 bytes --]

fixing the 'large tls alignment on tls above tp targets' issue
introduced a regression on arm which i didnt notice because i
only tested it with armv7-a code gen.

fortunately there was no release since that commit.

[-- Attachment #2: 0001-fix-tls-access-on-arm-targets-before-armv6k.patch --]
[-- Type: text/x-diff, Size: 1037 bytes --]

From 539dc72e6d75779082c862b2bb4463c2af4b7953 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Thu, 23 Aug 2018 10:57:34 +0000
Subject: [PATCH] fix tls access on arm targets before armv6k

commit 610c5a8524c3d6cd3ac5a5f1231422e7648a3791 changed the thread
pointer setup so tp points at the end of the pthread struct on arm,
but failed to update __aeabi_read_tp so it was off by 8.

this broke tls access in code that is compiled with -mtp=soft, which
is the default when target arch is pre armv6k or thumb1.
---
 src/thread/arm/__aeabi_read_tp_c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/thread/arm/__aeabi_read_tp_c.c b/src/thread/arm/__aeabi_read_tp_c.c
index 654bdc57..0c56d613 100644
--- a/src/thread/arm/__aeabi_read_tp_c.c
+++ b/src/thread/arm/__aeabi_read_tp_c.c
@@ -4,5 +4,5 @@
 __attribute__((__visibility__("hidden")))
 void *__aeabi_read_tp_c(void)
 {
-	return (void *)((uintptr_t)__pthread_self()-8+sizeof(struct pthread));
+	return TP_ADJ(__pthread_self());
 }
-- 
2.17.1


             reply	other threads:[~2018-08-23 14:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-23 14:10 Szabolcs Nagy [this message]
2018-08-24 19:27 ` [PATCH v2] " Szabolcs Nagy
2018-08-24 20:17   ` Rich Felker
2018-08-24 21:56     ` Szabolcs Nagy
2018-08-25  0:06       ` [PATCH] rewrite __aeabi_read_tp in asm Szabolcs Nagy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180823141029.GB4418@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).