-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(program): add program LSM suport #42
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
低版本内核中,请跳过编译、加载、执行。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test failed.
make
mkdir -p ebpf/bin
clang -D__KERNEL__ -D__ASM_SYSREG_H \
-DKERNEL_GE_5_7 \
-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"
go build -o bin/main .
sudo bin/main
INFO[0000] initializing manager
INFO[0000] cat /boot/config-$(uname -r) | grep BPF_LSM
INFO[0000] Linux kernel supports CONFIG_BPF_LSM=y
FATA[0003] error:1 error occurred:
* error:error:create raw tracepoint: not supported , couldn's activate lsm lsm/path_mkdir, matchFuncName:lsm_path_mkdir, {UID:MyLSMPathMkdirHook, EbpfFuncName:lsm_path_mkdir}
, probes activation validation failed
make: *** [Makefile:59: run] Error 1
$uname -a
Linux vm-ubuntu-arm64 5.15.0-78-generic #85-Ubuntu SMP Fri Jul 7 15:29:30 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
还需要稍微调整一下,谢谢。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
1.Added support for lsm ebpf program loading
2.Add test cases examples/programs/lsm