-
Notifications
You must be signed in to change notification settings - Fork 1.9k
The seccomp filter should check the most frequently used syscalls first #1022
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
Comments
I have done a small investigation to see whether there is significant space for improvement in regards to seccomp ordering. The measurements were done by attaching an This process was repeated with both The average time spent by FC in a syscall is Before taking a decision, with the help of @iulianbarbu, we will run some IO-intensive performance tests with and without seccomp to see the effect they have on measurements like throughput, latency, etc. |
Looking again over the above facts, strace incurs a pretty big overhead, so the measurements are likely not relevant. I'll run some IO-intensive performance tests when I get some time |
If we have a sorted list of numbers of calls for each syscall type, it might be easier to just rearrange our filters to match that. If the investigation cost of finding out how much we gain outweighs the cost of just doing it, I think we should just do it based only on the knowledge that it will be statistically more efficient (without knowing if negligibly or significantly so). What are the downsides here? |
The only thing we should pay attention to is the fact that it may be throwaway work. The only way of realistically measuring the improvement will be to implement the feature and see. |
I ran the network and vsock throughput performance tests and no difference was noticed. This is not conclusive, since they have some deltas that go up to ~10%. Next step would be to try to measure the average syscall duration with and without seccomp, with |
I ran some tests with iperf-vsock, with HOST-to-VM traffic, and recorded the syscall entry and syscall exit points using I've written a script that parses the perf output and computes the average.
There is also no visible difference in the reported throughput when running iperf-vsock, with seccomp enabled and disabled. We can now conclude the investigation, since the overhead of the seccomp filtering is not noticeable. Closing this issue per the above investigation and reasoning |
The seccomp whitelist should have a way to specify the order in which the rules are checked. This would allow for the most frequently used syscalls to be checked first, so that they are quickly allowed through the filter.
An idea is to use a vector to hold the whitelist, such that the order of items in that vector is reflected in the order of BPF statements produced by the filter. A quick PoC for that idea can be found here.
The text was updated successfully, but these errors were encountered: