Skip to content

Commit

Permalink
feat: Add support for custom instructions in eBPF program specification.
Browse files Browse the repository at this point in the history
Signed-off-by: cfc4n <cfc4n.cs@gmail.com>
  • Loading branch information
cfc4n committed Feb 2, 2024
1 parent 239558c commit 0acaa8c
Show file tree
Hide file tree
Showing 10 changed files with 2,003 additions and 1 deletion.
27 changes: 27 additions & 0 deletions examples/instruction_patching/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
all: build-ebpf build run

build-ebpf:
mkdir -p ebpf/bin
clang -D__KERNEL__ -D__ASM_SYSREG_H \
-Wno-unused-value \
-Wno-pointer-sign \
-Wno-compare-distinct-pointer-types \
-Wunused \
-Wall \
-Werror \
-I/lib/modules/$$(uname -r)/build/include \
-I/lib/modules/$$(uname -r)/build/include/uapi \
-I/lib/modules/$$(uname -r)/build/include/generated/uapi \
-I/lib/modules/$$(uname -r)/build/arch/x86/include \
-I/lib/modules/$$(uname -r)/build/arch/x86/include/uapi \
-I/lib/modules/$$(uname -r)/build/arch/x86/include/generated \
-O2 -emit-llvm \
ebpf/main.c \
-c -o - | llc -march=bpf -filetype=obj -o ebpf/bin/probe.o
go run github.com/shuLhan/go-bindata/cmd/go-bindata -pkg main -prefix "ebpf/bin" -o "probe.go" "ebpf/bin/probe.o"

build:
go build -o bin/main .

run:
sudo bin/main
Empty file.
Loading

0 comments on commit 0acaa8c

Please # to comment.