seccomp / libseccomp Public
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
BUG: Adding multiple filters does not work as expected #87
Comments
|
Hello. Are you convinced that the |
|
I haven't tried without the cast or with cast to void* but I'm convinced that is not the cause of the issue. Notice that I use the same cast when adding the filter for file1 and that filter works as expected. |
|
I commented on the tor bug, but maybe you didn't see it, or don't believe me. There is no libseccomp bug. You are trying to do something that does not work. The second filter is getting installed and evaluated. When multiple filters are present, all of them are evaluated, and the highest precedence value is returned. You can tighten restrictions by installing additional filters, but can not relax them. This is trivially observable, for example by setting the default action to return 2 different errno values (eg: The |
|
I did not see your comment. I see my mistake now. I misunderstood the seccomp documentation. I was thinking that the rules of all filters were evaluated and then the highest precedence value of those was returned. But the default value is evaluated too. You're correct. This means that no further allow rules can be added after having a filter with the default other than allow. |
|
Thanks @Yawning, I missed the first seccomp_load()/seccomp_init() and thought this was a single filter instance, despite the subject line. I'm going to close this issue, thanks for your help! |
When trying to add two filters, the second filter seems to have no effect, even though the call to seccomp_load returns 0.
From the man page of seccomp (http://man7.org/linux/man-pages/man2/seccomp.2.html), I expected both filters to work:
I've created a small program to exemplify the issue:
I expected the program to terminate successfully, instead I get the following output:
The cause is the syscall to open file2 not being allowed despite the filter being added, as can be seen from the following strace output:
The text was updated successfully, but these errors were encountered: