Skip to content

Commit

Permalink
fix: update selector_filter index assignment to use sel->index
Browse files Browse the repository at this point in the history
This fixes an issue where PID filtering would not work correctly due to lost state updates. The selector filter now properly maintains its internal index state across multiple invocations.

Signed-off-by: arthur-zhang <[email protected]>
  • Loading branch information
arthur-zhang committed Jan 9, 2025
1 parent c3df31c commit b27d2f8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bpf/process/pfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,15 +342,19 @@ selector_match(__u32 *f, struct selector_filter *sel,
four:
res4 = process_filter(sel, f, enter, &msg->ns, &msg->caps);
index = next_pid_value(index, f, ty);
sel->index = index;
three:
res3 = process_filter(sel, f, enter, &msg->ns, &msg->caps);
index = next_pid_value(index, f, ty);
sel->index = index;
two:
res2 = process_filter(sel, f, enter, &msg->ns, &msg->caps);
index = next_pid_value(index, f, ty);
sel->index = index;
one:
res1 = process_filter(sel, f, enter, &msg->ns, &msg->caps);
index = next_pid_value(index, f, ty);
sel->index = index;

if (ty == op_filter_notin)
return res1 & res2 & res3 & res4;
Expand Down

0 comments on commit b27d2f8

Please sign in to comment.