diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/11-basic-basic_errors.c | 9 | ||||
-rw-r--r-- | tests/51-live-user_notification.c | 21 | ||||
-rwxr-xr-x | tests/51-live-user_notification.py | 4 |
3 files changed, 28 insertions, 6 deletions
diff --git a/tests/11-basic-basic_errors.c b/tests/11-basic-basic_errors.c index d3b2256..da059df 100644 --- a/tests/11-basic-basic_errors.c +++ b/tests/11-basic-basic_errors.c @@ -41,12 +41,9 @@ int main(int argc, char *argv[]) seccomp_release(ctx); ctx = NULL; - /* seccomp_reset error */ - rc = seccomp_reset(ctx, SCMP_ACT_KILL + 1); - if (rc != -EINVAL) - return -1; - rc = seccomp_reset(ctx, SCMP_ACT_KILL); - if (rc != -EINVAL) + /* ensure that seccomp_reset(NULL, ...) is accepted */ + rc = seccomp_reset(NULL, SCMP_ACT_ALLOW); + if (rc != 0) return -1; /* seccomp_load error */ diff --git a/tests/51-live-user_notification.c b/tests/51-live-user_notification.c index 4340194..4847d8b 100644 --- a/tests/51-live-user_notification.c +++ b/tests/51-live-user_notification.c @@ -99,6 +99,27 @@ int main(int argc, char *argv[]) goto out; } + rc = seccomp_reset(ctx, SCMP_ACT_ALLOW); + if (rc < 0) + goto out; + + rc = seccomp_rule_add(ctx, SCMP_ACT_NOTIFY, SCMP_SYS(getppid), 0, NULL); + if (rc) + goto out; + + rc = seccomp_load(ctx); + if (rc < 0) + goto out; + + rc = seccomp_notify_fd(ctx); + if (rc < 0) + goto out; + if (rc != fd) { + rc = -EFAULT; + goto out; + } else + rc = 0; + out: if (fd >= 0) close(fd); diff --git a/tests/51-live-user_notification.py b/tests/51-live-user_notification.py index 0d81f5e..3449c44 100755 --- a/tests/51-live-user_notification.py +++ b/tests/51-live-user_notification.py @@ -52,6 +52,10 @@ def test(): raise RuntimeError("Child process error") if os.WEXITSTATUS(rc) != 0: raise RuntimeError("Child process error") + f.reset(ALLOW) + f.add_rule(NOTIFY, "getppid") + f.load() + # no easy way to check the notification fd here quit(160) test() |