Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 10 Feb 2022 16:32:19 -0500
From: Rich Felker <dalias@...c.org>
To: Yehuda Yitchak <yehuda80@...il.com>
Cc: Florian Weimer <fweimer@...hat.com>, musl@...ts.openwall.com
Subject: Re: Accessing Thread-Local-Storage in GDB

On Thu, Feb 10, 2022 at 08:05:15PM +0200, Yehuda Yitchak wrote:
> I forgot to mention I work on arm64
> I guess there isn't much I can do at the moment, right ?

If you're debugging live processes not core files, the dlsym approach
may work for you.


> On Thu, Feb 10, 2022, 13:23 Florian Weimer <fweimer@...hat.com> wrote:
> 
> > * Rich Felker:
> >
> > > Indeed, I was just offering a quick workaround that might help, not
> > > suggesting gdb should do that. __tls_get_addr can be used for
> > > non-dynamic symbols with information already available to the
> > > debugger. For core files you could probably simulate execution and
> > > abort if anything is reached that would need to change process state
> > > (lazy allocation) although that doesn't happen with musl anyway. But I
> > > wonder if the core file even records the x86 segment information
> > > needed to preserve thread pointer and simulate the %fs/%gs based
> > > loads on x86[_64]..?
> >
> > The register is available as $fs_base on x86-64:
> >
> > (gdb) print (void *)$fs_base
> > $1 = (void *) 0x7f2d12981740
> > (gdb) print *(void **)$fs_base
> > $2 = (void *) 0x7f2d12981740
> >
> > It probably does not work on i386 (even as $gs_base).  I do not think it
> > depends on FSGSBASE support in the kernel, but maybe I'm mistaken.  I
> > think I looked at this three years ago and couldn't make it work.
> >
> > Thanks,
> > Florian
> >
> >

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.