summaryrefslogtreecommitdiff
path: root/test/test-execute
diff options
context:
space:
mode:
authorTopi Miettinen <toiwoton@gmail.com>2020-08-05 16:31:26 +0300
committerTopi Miettinen <toiwoton@gmail.com>2020-09-15 12:54:17 +0300
commit005bfaf11876e261de6b99d597b69f664b53e7c5 (patch)
tree7aa214e69fad5ff0d0ac245529707dbf2dbbd44d /test/test-execute
parent150c430fd499082164b6ddbd2f501e2333261a78 (diff)
downloadsystemd-005bfaf11876e261de6b99d597b69f664b53e7c5.tar.gz
exec: Add kill action to system call filters
Define explicit action "kill" for SystemCallErrorNumber=. In addition to errno code, allow specifying "kill" as action for SystemCallFilter=. --- v7: seccomp_parse_errno_or_action() returns -EINVAL if !HAVE_SECCOMP v6: use streq_ptr(), let errno_to_name() handle bad values, kill processes, init syscall_errno v5: actually use seccomp_errno_or_action_to_string(), don't fail bus unit parsing without seccomp v4: fix build without seccomp v3: drop log action v2: action -> number
Diffstat (limited to 'test/test-execute')
-rw-r--r--test/test-execute/exec-systemcallfilter-override-error-action.service8
-rw-r--r--test/test-execute/exec-systemcallfilter-override-error-action2.service8
2 files changed, 16 insertions, 0 deletions
diff --git a/test/test-execute/exec-systemcallfilter-override-error-action.service b/test/test-execute/exec-systemcallfilter-override-error-action.service
new file mode 100644
index 0000000000..3569b4500c
--- /dev/null
+++ b/test/test-execute/exec-systemcallfilter-override-error-action.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Test for SystemCallFilter with specific kill action overriding default errno action
+
+[Service]
+ExecStart=/usr/bin/python3 -c 'import os\ntry: os.uname()\nexcept Exception as e: exit(e.errno)'
+Type=oneshot
+SystemCallFilter=~uname:kill
+SystemCallErrorNumber=EILSEQ
diff --git a/test/test-execute/exec-systemcallfilter-override-error-action2.service b/test/test-execute/exec-systemcallfilter-override-error-action2.service
new file mode 100644
index 0000000000..04bfd6bfcb
--- /dev/null
+++ b/test/test-execute/exec-systemcallfilter-override-error-action2.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Test for SystemCallFilter with specific errno action overriding default kill action
+
+[Service]
+ExecStart=/usr/bin/python3 -c 'import os\ntry: os.uname()\nexcept Exception as e: exit(e.errno)'
+Type=oneshot
+SystemCallFilter=~uname:EILSEQ
+SystemCallErrorNumber=kill