/* Copyright (c) 2015 PLUMgrid, http://plumgrid.com * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation.
*/ #include"vmlinux.h" #include <linux/version.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h>
/* kprobe is NOT a stable ABI. If kernel internals change this bpf+kprobe * example will no longer be meaningful
*/
SEC("kprobe/kmem_cache_free") int bpf_prog1(struct pt_regs *ctx)
{ long ptr = PT_REGS_PARM2(ctx);
bpf_map_delete_elem(&my_map, &ptr); return 0;
}
SEC("kretprobe/kmem_cache_alloc_node_noprof") int bpf_prog2(struct pt_regs *ctx)
{ long ptr = PT_REGS_RC(ctx); long ip = 0;
/* get ip address of kmem_cache_alloc_node_noprof() caller */
BPF_KRETPROBE_READ_RET_IP(ip, ctx);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.