On Mon, May 15, 2023 at 8:25 PM <chen.yunxing@xxxxxxxxxx> 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.