seccomp: add helper call to add all secondary archs to a seccomp filter

And make use of it where appropriate for executing services and for
nspawn.
This commit is contained in:
Lennart Poettering
2014-02-18 22:14:00 +01:00
parent f3d5485b80
commit e9642be2cc
6 changed files with 89 additions and 39 deletions
+14 -4
View File
@@ -957,10 +957,20 @@ static int apply_seccomp(ExecContext *c) {
if (!seccomp)
return -ENOMEM;
SET_FOREACH(id, c->syscall_archs, i) {
r = seccomp_arch_add(seccomp, PTR_TO_UINT32(id) - 1);
if (r == -EEXIST)
continue;
if (c->syscall_archs) {
SET_FOREACH(id, c->syscall_archs, i) {
r = seccomp_arch_add(seccomp, PTR_TO_UINT32(id) - 1);
if (r == -EEXIST)
continue;
if (r < 0) {
seccomp_release(seccomp);
return r;
}
}
} else {
r = seccomp_add_secondary_archs(seccomp);
if (r < 0) {
seccomp_release(seccomp);
return r;