@@ -66,6 +66,58 @@ function teardown() {
66
66
[[ " $output " == * " Network is down" * ]]
67
67
}
68
68
69
+ @test " runc run [seccomp] (SECCOMP_FILTER_FLAG_LOG)" {
70
+ requires_kernel 4.14 # SECCOMP_FILTER_FLAG_LOG appeared in Linux 4.14
71
+ update_config ' .process.args = ["/bin/sh", "-c", "mkdir /dev/shm/foo"]
72
+ | .process.noNewPrivileges = false
73
+ | .linux.seccomp = {
74
+ "defaultAction":"SCMP_ACT_ALLOW",
75
+ "architectures":["SCMP_ARCH_X86","SCMP_ARCH_X32"],
76
+ "flags":["SECCOMP_FILTER_FLAG_LOG"],
77
+ "syscalls":[{"names":["mkdir"], "action":"SCMP_ACT_ERRNO"}]
78
+ }'
79
+
80
+ # This test checks that the log flag is accepted but does not check the
81
+ # audit log
82
+ runc run test_busybox
83
+ [ " $status " -ne 0 ]
84
+ [[ " $output " == * " mkdir:" * " /dev/shm/foo" * " Operation not permitted" * ]]
85
+ }
86
+
87
+ @test " runc run [seccomp] (SECCOMP_FILTER_FLAG_SPEC_ALLOW)" {
88
+ requires_kernel 4.17 # SECCOMP_FILTER_FLAG_SPEC_ALLOW appeared in Linux 4.17
89
+ update_config ' .process.args = ["/bin/sh", "-c", "mkdir /dev/shm/foo"]
90
+ | .process.noNewPrivileges = false
91
+ | .linux.seccomp = {
92
+ "defaultAction":"SCMP_ACT_ALLOW",
93
+ "architectures":["SCMP_ARCH_X86","SCMP_ARCH_X32"],
94
+ "flags":["SECCOMP_FILTER_FLAG_SPEC_ALLOW"],
95
+ "syscalls":[{"names":["mkdir"], "action":"SCMP_ACT_ERRNO"}]
96
+ }'
97
+
98
+ # This test checks that the SSB flag is accepted but does not check the
99
+ # result
100
+ runc run test_busybox
101
+ [ " $status " -ne 0 ]
102
+ [[ " $output " == * " mkdir:" * " /dev/shm/foo" * " Operation not permitted" * ]]
103
+ }
104
+
105
+ @test " runc run [seccomp] (SECCOMP_FILTER_FLAG_TSYNC)" {
106
+ update_config ' .process.args = ["/bin/sh", "-c", "mkdir /dev/shm/foo"]
107
+ | .process.noNewPrivileges = false
108
+ | .linux.seccomp = {
109
+ "defaultAction":"SCMP_ACT_ALLOW",
110
+ "architectures":["SCMP_ARCH_X86","SCMP_ARCH_X32"],
111
+ "flags":["SECCOMP_FILTER_FLAG_TSYNC"],
112
+ "syscalls":[{"names":["mkdir"], "action":"SCMP_ACT_ERRNO"}]
113
+ }'
114
+
115
+ # This test checks that the tsync flag is accepted
116
+ runc run test_busybox
117
+ [ " $status " -ne 0 ]
118
+ [[ " $output " == * " mkdir:" * " /dev/shm/foo" * " Operation not permitted" * ]]
119
+ }
120
+
69
121
@test " runc run [seccomp] (SCMP_ACT_KILL)" {
70
122
update_config ' .process.args = ["/bin/sh", "-c", "mkdir /dev/shm/foo"]
71
123
| .process.noNewPrivileges = false
0 commit comments