bpf_printk 显示的地址不正确

问题描述 投票:0回答:1

我有一个附加到

page_fault_user
跟踪点的 eBPF 函数。

struct trace_event_raw_x86_exceptions {
    struct trace_entry ent;
    long unsigned int address;
    long unsigned int ip;
    long unsigned int error_code;
    char __data[0];
};

SEC("tp/exceptions/page_fault_user")
int handle_tp(trace_event_raw_x86_exceptions *ctx)
{
    bpf_printk("page-fault-user at %p.\n", ctx->address);
    return 0;
}

struct trace_event_raw_x86_exceptions
根据
/sys/kernel/debug/tracing/events/exceptions/page_fault_user/format
的内容定义。但是,我无法获得正确的故障地址表
ctx->address

我已确认 eBPF 函数

handle_tp
已成功附加到
page_fault_user
跟踪点,但
bpf_printk
打印了错误的故障地址。

exception kernel ebpf page-fault tracepoint
1个回答
1
投票

printk-formats:不带说明符扩展(即未修饰的 %p)打印的指针是 散列以提供唯一标识符,而不会将内核地址泄露给用户 空间。

%ps
中使用
bff_printk
解决了我的问题。

© www.soinside.com 2019 - 2024. All rights reserved.