-
Notifications
You must be signed in to change notification settings - Fork 728
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
Add check for "is an open for reading/writing". #610
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mstemm
added a commit
to falcosecurity/falco
that referenced
this pull request
Jun 17, 2016
Make changes to rules to improve performance: - Rely on an upcoming change to sysdig (draios/sysdig#610) that allows specifying an open/openat for reading/writing, without having to search through all the flags individually. - Switch to consistently using evt.type instead of syscall.type. - Move positive tests like etc_dir, bin_dir, etc., which are most likely to not succeed, to the beginning of rules, so they have a greater chance to cause the rest of the rule to be skipped, which saves time.
👍 |
While working on measuring performance for falco, I found that one of the rule bottlenecks was checking for an open for reading/open for writing. With the current libsinsp, you have to do a string comparison on the flags argument, which can be slow, especially if you have to check for multiple flags. Fix this by adding a check evt.is_open_{read,write} that returns a boolean based on the value of the flags argument to the corresponding open/openat. This is similar to the current evt.is_io_{read,write}, but is argument-specific and limited to open/openat calls.
c798ec8
to
8c7f3fb
Compare
mstemm
added a commit
to falcosecurity/falco
that referenced
this pull request
Jun 28, 2016
Make changes to rules to improve performance and reduce FPs: - Rely on an upcoming change to sysdig (draios/sysdig#610) that allows specifying an open/openat for reading/writing, without having to search through all the flags individually. - Switch to consistently using evt.type instead of syscall.type. - Move positive tests like etc_dir, bin_dir, etc., which are most likely to not succeed, to the beginning of rules, so they have a greater chance to cause the rest of the rule to be skipped, which saves time. - Using exim as a mail program--exim also can suid to root. - apt-get install curl--add a new macro for ssl management binaries and allow them to write below /etc and read sensitive files. - starting/stopping dhcp networking-add a new macro for dhcp client - binaries and allow them to write below /etc. - Add exe (docker-related program) as a program that can set a namespace using setns. - Don't count /dev/tty as an important file under /dev.
mstemm
added a commit
to falcosecurity/falco
that referenced
this pull request
Jun 28, 2016
Make changes to rules to improve performance and reduce FPs: - Rely on an upcoming change to sysdig (draios/sysdig#610) that allows specifying an open/openat for reading/writing, without having to search through all the flags individually. - Switch to consistently using evt.type instead of syscall.type. - Move positive tests like etc_dir, bin_dir, etc., which are most likely to not succeed, to the beginning of rules, so they have a greater chance to cause the rest of the rule to be skipped, which saves time. - Using exim as a mail program--exim also can suid to root. - apt-get install curl--add a new macro for ssl management binaries and allow them to write below /etc and read sensitive files. - starting/stopping dhcp networking-add a new macro for dhcp client - binaries and allow them to write below /etc. - Add exe (docker-related program) as a program that can set a namespace using setns. - Don't count /dev/tty as an important file under /dev.
mstemm
added a commit
to falcosecurity/falco
that referenced
this pull request
Jul 11, 2016
Make changes to rules to improve performance and reduce FPs: - Rely on an upcoming change to sysdig (draios/sysdig#610) that allows specifying an open/openat for reading/writing, without having to search through all the flags individually. - For a 2-item set of event types (open, openat), and thinking ahead to implementing in (...) as set membership tests using hash tables, it's slightly faster to check the two items directly. - Switch to consistently using evt.type instead of syscall.type. - Move positive tests like etc_dir, bin_dir, sensitive_files, proc.sname, etc., which are most likely to not succeed, to the beginning of rules, so they have a greater chance to cause the rest of the rule to be skipped, which saves time. - Using exim as a mail program--exim also can suid to root. - apt-get install curl--add a new macro for ssl management binaries and allow them to write below /etc and read sensitive files. - add a new macro for dhcp client binaries and allow them to write below /etc. - Add exe (docker-related program) as a program that can set a namespace using setns. - Don't count /dev/tty as an important file under /dev.
mstemm
added a commit
to falcosecurity/falco
that referenced
this pull request
Jul 11, 2016
Make changes to rules to improve performance and reduce FPs: - Rely on an upcoming change to sysdig (draios/sysdig#610) that allows specifying an open/openat for reading/writing, without having to search through all the flags individually. - Switch to consistently using evt.type instead of syscall.type. - Move positive tests like etc_dir, bin_dir, etc., which are most likely to not succeed, to the beginning of rules, so they have a greater chance to cause the rest of the rule to be skipped, which saves time. - Using exim as a mail program--exim also can suid to root. - apt-get install curl--add a new macro for ssl management binaries and allow them to write below /etc and read sensitive files. - starting/stopping dhcp networking-add a new macro for dhcp client - binaries and allow them to write below /etc. - Add exe (docker-related program) as a program that can set a namespace using setns. - Don't count /dev/tty as an important file under /dev.
mstemm
added a commit
to falcosecurity/falco
that referenced
this pull request
Jul 11, 2016
Make changes to rules to improve performance and reduce FPs: - Rely on draios/sysdig#610 that allows specifying an open/openat for reading/writing without having to search through all the flags individually. - For a two-item list (open, openat), and thinking ahead to draios/sysdig#624, check the event type individually instead of as a set membership test, which is a bit faster. - Switch to consistently using evt.type instead of syscall.type. - Move positive tests like etc_dir, bin_dir, sensitive_files, proc.sname, etc., which are most likely to not succeed, to the beginning of rules, so they have a greater chance to cause the rest of the rule to be skipped, which saves time. - Using exim as a mail program--exim also can suid to root. - add a new macro for ssl management binaries and allow them to write below /etc and read sensitive files. - add a new macro for dhcp client binaries and allow them to write below /etc. - Add exe (docker-related program) as a program that can set a namespace using setns. - Don't count /dev/tty as an important file under /dev.
mstemm
added a commit
to falcosecurity/falco
that referenced
this pull request
Jul 11, 2016
Make changes to rules to improve performance and reduce FPs: - Rely on draios/sysdig#610 that allows specifying an open/openat for reading/writing without having to search through all the flags individually. - For a two-item list (open, openat), and thinking ahead to draios/sysdig#624, check the event type individually instead of as a set membership test, which is a bit faster. - Switch to consistently using evt.type instead of syscall.type. - Move positive tests like etc_dir, bin_dir, sensitive_files, proc.sname, etc., which are most likely to not succeed, to the beginning of rules, so they have a greater chance to cause the rest of the rule to be skipped, which saves time. - Using exim as a mail program--exim also can suid to root. - add a new macro for ssl management binaries and allow them to write below /etc and read sensitive files. - add a new macro for dhcp client binaries and allow them to write below /etc. - Add exe (docker-related program) as a program that can set a namespace using setns. - Don't count /dev/tty as an important file under /dev.
mstemm
added a commit
to falcosecurity/falco
that referenced
this pull request
Jul 12, 2016
Make changes to rules to improve performance and reduce FPs: - Rely on draios/sysdig#610 that allows specifying an open/openat for reading/writing without having to search through all the flags individually. - For a two-item list (open, openat), and thinking ahead to draios/sysdig#624, check the event type individually instead of as a set membership test, which is a bit faster. - Switch to consistently using evt.type instead of syscall.type. - Move positive tests like etc_dir, bin_dir, sensitive_files, proc.sname, etc., which are most likely to not succeed, to the beginning of rules, so they have a greater chance to cause the rest of the rule to be skipped, which saves time. - Using exim as a mail program--exim also can suid to root. - add a new macro for ssl management binaries and allow them to write below /etc and read sensitive files. - add a new macro for dhcp client binaries and allow them to write below /etc. - Add exe (docker-related program) as a program that can set a namespace using setns. - Don't count /dev/tty as an important file under /dev.
mstemm
added a commit
to falcosecurity/falco
that referenced
this pull request
Jul 12, 2016
Make changes to rules to improve performance and reduce FPs: - Rely on draios/sysdig#610 that allows specifying an open/openat for reading/writing without having to search through all the flags individually. - For a two-item list (open, openat), and thinking ahead to draios/sysdig#624, check the event type individually instead of as a set membership test, which is a bit faster. - Switch to consistently using evt.type instead of syscall.type. - Move positive tests like etc_dir, bin_dir, sensitive_files, proc.sname, etc., which are most likely to not succeed, to the beginning of rules, so they have a greater chance to cause the rest of the rule to be skipped, which saves time. - Using exim as a mail program--exim also can suid to root. - add a new macro for ssl management binaries and allow them to write below /etc and read sensitive files. - add a new macro for dhcp client binaries and allow them to write below /etc. - Add exe (docker-related program) as a program that can set a namespace using setns. - Don't count /dev/tty as an important file under /dev.
leogr
pushed a commit
to falcosecurity/rules
that referenced
this pull request
Dec 21, 2022
Make changes to rules to improve performance and reduce FPs: - Rely on draios/sysdig#610 that allows specifying an open/openat for reading/writing without having to search through all the flags individually. - For a two-item list (open, openat), and thinking ahead to draios/sysdig#624, check the event type individually instead of as a set membership test, which is a bit faster. - Switch to consistently using evt.type instead of syscall.type. - Move positive tests like etc_dir, bin_dir, sensitive_files, proc.sname, etc., which are most likely to not succeed, to the beginning of rules, so they have a greater chance to cause the rest of the rule to be skipped, which saves time. - Using exim as a mail program--exim also can suid to root. - add a new macro for ssl management binaries and allow them to write below /etc and read sensitive files. - add a new macro for dhcp client binaries and allow them to write below /etc. - Add exe (docker-related program) as a program that can set a namespace using setns. - Don't count /dev/tty as an important file under /dev.
leogr
pushed a commit
to falcosecurity/rules
that referenced
this pull request
Dec 21, 2022
Make changes to rules to improve performance and reduce FPs: - Rely on draios/sysdig#610 that allows specifying an open/openat for reading/writing without having to search through all the flags individually. - For a two-item list (open, openat), and thinking ahead to draios/sysdig#624, check the event type individually instead of as a set membership test, which is a bit faster. - Switch to consistently using evt.type instead of syscall.type. - Move positive tests like etc_dir, bin_dir, sensitive_files, proc.sname, etc., which are most likely to not succeed, to the beginning of rules, so they have a greater chance to cause the rest of the rule to be skipped, which saves time. - Using exim as a mail program--exim also can suid to root. - add a new macro for ssl management binaries and allow them to write below /etc and read sensitive files. - add a new macro for dhcp client binaries and allow them to write below /etc. - Add exe (docker-related program) as a program that can set a namespace using setns. - Don't count /dev/tty as an important file under /dev.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While working on measuring performance for falco, I found that one of
the rule bottlenecks was checking for an open for reading/open for
writing. With the current libsinsp, you have to do a string comparison
on the flags argument, which can be slow, especially if you have to
check for multiple flags.
Fix this by adding a check evt.is_open_{read,write} that returns a
boolean based on the value of the flags argument to the corresponding
open/openat. This is similar to the current evt.is_io_{read,write}, but
is argument-specific and limited to open/openat calls.
@gianlucaborello @ldegio this is what we discussed yesterday.