@@ -42,20 +42,23 @@ function scmp_act_notify_template() {
4242# noNewPrivileges, for this reason many of the following cases are tested with
4343# both values.
4444
45+ # Test basic actions handled by the agent work fine. noNewPrivileges FALSE.
4546@test " runc run [seccomp] (SCMP_ACT_NOTIFY noNewPrivileges false)" {
4647 scmp_act_notify_template " mkdir /dev/shm/foo && stat /dev/shm/foo-bar" false ' "mkdir"'
4748
4849 runc run test_busybox
4950 [ " $status " -eq 0 ]
5051}
5152
53+ # Test basic actions handled by the agent work fine. noNewPrivileges TRUE.
5254@test " runc run [seccomp] (SCMP_ACT_NOTIFY noNewPrivileges true)" {
5355 scmp_act_notify_template " mkdir /dev/shm/foo && stat /dev/shm/foo-bar" true ' "mkdir"'
5456
5557 runc run test_busybox
5658 [ " $status " -eq 0 ]
5759}
5860
61+ # Test actions not-handled by the agent work fine. noNewPrivileges FALSE.
5962@test " runc exec [seccomp] (SCMP_ACT_NOTIFY noNewPrivileges false)" {
6063 requires root
6164
@@ -68,6 +71,7 @@ function scmp_act_notify_template() {
6871 [ " $status " -eq 0 ]
6972}
7073
74+ # Test actions not-handled by the agent work fine. noNewPrivileges TRUE.
7175@test " runc exec [seccomp] (SCMP_ACT_NOTIFY noNewPrivileges true)" {
7276 requires root
7377
@@ -78,21 +82,24 @@ function scmp_act_notify_template() {
7882 [ " $status " -eq 0 ]
7983}
8084
85+ # Test important syscalls (some might be executed by runc) work fine when handled by the agent. noNewPrivileges FALSE.
8186@test " runc run [seccomp] (SCMP_ACT_NOTIFY important syscalls noNewPrivileges false)" {
8287 scmp_act_notify_template " /bin/true" false ' "execve","openat","open","read","close"'
8388
8489 runc run test_busybox
8590 [ " $status " -eq 0 ]
8691}
8792
93+ # Test important syscalls (some might be executed by runc) work fine when handled by the agent. noNewPrivileges TRUE.
8894@test " runc run [seccomp] (SCMP_ACT_NOTIFY important syscalls noNewPrivileges true)" {
8995 scmp_act_notify_template " /bin/true" true ' "execve","openat","open","read","close"'
9096
9197 runc run test_busybox
9298 [ " $status " -eq 0 ]
9399}
94100
95- @test " runc run [seccomp] (empty listener path)" {
101+ # Ignore listenerPath if the profile doesn't use seccomp notify actions.
102+ @test " runc run [seccomp] (ignore listener path if no notify act)" {
96103 update_config ' .process.args = ["/bin/sh", "-c", "mkdir /dev/shm/foo && stat /dev/shm/foo"]
97104 | .linux.seccomp = {
98105 "defaultAction":"SCMP_ACT_ALLOW",
@@ -104,14 +111,16 @@ function scmp_act_notify_template() {
104111 [ " $status " -eq 0 ]
105112}
106113
107- @test " runc run [seccomp] (SCMP_ACT_NOTIFY empty listener path)" {
114+ # Ensure listenerPath is present if the profile uses seccomp notify actions.
115+ @test " runc run [seccomp] (SCMP_ACT_NOTIFY empty listener path and notify act)" {
108116 scmp_act_notify_template " /bin/true" false ' "mkdir"'
109117 update_config ' .linux.seccomp.listenerPath = ""'
110118
111119 runc run test_busybox
112120 [ " $status " -ne 0 ]
113121}
114122
123+ # Test using an invalid socket (none listening) as listenerPath fails.
115124@test " runc run [seccomp] (SCMP_ACT_NOTIFY wrong listener path)" {
116125 scmp_act_notify_template " /bin/true" false ' "mkdir"'
117126 update_config ' .linux.seccomp.listenerPath = "/some-non-existing-listener-path.sock"'
@@ -120,7 +129,8 @@ function scmp_act_notify_template() {
120129 [ " $status " -ne 0 ]
121130}
122131
123- @test " runc run [seccomp] (SCMP_ACT_NOTIFY abstract listener path)" {
132+ # Test using an invalid abstract socket as listenerPath fails.
133+ @test " runc run [seccomp] (SCMP_ACT_NOTIFY wrong abstract listener path)" {
124134 scmp_act_notify_template " /bin/true" false ' "mkdir"'
125135 update_config ' .linux.seccomp.listenerPath = "@mysocketishere"'
126136
0 commit comments