]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: add one more test for system call filter with errno 18921/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 8 Mar 2021 03:06:09 +0000 (12:06 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 8 Mar 2021 12:28:42 +0000 (21:28 +0900)
src/test/test-execute.c
test/test-execute/exec-systemcallfilter-with-errno-in-allow-list.service [new file with mode: 0644]

index c0e046b5e21f0d8873549d88bdd5b438ce841b61..239fcea5e3d90e1f46a1d39b6bea6bb0fe7963c9 100644 (file)
@@ -444,6 +444,7 @@ static void test_exec_systemcallfilter(Manager *m) {
         test(m, "exec-systemcallfilter-with-errno-name.service", errno_from_name("EILSEQ"), CLD_EXITED);
         test(m, "exec-systemcallfilter-with-errno-number.service", 255, CLD_EXITED);
         test(m, "exec-systemcallfilter-with-errno-multi.service", errno_from_name("EILSEQ"), CLD_EXITED);
+        test(m, "exec-systemcallfilter-with-errno-in-allow-list.service", errno_from_name("EILSEQ"), CLD_EXITED);
         test(m, "exec-systemcallfilter-override-error-action.service", SIGSYS, CLD_KILLED);
         test(m, "exec-systemcallfilter-override-error-action2.service", errno_from_name("EILSEQ"), CLD_EXITED);
 #endif
diff --git a/test/test-execute/exec-systemcallfilter-with-errno-in-allow-list.service b/test/test-execute/exec-systemcallfilter-with-errno-in-allow-list.service
new file mode 100644 (file)
index 0000000..4b2636e
--- /dev/null
@@ -0,0 +1,9 @@
+[Unit]
+Description=Test for SystemCallFilter with errno name (for issue #18916)
+
+[Service]
+ExecStart=/usr/bin/python3 -c 'import os\ntry: os.uname()\nexcept Exception as e: exit(e.errno)'
+Type=oneshot
+SystemCallFilter=@system-service
+SystemCallFilter=~uname:EILSEQ
+SystemCallErrorNumber=EACCES