bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* add helper to get value of Thread Local Storage base register
       [not found] <EE887B7B-BAC1-4D59-8752-ACD8705725F4@icloud.com>
@ 2023-05-16  3:25 ` chen.yunxing
  2023-05-16 18:32   ` Andrii Nakryiko
  0 siblings, 1 reply; 2+ messages in thread
From: chen.yunxing @ 2023-05-16  3:25 UTC (permalink / raw)
  To: bpf

Hi, 

I want to discuss the requirement of add bpf helper:

for the purpose of accessing user space variable of TLS(Thread Local Storage),we need get the TLS register of current Thread/Task.

then the TLS variable can be accessed via add offset to this register (as the base)

for example at arm:

mrs x0, tpidr_el0

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: add helper to get value of Thread Local Storage base register
  2023-05-16  3:25 ` add helper to get value of Thread Local Storage base register chen.yunxing
@ 2023-05-16 18:32   ` Andrii Nakryiko
  0 siblings, 0 replies; 2+ messages in thread
From: Andrii Nakryiko @ 2023-05-16 18:32 UTC (permalink / raw)
  To: chen.yunxing; +Cc: bpf

On Mon, May 15, 2023 at 8:25 PM <chen.yunxing@icloud.com> wrote:
>
> Hi,
>
> I want to discuss the requirement of add bpf helper:
>
> for the purpose of accessing user space variable of TLS(Thread Local Storage),we need get the TLS register of current Thread/Task.
>
> then the TLS variable can be accessed via add offset to this register (as the base)
>
> for example at arm:
>
> mrs x0, tpidr_el0

thread-local storage is only meaningful for user-space, so you don't
need to access actual register state, you can get it from struct
task_struct:

- for x86-64: task->thread.fsbase
- for aarm64: task->thread.uw.tp_value

Each architecture should have a similar field storing thread-local
storage base pointer.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-16 18:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <EE887B7B-BAC1-4D59-8752-ACD8705725F4@icloud.com>
2023-05-16  3:25 ` add helper to get value of Thread Local Storage base register chen.yunxing
2023-05-16 18:32   ` Andrii Nakryiko

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).