Skip to content
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

chore: add event_config alignment check #200

Merged
merged 1 commit into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bpf/alignchecker/bpf_alignchecker.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "include/vmlinux.h"
#include "include/api.h"
#include "lib/hubble_msg.h"
#include "process/retprobe_map.h"
#include "process/types/basic.h"
tpapagian marked this conversation as resolved.
Show resolved Hide resolved

/* DECLARE declares a unique usage of the union or struct 'x' on the stack.
*
Expand Down Expand Up @@ -36,6 +38,7 @@ int main(void)
// from maps
DECLARE(struct, event, iter);
DECLARE(struct, execve_map_value, iter);
DECLARE(struct, event_config, iter);

return 0;
}
2 changes: 2 additions & 0 deletions pkg/alignchecker/alignchecker.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/cilium/tetragon/pkg/api/processapi"
"github.com/cilium/tetragon/pkg/api/testapi"
"github.com/cilium/tetragon/pkg/api/tracingapi"
"github.com/cilium/tetragon/pkg/sensors/exec/execvemap"

check "github.com/cilium/cilium/pkg/alignchecker"
Expand All @@ -29,6 +30,7 @@ func CheckStructAlignments(path string) error {
"msg_exit": {reflect.TypeOf(processapi.MsgExitEvent{})},
"msg_test": {reflect.TypeOf(testapi.MsgTestEvent{})},
"execve_map_value": {reflect.TypeOf(execvemap.ExecveValue{})},
"event_config": {reflect.TypeOf(tracingapi.EventConfig{})},
}
return check.CheckStructAlignments(path, toCheck, true)
}
16 changes: 8 additions & 8 deletions pkg/api/tracingapi/client_kprobe.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,12 @@ type KprobeArgs struct {
}

type EventConfig struct {
FuncId uint32
Arg [5]int32
ArgM [5]uint32
ArgTpCtxOff [5]uint32
Sigkill uint32
Syscall uint32
ArgReturnCopy int32
ArgReturn int32
FuncId uint32 `align:"func_id"`
Arg [5]int32 `align:"arg0"`
ArgM [5]uint32 `align:"arg0m"`
ArgTpCtxOff [5]uint32 `align:"t_arg0_ctx_off"`
Sigkill uint32 `align:"sigkill"`
Syscall uint32 `align:"syscall"`
ArgReturnCopy int32 `align:"argreturncopy"`
ArgReturn int32 `align:"argreturn"`
}