summaryrefslogtreecommitdiff
path: root/tests/13-basic-attrs.c
diff options
context:
space:
mode:
authorPaul Moore <paul@paul-moore.com>2020-06-06 16:36:38 -0400
committerPaul Moore <paul@paul-moore.com>2020-06-16 11:22:29 -0400
commit34bf78abc9567b66c72dbe67e7f243072162a25f (patch)
tree5687b1d38934d4d592f02ce0efb7eca791fa59af /tests/13-basic-attrs.c
parent047a591721631e5da13de7038680ba4000f4365b (diff)
downloadlibseccomp-34bf78abc9567b66c72dbe67e7f243072162a25f.tar.gz
api: add the SCMP_FLTATR_API_SYSRAWRC filter attribute
See the manpage additions as part of this patch, but the basic idea is that when this attribute is non-zero we make every effort to convey the system's errno value back to the caller when something goes wrong in libc or the kernel. It is important to note from a support perspective that our ability to support callers who make use of this attribute will be diminished as the libc and kernel errno values are beyond libseccomp's control. If the attribute is zero, the library hides all of the system failures under -ECANCELED. Acked-by: Tom Hromatka <tom.hromatka@oracle.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'tests/13-basic-attrs.c')
-rw-r--r--tests/13-basic-attrs.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/13-basic-attrs.c b/tests/13-basic-attrs.c
index e7b14f0..e3c5881 100644
--- a/tests/13-basic-attrs.c
+++ b/tests/13-basic-attrs.c
@@ -120,6 +120,28 @@ int main(int argc, char *argv[])
goto out;
}
+ rc = seccomp_attr_set(ctx, SCMP_FLTATR_CTL_OPTIMIZE, 2);
+ if (rc != 0)
+ goto out;
+ rc = seccomp_attr_get(ctx, SCMP_FLTATR_CTL_OPTIMIZE, &val);
+ if (rc != 0)
+ goto out;
+ if (val != 2) {
+ rc = -1;
+ goto out;
+ }
+
+ rc = seccomp_attr_set(ctx, SCMP_FLTATR_API_SYSRAWRC, 1);
+ if (rc != 0)
+ goto out;
+ rc = seccomp_attr_get(ctx, SCMP_FLTATR_API_SYSRAWRC, &val);
+ if (rc != 0)
+ goto out;
+ if (val != 1) {
+ rc = -1;
+ goto out;
+ }
+
rc = 0;
out:
seccomp_release(ctx);