@@ -42,20 +42,23 @@ function scmp_act_notify_template() {
42
42
# noNewPrivileges, for this reason many of the following cases are tested with
43
43
# both values.
44
44
45
+ # Test basic actions handled by the agent work fine. noNewPrivileges FALSE.
45
46
@test " runc run [seccomp] (SCMP_ACT_NOTIFY noNewPrivileges false)" {
46
47
scmp_act_notify_template " mkdir /dev/shm/foo && stat /dev/shm/foo-bar" false ' "mkdir"'
47
48
48
49
runc run test_busybox
49
50
[ " $status " -eq 0 ]
50
51
}
51
52
53
+ # Test basic actions handled by the agent work fine. noNewPrivileges TRUE.
52
54
@test " runc run [seccomp] (SCMP_ACT_NOTIFY noNewPrivileges true)" {
53
55
scmp_act_notify_template " mkdir /dev/shm/foo && stat /dev/shm/foo-bar" true ' "mkdir"'
54
56
55
57
runc run test_busybox
56
58
[ " $status " -eq 0 ]
57
59
}
58
60
61
+ # Test actions not-handled by the agent work fine. noNewPrivileges FALSE.
59
62
@test " runc exec [seccomp] (SCMP_ACT_NOTIFY noNewPrivileges false)" {
60
63
requires root
61
64
@@ -68,6 +71,7 @@ function scmp_act_notify_template() {
68
71
[ " $status " -eq 0 ]
69
72
}
70
73
74
+ # Test actions not-handled by the agent work fine. noNewPrivileges TRUE.
71
75
@test " runc exec [seccomp] (SCMP_ACT_NOTIFY noNewPrivileges true)" {
72
76
requires root
73
77
@@ -78,21 +82,24 @@ function scmp_act_notify_template() {
78
82
[ " $status " -eq 0 ]
79
83
}
80
84
85
+ # Test important syscalls (some might be executed by runc) work fine when handled by the agent. noNewPrivileges FALSE.
81
86
@test " runc run [seccomp] (SCMP_ACT_NOTIFY important syscalls noNewPrivileges false)" {
82
87
scmp_act_notify_template " /bin/true" false ' "execve","openat","open","read","close"'
83
88
84
89
runc run test_busybox
85
90
[ " $status " -eq 0 ]
86
91
}
87
92
93
+ # Test important syscalls (some might be executed by runc) work fine when handled by the agent. noNewPrivileges TRUE.
88
94
@test " runc run [seccomp] (SCMP_ACT_NOTIFY important syscalls noNewPrivileges true)" {
89
95
scmp_act_notify_template " /bin/true" true ' "execve","openat","open","read","close"'
90
96
91
97
runc run test_busybox
92
98
[ " $status " -eq 0 ]
93
99
}
94
100
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)" {
96
103
update_config ' .process.args = ["/bin/sh", "-c", "mkdir /dev/shm/foo && stat /dev/shm/foo"]
97
104
| .linux.seccomp = {
98
105
"defaultAction":"SCMP_ACT_ALLOW",
@@ -104,14 +111,16 @@ function scmp_act_notify_template() {
104
111
[ " $status " -eq 0 ]
105
112
}
106
113
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)" {
108
116
scmp_act_notify_template " /bin/true" false ' "mkdir"'
109
117
update_config ' .linux.seccomp.listenerPath = ""'
110
118
111
119
runc run test_busybox
112
120
[ " $status " -ne 0 ]
113
121
}
114
122
123
+ # Test using an invalid socket (none listening) as listenerPath fails.
115
124
@test " runc run [seccomp] (SCMP_ACT_NOTIFY wrong listener path)" {
116
125
scmp_act_notify_template " /bin/true" false ' "mkdir"'
117
126
update_config ' .linux.seccomp.listenerPath = "/some-non-existing-listener-path.sock"'
@@ -120,7 +129,8 @@ function scmp_act_notify_template() {
120
129
[ " $status " -ne 0 ]
121
130
}
122
131
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)" {
124
134
scmp_act_notify_template " /bin/true" false ' "mkdir"'
125
135
update_config ' .linux.seccomp.listenerPath = "@mysocketishere"'
126
136
0 commit comments