1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

Merge pull request #9942 from lucaswerkmeister/9939

seccomp: fix #9939 and allow specifying multiple errnos for syscall
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-09-08 12:08:54 +02:00 committed by GitHub
commit a5404992cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1057,7 +1057,15 @@ int seccomp_parse_syscall_filter_full(
if (!(flags & SECCOMP_PARSE_INVERT) == !!(flags & SECCOMP_PARSE_WHITELIST)) {
r = hashmap_put(filter, INT_TO_PTR(id + 1), INT_TO_PTR(errno_num));
if (r < 0)
return flags & SECCOMP_PARSE_LOG ? log_oom() : -ENOMEM;
switch (r) {
case -ENOMEM:
return flags & SECCOMP_PARSE_LOG ? log_oom() : -ENOMEM;
case -EEXIST:
assert_se(hashmap_update(filter, INT_TO_PTR(id + 1), INT_TO_PTR(errno_num)) == 0);
break;
default:
return r;
}
} else
(void) hashmap_remove(filter, INT_TO_PTR(id + 1));
}