find user pt_regs from task_struct
- Dominant language
- Rust
- Stars
- 40
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
not so hard in C but tricky in rust. needed for flamegraphing kprobe's and tracepoint and adding the kernel part to profile.
https://github.com/iovisor/bcc/issues/2073
```c
struct task_struct* __current = (struct task_struct*)bpf_get_current_task();
void* __current_stack_page = __current->stack;
void* __ptr = __current_stack_page + THREAD_SIZE - TOP_OF_KERNEL_STACK_PADDING;
struct pt_regs* _tctx = ((struct pt_regs *)__ptr) - 1;
```
THREAD_SIZE should be 2 * PAGE_SIZE and PAGE_SIZE 4096
TOP_OF_KERNEL_STACK_PADDING should be 0 on x86_64
Contributor guide
No contributing guide indexed for this repository
Research direction
Read the linked bcc issue and locate cargo-trace's Rust entry point for perf events, kprobes, or tracepoints. Compare the supplied x86_64 C calculation for task_struct and pt_regs with the project's current profiling path. Done means the kernel-side profiling code can obtain pt_regs for the required tracing cases; no target file or test is named.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, linux, rust
- Domain
- observability, operating-systems, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100