I have a eBPF function that is attached to the page_fault_user
tracepoint.
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
is defined according to the contents of /sys/kernel/debug/tracing/events/exceptions/page_fault_user/format
. However, I cannot get correct faulting address form ctx->address
.
I have confirmed that the eBPF function handle_tp
is successfully attached to the page_fault_user
tracepoint, but bpf_printk
prints incorrect faulting address.
Use
%ps
inbff_printk
solved my problem.