小编Gou*_*mar的帖子

bpf_override_return 不适用于 uretprobes

uretprobe我在尝试使用with时遇到了问题bpf_override_return。我附加uretprobe了一个返回当前实时值的 Python 库函数。我的目标是用不同的较旧时间修改时间,但遇到以下问题:收到的错误消息是:无法创建 bpf perf link:无效参数。

内核端代码如下:

SEC("uretprobe/_PyTime_GetSystemClock")
int _PyTime_GetSystemClock_bpf(struct pt_regs *ctx)
{
    u64 id = bpf_get_current_pid_tgid();
    u32 pid = id >> 32;

    u32 kZero = 0;
    u32 *appPid = bpf_map_lookup_elem(&app_pid_map, &kZero);
    if (appPid)
    {
        if (pid != *appPid && pid != 1369246)
        {
            return 0;
        }
    }
    else
    {
        return 0;
    }

    u64 time = (PT_REGS_RC(ctx));

    bpf_printk("[_PyTime_GetSystemClock_bpf]Info: called :%lu & time is:%llu", pid, time);
    u64 t = 1706533301399118410; // Some time value to overwrite …
Run Code Online (Sandbox Code Playgroud)

c go bpf ebpf uprobe

5
推荐指数
0
解决办法
113
查看次数

标签 统计

bpf ×1

c ×1

ebpf ×1

go ×1

uprobe ×1