This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bpftrace | |
iter:bpf_map { | |
if (ctx->map->id == $1) { | |
$inner = ctx->map->inner_map_meta; | |
printf("map->name: %s\n", ctx->map->name); | |
printf("inner_map->map_type: %u\n", $inner->map_type); | |
printf("inner_map->key_size: %u\n", $inner->key_size); | |
printf("inner_map->value_size: %u\n", $inner->value_size); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vmlinux.h> | |
#include <bpf/bpf_tracing.h> | |
#include <bpf/bpf_helpers.h> | |
#define __section(X) __attribute__((section(X), used)) | |
int error = 0; | |
__section("fentry/FUNC") | |
int BPF_PROG(fentry1) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python3 | |
# | |
# Very simple bcc tool written as an example. It counts how many | |
# times mutex_lock/mutex_unlock were called per second. Code is | |
# kinda based on the vfsstat example by Brendan Gregg, but the actual | |
# intersection is almost zero, and this one is smp-safe. | |
# | |
from bcc import BPF | |
from ctypes import c_int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* SPDX-License-Identifier: BSD-2-Clause | |
* | |
* How to compile and run: | |
* cc nolibbpf.c -o nolibbpf | |
* sudo strace -e bpf ./nolibbpf | |
* | |
* Then look at progs and maps using bpftool: | |
* sudo bpftool prog | |
* sudo bpftool map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
""" | |
Generates a binary search BPF seccomp program for a blacklist of system call | |
numbers specified as space-separated integers in stdin. | |
Example: | |
$ echo 1 3 6 8 13 | ./generate_bin_search_bpf.py | |
ld [0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"strings" | |
"flag" | |
"os" | |
"text/template" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:edge | |
RUN \ | |
echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \ | |
apk update && \ | |
apk upgrade && \ | |
apk add bash iproute2 openresolv procps && \ | |
apk add wireguard-tools | |
ENTRYPOINT ["bash"] |