Skip to content

eBPF-based security platform

515 B
Raw Blame
// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
#include "vmlinux.h"
#include <bpf/bpf_helpers.h>

struct {
	__uint(type, BPF_MAP_TYPE_ARRAY);
	__uint(max_entries, 1);
	__type(key, __u32);
	__type(value, __u64);
} hits SEC(".maps");

char _license[] SEC("license") = "Dual BSD/GPL";

SEC("uretprobe.multi//tmp/shirudo-test-uprobe-target:*Func")
int probe_return(struct pt_regs *ctx)
{
	__u32 key = 0;
	__u64 *value = bpf_map_lookup_elem(&hits, &key);

	if (value)
		__sync_fetch_and_add(value, 1);
	return 0;
}