Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 24 Jun 2015 21:33:32 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Cc: Ted Hess <thess@...schensync.net>,
	OpenWrt developers <openwrt-devel@...ts.openwrt.org>
Subject: Re: Re: [OpenWrt-Devel] Alsa-lib (libasound) segfaults on TLS
 variable (musl on mips)

On Thu, Jun 25, 2015 at 01:08:48AM +0200, Szabolcs Nagy wrote:
> * Szabolcs Nagy <nsz@...t70.net> [2015-06-24 22:57:54 +0200]:
> > the bug is that mips tls access uses a hard coded -32768
> > offset relative to whatever __tls_get_addr returned.
> > 
> > and musl did not account for this offset.
> > 
> 
> only affects mips shared objects with 'static __thread' variables,
> 
> extern __thread variables worked fine (and only those were
> tested in the libc-tests).
> 
> > the attached patch fixes the issue for me,
> > we will fix it in musl soon.
> 
> better patch attached that undoes the offset for extern tls
> vars in relocs handling.. (and with more consistent naming)

In principle powerpc looks like it should be affected too, but it's
not. This seems to be because powerpc has a R_PPC_DTPREL32 relocation
for the local-dynamic TLS access, allowing the implementaton to use
whatever offset it likes as long as it's internally consistent,
whereas mips has a hard-coded value in the GOT with no relocation
attached to it it. I'll try to check and see if other archs are
affected and apply this patch or a variant of it soon.

Rich

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.