seccomp: ensure rules are loaded in seccomp_memory_deny_write_execute
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>
Wed, 27 Nov 2019 08:57:55 +0000 (09:57 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 15 Dec 2019 10:26:45 +0000 (11:26 +0100)
commitd83010521df72671ab08c88b64ca6b01db04afa3
treedc875a27ef06c48ac308499b079ff2eb3499a9d1
parent2c6568221a4c73aaea8f00690dbab662f4966d09
seccomp: ensure rules are loaded in seccomp_memory_deny_write_execute

If seccomp_memory_deny_write_execute was fatally failing to load rules it
already returned a bad retval.
But if any adding filters failed it skipped the subsequent seccomp_load and
always returned an rc of 0 even if no rule was loaded at all.

Lets fix this requiring to (non fatally-failing) load at least one rule set.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
(cherry picked from commit 903659e7b242c3cc897e32835f1918d380b24e5f)
src/shared/seccomp-util.c