Signed-off-by: Paul Moore <[email protected]>
---
tests/11-basic-errors.c | 23 ++++++++++++-----------
tests/11-basic-errors.py | 14 ++++++++------
2 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/tests/11-basic-errors.c b/tests/11-basic-errors.c
index 07710e6..c328577 100644
--- a/tests/11-basic-errors.c
+++ b/tests/11-basic-errors.c
@@ -106,11 +106,9 @@ int main(int argc, char *argv[])
SCMP_A0(_SCMP_CMP_MAX, 0));
if (rc != -EINVAL)
return -1;
-#if __i386__
- rc = seccomp_rule_add(ctx, SCMP_ACT_KILL, -1001, 0);
- if (rc != -EINVAL)
+ rc = seccomp_rule_add_exact(ctx, SCMP_ACT_KILL, -10001, 0);
+ if (rc != -EDOM)
return -1;
-#endif
}
seccomp_release(ctx);
ctx = NULL;
@@ -119,15 +117,18 @@ int main(int argc, char *argv[])
ctx = seccomp_init(SCMP_ACT_ALLOW);
if (ctx == NULL)
return -1;
- else {
-#if __i386__
- rc = seccomp_rule_add_exact(ctx,
- SCMP_ACT_KILL, SCMP_SYS(socket), 1,
- SCMP_A0(SCMP_CMP_EQ, 2));
- if (rc != -EINVAL)
+ if (seccomp_arch_native() != SCMP_ARCH_X86) {
+ rc = seccomp_arch_add(ctx, SCMP_ARCH_X86);
+ if (rc != 0)
+ return -1;
+ rc = seccomp_arch_remove(ctx, SCMP_ARCH_NATIVE);
+ if (rc != 0)
return -1;
-#endif
}
+ rc = seccomp_rule_add_exact(ctx, SCMP_ACT_KILL, SCMP_SYS(socket), 1,
+ SCMP_A0(SCMP_CMP_EQ, 2));
+ if (rc != -EINVAL)
+ return -1;
seccomp_release(ctx);
ctx = NULL;
diff --git a/tests/11-basic-errors.py b/tests/11-basic-errors.py
index 900548d..4923e9b 100755
--- a/tests/11-basic-errors.py
+++ b/tests/11-basic-errors.py
@@ -43,7 +43,7 @@ def test():
f = SyscallFilter(ALLOW)
try:
- f.syscall_priority(-1000, 1)
+ f.syscall_priority(-10000, 1)
except RuntimeError:
pass
@@ -74,11 +74,13 @@ def test():
pass
f = SyscallFilter(ALLOW)
- if f.exist_arch(Arch.X86):
- try:
- f.add_rule_exactly(KILL, "socket", Arg(0, EQ, 2))
- except RuntimeError:
- pass
+ if not f.exist_arch(Arch.X86):
+ f.add_arch(Arch.X86)
+ f.remove_arch(Arch.NATIVE)
+ try:
+ f.add_rule_exactly(KILL, "socket", Arg(0, EQ, 2))
+ except RuntimeError:
+ pass
test()
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
libseccomp-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libseccomp-discuss