-
Notifications
You must be signed in to change notification settings - Fork 325
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
LSM sensor #2566
base: main
Are you sure you want to change the base?
LSM sensor #2566
Conversation
✅ Deploy Preview for tetragon ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There are things to do:
I managed to load LSM BPF programs, tail calls also work for LSM programs! The most terrifying problems are solved, I think. I managed to catch some Lsm events). |
a9f28bf
to
1f5d707
Compare
For now I managed to fix problem with args resolving. LSM BPF programs get args the way raw tracepoint programs do. So, LSM events now are looking good. It would be nice to start code review. Some open questions:
|
f17edbc
to
03cb7db
Compare
0127073
to
1cc6efb
Compare
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.
Thanks!
Overall, this looks good to me! I've left some minor comments.
./verify/verify.sh . I made a hack for loading generic LSM programs. But I need to install llvm-objcopy in CI
Looks good to me. Yap, let's install it. I'm guessing it should be part of our clang container so we can just use that.
Tests. I think we need some tests. Maybe more than one. I'll work on it. Maybe we discuss what kind of tests it's good to have?
That's a good question. I would say start simple, and have one or two tests for the basic functionality (observability and enforcement)
Enforce mode. If LSM BPF returns the value that is not qual to zero, than operation > is not permitted. Maybe we should add an action for that? For example, if policy is > violated just return -EPERM, instead of sending SIGKILL.
Yap, I think that makes sense. We also have an override action that does something similar, but having a separate action for lsm (as you do in your PR) makes sense to me.
pkg/sensors/tracing/genericlsm.go
Outdated
progs = append(progs, load) | ||
|
||
fdinstall := program.MapBuilderPin("fdinstall_map", sensors.PathJoin(sensorPath, "fdinstall_map"), load) | ||
maps = append(maps, fdinstall) |
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.
@olsajiri I added you to the reviewers. It would be great if you could have a look when you get a chance. Thanks! |
Signed-off-by: Andrey Fedotov <anfedotoff@yandex-team.ru>
Signed-off-by: Andrey Fedotov <anfedotoff@yandex-team.ru>
Signed-off-by: Andrey Fedotov <anfedotoff@yandex-team.ru>
LSM sensor support allows to use LSM BPF programs the way we use BPF programs for kprobes/tracepoints/uprobes.
TracingPolicy example:
Event example:
This is also necessary for #2409.