fche changed the topic of #systemtap to: http://sourceware.org/systemtap; email systemtap@sourceware.org if answers here not timely, conversations may be logged
orivej has quit [Ping timeout: 252 seconds]
orivej has joined #systemtap
orivej has quit [Ping timeout: 244 seconds]
orivej has joined #systemtap
orivej has quit [Ping timeout: 268 seconds]
orivej has joined #systemtap
<agentzh> is there any tapset function to access the pthread TLS data? like pthread_getspecific()?
<fche> agentzh, nope
<agentzh> fche: is there a way to do that?
<agentzh> seems like i need to read the FS register content on x86_64 but it seems like FS is missing in struct pt_regs on x86_64...
<agentzh> any workaround?
<agentzh> it's present on i386 though.
<fche> I think reading the tls base pointer stuff is not that hard
<fche> but one'd want to resolve __thread__ $vars, which is more translator work
<agentzh> fche: any hints on reading FS register on x86_64 please?
<agentzh> then i can get the struct pthread pointer.
<agentzh> according to the glibc nptl code for x86_64.
<agentzh> i haven't got that far to __thread__ $vars yet :)
<fche> I'm sure it's in the pt_regs someplace
<agentzh> fche: not found it in the linux ptrace.h file: https://elixir.bootlin.com/linux/latest/source/arch/x86/include/asm/ptrace.h#L54
<agentzh> or am i looking at the wrong place?
<fche> hm, not sure
<fche> maybe %gs just is left alone by the kernel so it doesn't need saving
<fche> ELF_CORE_COPY_REGS may be relevant
<agentzh> so i should read the CPU register directly from within stap?
<agentzh> via _asm() maybe?
<fche> dunno, just searching the code like you are :)
<agentzh> looking
<fche> there is also save_fsgs()
<agentzh> thanks for the pointers
<fche> it may be saved in the task_struct also
<agentzh> okay
<agentzh> i'll check them out.
<agentzh> seems like it's indeed saved inside task_struct.thread.fsindex by the scheduler.
<agentzh> i'll do some experiments to confirm it.
<fche> SHIP IT HARD