-
Notifications
You must be signed in to change notification settings - Fork 909
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
correct rule conditions to support syscall variants #1250
Conversation
Since the dir's path is found: - in `evt.arg[1]` for `mkdir` - but in `evt.arg[2]` for `mkdirat` switch to `evt.arg.path` to catch both. That ensures `Mkdir binary dirs` works properly. Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
Since `evt.arg[1]` does not work for all syscalls, switch to: - `evt.arg.path` for `rmdir` and `unlink` (used by `remove` macro) - `evt.arg.name` for `unlinkat` (used by `remove` macro) - `evt.arg.oldpath/newpath` for `rename` and `renameat` (used by `rename` macro) That ensures `Modify binary dirs` works properly. Note that we cannot yet use `renameat2` (not supported by sinsp, see draios/sysdig#1603 ) Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
/cc @Kaizhe |
/milestone 0.24.0 |
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.
SGTM
LGTM label has been added. Git tree hash: b1c76d6eb22d7050be66f1e5fc8480ec88505098
|
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.
Great improvement!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fntlnz, leodido, mstemm The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind bug
/kind rule-update
Any specific area of the project related to this PR?
/area rules
What this PR does / why we need it:
This PR fixes some rule/macro conditions to:
Mkdir binary dirs
also work withmkdirat
syscallModify binary dirs
also work withrename
,renameat
, andunlinkat
syscallsCreate files below dev
also work withopenat
syscallAdditional context can be found in commits' messages.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
This is my first PR that fix the rules :)
Test cases
Mkdir binary dirs
withmkdirat
Modify binary dirs
withrename
Modify binary dirs
withrenameat
Modify binary dirs
withunlinkat
Create files below dev
withopenat
Additional notes
There're still some missing syscalls that should be added but are not currently supported by sinsp, for example:
renameat2
( see also "renameat2" syscall support draios/sysdig#1603 )openat2
I will fill a separate issue for thoseReported on #676Related issues
Does this PR introduce a user-facing change?: