Skip to content
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 1 commit into from
Jun 28, 2016
Merged

Conversation

mstemm
Copy link
Contributor

@mstemm mstemm commented Jun 15, 2016

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.

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.
@ldegio
Copy link
Contributor

ldegio commented Jun 27, 2016

👍

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.
@mstemm mstemm merged commit 3102f6f into dev Jun 28, 2016
@mstemm mstemm deleted the is-open-read-write branch June 28, 2016 16:31
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants