-
Notifications
You must be signed in to change notification settings - Fork 417
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(events): add chmod_common event #4339
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# chmod_common | ||
|
||
## Intro | ||
|
||
chmod_common - An event capturing changes to access permissions of files and directories. | ||
|
||
## Description | ||
|
||
This event captures any changes to the current working directory (typically by using the `chmod` and similar syscalls). | ||
|
||
## Arguments | ||
|
||
* `pathname`:`const char*`[K] - path of the file or directory | ||
* `mode`:`mode_t`[K] - the mode to apply to the file or directory | ||
|
||
## Hooks | ||
|
||
### chmod_common | ||
|
||
#### Type | ||
|
||
kprobe | ||
|
||
#### Purpose | ||
|
||
Catch access permissions changes of files and directories. | ||
|
||
## Example Use Case | ||
|
||
## Issues | ||
|
||
## Related Events | ||
|
||
`chmod`, `fchmod`, `fchmodat` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,6 +161,7 @@ const ( | |
Dup2Ret | ||
Dup3 | ||
Dup3Ret | ||
ChmodCommon | ||
) | ||
|
||
// Test probe handles | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,6 +113,7 @@ const ( | |
ProcessExecuteFailedInternal | ||
SecurityTaskSetrlimit | ||
SecuritySettime64 | ||
ChmodCommon | ||
MaxCommonID | ||
) | ||
|
||
|
@@ -262,7 +263,7 @@ var CoreEvents = map[ID]Definition{ | |
params: []trace.ArgMeta{ | ||
{Type: "const char*", Name: "pathname"}, | ||
{Type: "int", Name: "flags"}, | ||
{Type: "mode_t", Name: "mode"}, | ||
{Type: "umode_t", Name: "mode"}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @NDStrahilevitz we need standardise names or migrate entirely to types instead of strings. Seeing this change and double checking 4737625#diff-561afb519199f76436d77252de43fdbc7020a8603bb0dd8226d8eea314c4ba32R29-R154, I realized that we can't be confident of the type size based on the name only, check these: https://elixir.bootlin.com/linux/v6.11.1/source/include/linux/types.h#L23 https://elixir.bootlin.com/linux/v6.11.1/source/arch/x86/include/uapi/asm/posix_types_32.h#L11
I'll review all |
||
}, | ||
dependencies: Dependencies{ | ||
probes: []Probe{ | ||
|
@@ -2241,7 +2242,7 @@ var CoreEvents = map[ID]Definition{ | |
sets: []string{"syscalls", "fs", "fs_dir_ops"}, | ||
params: []trace.ArgMeta{ | ||
{Type: "const char*", Name: "pathname"}, | ||
{Type: "mode_t", Name: "mode"}, | ||
{Type: "umode_t", Name: "mode"}, | ||
}, | ||
dependencies: Dependencies{ | ||
probes: []Probe{ | ||
|
@@ -2288,7 +2289,7 @@ var CoreEvents = map[ID]Definition{ | |
sets: []string{"default", "syscalls", "fs", "fs_file_ops"}, | ||
params: []trace.ArgMeta{ | ||
{Type: "const char*", Name: "pathname"}, | ||
{Type: "mode_t", Name: "mode"}, | ||
{Type: "umode_t", Name: "mode"}, | ||
}, | ||
dependencies: Dependencies{ | ||
probes: []Probe{ | ||
|
@@ -2408,7 +2409,7 @@ var CoreEvents = map[ID]Definition{ | |
sets: []string{"default", "syscalls", "fs", "fs_file_attr"}, | ||
params: []trace.ArgMeta{ | ||
{Type: "const char*", Name: "pathname"}, | ||
{Type: "mode_t", Name: "mode"}, | ||
{Type: "umode_t", Name: "mode"}, | ||
}, | ||
dependencies: Dependencies{ | ||
probes: []Probe{ | ||
|
@@ -2432,7 +2433,7 @@ var CoreEvents = map[ID]Definition{ | |
sets: []string{"default", "syscalls", "fs", "fs_file_attr"}, | ||
params: []trace.ArgMeta{ | ||
{Type: "int", Name: "fd"}, | ||
{Type: "mode_t", Name: "mode"}, | ||
{Type: "umode_t", Name: "mode"}, | ||
}, | ||
dependencies: Dependencies{ | ||
probes: []Probe{ | ||
|
@@ -3417,7 +3418,7 @@ var CoreEvents = map[ID]Definition{ | |
sets: []string{"syscalls", "fs", "fs_file_ops"}, | ||
params: []trace.ArgMeta{ | ||
{Type: "const char*", Name: "pathname"}, | ||
{Type: "mode_t", Name: "mode"}, | ||
{Type: "umode_t", Name: "mode"}, | ||
{Type: "dev_t", Name: "dev"}, | ||
}, | ||
dependencies: Dependencies{ | ||
|
@@ -5980,7 +5981,7 @@ var CoreEvents = map[ID]Definition{ | |
params: []trace.ArgMeta{ | ||
{Type: "const char*", Name: "name"}, | ||
{Type: "int", Name: "oflag"}, | ||
{Type: "mode_t", Name: "mode"}, | ||
{Type: "umode_t", Name: "mode"}, | ||
{Type: "struct mq_attr*", Name: "attr"}, | ||
}, | ||
dependencies: Dependencies{ | ||
|
@@ -6411,7 +6412,7 @@ var CoreEvents = map[ID]Definition{ | |
{Type: "int", Name: "dirfd"}, | ||
{Type: "const char*", Name: "pathname"}, | ||
{Type: "int", Name: "flags"}, | ||
{Type: "mode_t", Name: "mode"}, | ||
{Type: "umode_t", Name: "mode"}, | ||
}, | ||
dependencies: Dependencies{ | ||
probes: []Probe{ | ||
|
@@ -6436,7 +6437,7 @@ var CoreEvents = map[ID]Definition{ | |
params: []trace.ArgMeta{ | ||
{Type: "int", Name: "dirfd"}, | ||
{Type: "const char*", Name: "pathname"}, | ||
{Type: "mode_t", Name: "mode"}, | ||
{Type: "umode_t", Name: "mode"}, | ||
}, | ||
dependencies: Dependencies{ | ||
probes: []Probe{ | ||
|
@@ -6461,7 +6462,7 @@ var CoreEvents = map[ID]Definition{ | |
params: []trace.ArgMeta{ | ||
{Type: "int", Name: "dirfd"}, | ||
{Type: "const char*", Name: "pathname"}, | ||
{Type: "mode_t", Name: "mode"}, | ||
{Type: "umode_t", Name: "mode"}, | ||
{Type: "dev_t", Name: "dev"}, | ||
}, | ||
dependencies: Dependencies{ | ||
|
@@ -6694,7 +6695,7 @@ var CoreEvents = map[ID]Definition{ | |
params: []trace.ArgMeta{ | ||
{Type: "int", Name: "dirfd"}, | ||
{Type: "const char*", Name: "pathname"}, | ||
{Type: "mode_t", Name: "mode"}, | ||
{Type: "umode_t", Name: "mode"}, | ||
{Type: "int", Name: "flags"}, | ||
}, | ||
dependencies: Dependencies{ | ||
|
@@ -12065,7 +12066,7 @@ var CoreEvents = map[ID]Definition{ | |
params: []trace.ArgMeta{ | ||
{Type: "const char*", Name: "file_name"}, | ||
{Type: "const char*", Name: "path"}, | ||
{Type: "mode_t", Name: "mode"}, | ||
{Type: "umode_t", Name: "mode"}, | ||
geyslan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{Type: "void*", Name: "proc_ops_addr"}, | ||
}, | ||
}, | ||
|
@@ -13042,6 +13043,23 @@ var CoreEvents = map[ID]Definition{ | |
{Type: "int", Name: "tz_dsttime"}, | ||
}, | ||
}, | ||
ChmodCommon: { | ||
id: ChmodCommon, | ||
id32Bit: Sys32Undefined, | ||
name: "chmod_common", | ||
version: NewVersion(1, 0, 0), | ||
syscall: true, | ||
sets: []string{}, | ||
params: []trace.ArgMeta{ | ||
{Type: "const char*", Name: "pathname"}, | ||
{Type: "umode_t", Name: "mode"}, | ||
}, | ||
dependencies: Dependencies{ | ||
probes: []Probe{ | ||
{handle: probes.ChmodCommon, required: true}, | ||
}, | ||
}, | ||
}, | ||
// | ||
// Begin of Signal Events (Control Plane) | ||
// | ||
|
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.
I don't think the name chmod_common is so clear to the user.
A better name for this event may be
file_chmod