Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260618234049.GR3520958@port70.net>
Date: Fri, 19 Jun 2026 01:40:49 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: Rich Felker <dalias@...c.org>
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH] or1k: fix local-exec tls with large alignment

* Rich Felker <dalias@...c.org> [2026-06-18 17:58:29 -0400]:
> On Thu, Jun 18, 2026 at 09:12:56PM +0200, Szabolcs Nagy wrote:
> > or1k uses an unusual variant of the TLS_ABOVE_TP layout:
> > 
> > powerpc, mips, m68k:
> >    pthread  | tls
> >  +----------+-----------------+--
> >  |          |<     tpoff     >|
> >  self       a = e = m         tp
> > 
> > arm, aarch64, sh:
> >    pthread   <    gap    >| tls
> >  +----------+-------------+------
> >  |          |             |
> >  self       a = e = tp    m
> > 
> > or1k:
> >    pthread   <    gap    >| tls
> >  +----------+-------------+------
> >  |          |<   tpoff   >|
> >  self       a = e         m = tp
> 
> To be sure we understand this correctly, can you draw a diagram like
> this for the wrong way we have the or1k layout now?

i can resend the patch, but it's just:

or1k old:
   pthread  | tls
 +----------+--------------------
 |          |
 self       a = e = m = tp

or1k fixed:
   pthread   <    gap    >| tls
 +----------+-------------+------
 |          |<   tpoff   >|
 self       a = e         m = tp


in binutils it's the bfd/elf32-or1k.c tpoff function,
similar to the arm one, with the additional offset.

the failing libc-test is src/functional/tls_local_exec.exe

the GAP_ABOVE_TP name is unfortunate, seems to be my
invention hehe:
610c5a8524c3d6cd3ac5a5f1231422e7648a3791

it might have been better to make e = m on targets with
gap!=0 (moving the struct to cover the gap), but fixed
tp offsets of fields is target specific either way (e.g.
canary, or asan trying to find dtv).

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.