From 3befc16bc5a955f1ee30d4740029b7b613d5c163 Mon Sep 17 00:00:00 2001 From: arthur-zhang Date: Tue, 7 Jan 2025 09:31:07 +0800 Subject: [PATCH] fix: update selector_filter index assignment to use sel->index 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 --- bpf/process/pfilter.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bpf/process/pfilter.h b/bpf/process/pfilter.h index eb943da93c3..bdd90b7f930 100644 --- a/bpf/process/pfilter.h +++ b/bpf/process/pfilter.h @@ -341,15 +341,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;