-
Notifications
You must be signed in to change notification settings - Fork 450
Matched rules #4484
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
base: main
Are you sure you want to change the base?
Matched rules #4484
Conversation
PoliciesConfig: *cfg, | ||
TraceePid: uint32(os.Getpid()), | ||
Options: t.getOptionsConfig(), | ||
CgroupV1Hid: uint32(t.cgroups.GetDefaultCgroupHierarchyID()), |
Check failure
Code scanning / CodeQL
Incorrect conversion between integer types High
strconv.Atoi
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've mentioned about this in #4482 (comment).
386226b
to
3ad4cf4
Compare
THIS PATCH IS NOT COMPLETE. NEED TO ADD USERSPACE PART. Look for proc_tree and process_tree in userspace and remove them as well
3ad4cf4
to
2ebef5c
Compare
f5f0967
to
1f411ed
Compare
1f411ed
to
6a0c8a7
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.
Just a quick (so quick) pass. Tomorrow I'm going to dive into this.
func (e *policyError) Is(target error) bool { | ||
t, ok := target.(*policyError) | ||
if !ok { | ||
return false | ||
} | ||
return e.msg == t.msg |
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.
Perhaps it should be better to rely on the errors.Is()
since it takes care of unwrapping.
PoliciesConfig: *cfg, | ||
TraceePid: uint32(os.Getpid()), | ||
Options: t.getOptionsConfig(), | ||
CgroupV1Hid: uint32(t.cgroups.GetDefaultCgroupHierarchyID()), |
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've mentioned about this in #4482 (comment).
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 did another passthrough.
// Retrieve the string filter for the current event | ||
// TODO: Dynamically determine the filter and type based on policy configuration | ||
string_filter_config_t *str_filter = &p->event->config.data_filter.string; | ||
|
||
if (!(str_filter->exact_enabled || str_filter->prefix_enabled || str_filter->suffix_enabled)) | ||
return policies_cfg->enabled_policies; | ||
return ~0ULL; |
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.
Opportunistic fix? @rscampos FYI.
// Combine rules that use string filters with those that do not | ||
res |= mask_no_str_filter_rules; | ||
|
||
return res; |
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.
Same as above?
@@ -3193,7 +3173,7 @@ statfunc int capture_file_write(struct pt_regs *ctx, u32 event_id, bool is_buf) | |||
del_args(event_id); | |||
|
|||
program_data_t p = {}; | |||
if (!init_program_data(&p, ctx, NO_EVENT_SUBMIT)) | |||
if (!init_program_data(&p, ctx, POLICY_SCOPES)) |
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.
What does the internal POLICY_SCOPES event must communicate?
@@ -386,8 +372,12 @@ typedef struct data_filter_config { | |||
} data_filter_config_t; | |||
|
|||
typedef struct event_config { | |||
u64 submit_for_policies; | |||
u16 rules_version; | |||
u8 has_overflow; |
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.
Could you elaborate more about has_overflow
?
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've finished an overall review. 👍🏻 This is neat.
continue | ||
// range through each userland filterable rule | ||
for _, rule := range t.policyManager.GetUserlandRules(eventID) { | ||
if rule.ID > 63 { |
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.
It would be good to use a MaxRules
alike const.
1. Explain what the PR does
WIP
2. Explain how to test it
3. Other comments