-
Notifications
You must be signed in to change notification settings - Fork 349
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
matchArgs: Add Not{Equal, Prefix, Postfix} in fd, file, path types #1325
Conversation
b0fb0fe
to
76c6990
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.
Thanks! I have some comments.
The behaviour changes a bit when having multiple values. For operators Equal, Prefix, and Postfix the
previous example will match when:
[(arg OP val1) OR (arg OP val2) OR (arg OP val3)]For operators NotEqual, NotPrefix, and NotPostfix the previous example will match when:
[(arg OP val1) AND (arg OP val2) AND (arg OP val3)]
I think the right way to think of Not* operators is:
Equal: (arg == val1) || (arg == val2) || (arg == val3)
NotEqual: NOT(Equal)
=> NOT( (arg == val1) || (arg == val2) || (arg == val3) )
=> (arg != val1) && (arg != val2) && (arg != val3)
So the behavior doesn't really change.
This commit adds support fot NotEqual, NotPrefix, and NotPostfix operators in generic kprobes. These work for fd, file, and path argument types. An example is: selectors: - matchArgs: - index: 0 operator: "Prefix" values: - "/home/" - index: 0 operator: "NotPrefix" values: - "/home/anotherfolder/" Which matches when the argument has prefix "/home/" and does not has prefix "/home/anotherfolder/". This can help limits the paths that we monitor. - matchArgs: - index: 0 operator: "OP" values: - "val1" - "val2" - "val3" The behaviour changes a bit when having multiple values. For operators Equal, Prefix, and Postfix the previous example will match when: [(arg OP val1) OR (arg OP val2) OR (arg OP val3)] For operators NotEqual, NotPrefix, and NotPostfix the previous example will match when: [(arg OP val1) AND (arg OP val2) AND (arg OP val3)] FIXES: #1310 Signed-off-by: Anastasios Papagiannis <tasos.papagiannnis@gmail.com>
Signed-off-by: Anastasios Papagiannis <tasos.papagiannnis@gmail.com>
Signed-off-by: Anastasios Papagiannis <tasos.papagiannnis@gmail.com>
76c6990
to
c1698dc
Compare
This broken main, how did it pass tests? |
ah the kprobe_test doesn't have the observer package since it was moved so the tests need to rebase and use the new observerhelper package |
Fix: #1347 |
FIXES: #1310