summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-02-23 19:47:38 +0200
committerPaul Buetow <paul@buetow.org>2024-02-23 19:47:38 +0200
commit306ebf54a2f270f1cbdf1307ad4c860caad579a9 (patch)
tree6b98cab2a957b0f8836391ea129969efe5b3e4a8
parente56a65aef99f7ff1c00ccc8b118d2e98c1f1409a (diff)
as of now, only pid filter supported.
-rw-r--r--Makefile5
-rw-r--r--internal/c/filter.c3
-rw-r--r--internal/c/flags.h1
-rw-r--r--internal/flags/flags.go5
4 files changed, 2 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 3c14d7a..f77080f 100644
--- a/Makefile
+++ b/Makefile
@@ -29,6 +29,5 @@ clean:
if [ -e ioriotng.bpf.o ]; then rm ioriotng.bpf.o; fi
make -C ./internal/c clean
-.PHONY: foo
-foo: clean generate all
- sudo ./ioriotng --uid $$(id -u)
+.PHONY: world
+world: clean generate all
diff --git a/internal/c/filter.c b/internal/c/filter.c
index ca8374a..06ecb33 100644
--- a/internal/c/filter.c
+++ b/internal/c/filter.c
@@ -11,8 +11,5 @@ static __always_inline int filter(__u32 *pid, __u32 *tid) {
if (*pid == PID_FILTER)
return ACCEPT;
- if ((bpf_get_current_uid_gid() & 0xFFFFFFFF) == UID_FILTER)
- return 0;
-
return FILTER;
}
diff --git a/internal/c/flags.h b/internal/c/flags.h
index c123fa4..0bb9492 100644
--- a/internal/c/flags.h
+++ b/internal/c/flags.h
@@ -1,4 +1,3 @@
//+build ignore
-const volatile u32 UID_FILTER = -1;
const volatile u32 PID_FILTER = -1;
diff --git a/internal/flags/flags.go b/internal/flags/flags.go
index 37797a4..1d2c11e 100644
--- a/internal/flags/flags.go
+++ b/internal/flags/flags.go
@@ -8,13 +8,11 @@ import (
)
type Flags struct {
- UidFilter int
PidFilter int
EventMapSize int
}
func New() (flags Flags) {
- flag.IntVar(&flags.UidFilter, "uid", 0, "Filter for user ID")
flag.IntVar(&flags.PidFilter, "pid", 0, "Filter for processes ID")
flag.IntVar(&flags.EventMapSize, "mapSize", 4096*16, "BPF FD event ring buffer map size")
flag.Parse()
@@ -23,9 +21,6 @@ func New() (flags Flags) {
}
func (flags Flags) SetBPF(bpfModule *bpf.Module) error {
- if err := bpfModule.InitGlobalVariable("UID_FILTER", uint32(flags.UidFilter)); err != nil {
- return fmt.Errorf("unable to set up UID_FILTER global variable: %w", err)
- }
if err := bpfModule.InitGlobalVariable("PID_FILTER", uint32(flags.PidFilter)); err != nil {
return fmt.Errorf("unable to set up PID_FILTER global variable: %w", err)
}