Release 4.7 samples/bpf/tracex4_kern.c
/* 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 <linux/ptrace.h>
#include <linux/version.h>
#include <uapi/linux/bpf.h>
#include "bpf_helpers.h"
struct pair {
u64 val;
u64 ip;
};
struct bpf_map_def SEC("maps") my_map = {
.type = BPF_MAP_TYPE_HASH,
.key_size = sizeof(long),
.value_size = sizeof(struct pair),
.max_entries = 1000000,
};
/* 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;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alexei starovoitov | alexei starovoitov | 27 | 90.00% | 1 | 50.00% |
michael holzheu | michael holzheu | 3 | 10.00% | 1 | 50.00% |
| Total | 30 | 100.00% | 2 | 100.00% |
SEC("kretprobe/kmem_cache_alloc_node")
int bpf_prog2(struct pt_regs *ctx)
{
long ptr = PT_REGS_RC(ctx);
long ip = 0;
/* get ip address of kmem_cache_alloc_node() caller */
BPF_KRETPROBE_READ_RET_IP(ip, ctx);
struct pair v = {
.val = bpf_ktime_get_ns(),
.ip = ip,
};
bpf_map_update_elem(&my_map, &ptr, &v, BPF_ANY);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alexei starovoitov | alexei starovoitov | 60 | 92.31% | 1 | 33.33% |
michael holzheu | michael holzheu | 4 | 6.15% | 1 | 33.33% |
naveen n. rao | naveen n. rao | 1 | 1.54% | 1 | 33.33% |
| Total | 65 | 100.00% | 3 | 100.00% |
char _license[] SEC("license") = "GPL";
u32 _version SEC("version") = LINUX_VERSION_CODE;
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alexei starovoitov | alexei starovoitov | 176 | 95.65% | 1 | 33.33% |
michael holzheu | michael holzheu | 7 | 3.80% | 1 | 33.33% |
naveen n. rao | naveen n. rao | 1 | 0.54% | 1 | 33.33% |
| Total | 184 | 100.00% | 3 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.