@@ -12,8 +12,7 @@ function teardown() {
1212}
1313
1414@test " runc run no capability" {
15- runc run test_no_caps
16- [ " $status " -eq 0 ]
15+ runc -0 run test_no_caps
1716
1817 [[ " ${output} " == * " CapInh: 0000000000000000" * ]]
1918 [[ " ${output} " == * " CapAmb: 0000000000000000" * ]]
@@ -22,8 +21,7 @@ function teardown() {
2221
2322@test " runc run with unknown capability" {
2423 update_config ' .process.capabilities.bounding = ["CAP_UNKNOWN", "UNKNOWN_CAP"]'
25- runc run test_unknown_caps
26- [ " $status " -eq 0 ]
24+ runc -0 run test_unknown_caps
2725
2826 [[ " ${output} " == * " CapInh: 0000000000000000" * ]]
2927 [[ " ${output} " == * " CapAmb: 0000000000000000" * ]]
@@ -32,8 +30,7 @@ function teardown() {
3230
3331@test " runc run with new privileges" {
3432 update_config ' .process.noNewPrivileges = false'
35- runc run test_new_privileges
36- [ " $status " -eq 0 ]
33+ runc -0 run test_new_privileges
3734
3835 [[ " ${output} " == * " CapInh: 0000000000000000" * ]]
3936 [[ " ${output} " == * " CapAmb: 0000000000000000" * ]]
@@ -44,8 +41,7 @@ function teardown() {
4441 update_config ' .process.user = {"uid":0}'
4542 update_config ' .process.capabilities.bounding = ["CAP_SYS_ADMIN"]'
4643 update_config ' .process.capabilities.permitted = ["CAP_SYS_ADMIN", "CAP_AUDIT_WRITE", "CAP_KILL", "CAP_NET_BIND_SERVICE"]'
47- runc run test_some_caps
48- [ " $status " -eq 0 ]
44+ runc -0 run test_some_caps
4945
5046 [[ " ${output} " == * " CapInh: 0000000000000000" * ]]
5147 [[ " ${output} " == * " CapBnd: 0000000000200000" * ]]
@@ -57,20 +53,17 @@ function teardown() {
5753@test " runc exec --cap" {
5854 update_config ' .process.args = ["/bin/sh"]
5955 | .process.capabilities = {}'
60- runc run -d --console-socket " $CONSOLE_SOCKET " test_exec_cap
61- [ " $status " -eq 0 ]
56+ runc -0 run -d --console-socket " $CONSOLE_SOCKET " test_exec_cap
6257
63- runc exec test_exec_cap cat /proc/self/status
64- [ " $status " -eq 0 ]
58+ runc -0 exec test_exec_cap cat /proc/self/status
6559 # Check no capabilities are set.
6660 [[ " ${output} " == * " CapInh: 0000000000000000" * ]]
6761 [[ " ${output} " == * " CapPrm: 0000000000000000" * ]]
6862 [[ " ${output} " == * " CapEff: 0000000000000000" * ]]
6963 [[ " ${output} " == * " CapBnd: 0000000000000000" * ]]
7064 [[ " ${output} " == * " CapAmb: 0000000000000000" * ]]
7165
72- runc exec --cap CAP_KILL --cap CAP_AUDIT_WRITE test_exec_cap cat /proc/self/status
73- [ " $status " -eq 0 ]
66+ runc -0 exec --cap CAP_KILL --cap CAP_AUDIT_WRITE test_exec_cap cat /proc/self/status
7467 # Check capabilities are added into bounding/effective/permitted only,
7568 # but not to inheritable or ambient.
7669 #
@@ -90,11 +83,9 @@ function teardown() {
9083 | .process.capabilities.effective = ["CAP_KILL"]
9184 | .process.capabilities.bounding = ["CAP_KILL", "CAP_CHOWN", "CAP_SYSLOG"]
9285 | .process.capabilities.ambient = ["CAP_CHOWN"]'
93- runc run -d --console-socket " $CONSOLE_SOCKET " test_some_caps
94- [ " $status " -eq 0 ]
86+ runc -0 run -d --console-socket " $CONSOLE_SOCKET " test_some_caps
9587
96- runc exec test_some_caps cat /proc/self/status
97- [ " $status " -eq 0 ]
88+ runc -0 exec test_some_caps cat /proc/self/status
9889 # Check that capabilities are as set in spec.
9990 #
10091 # CAP_CHOWN is 0, the bit mask is 0x1 (1 << 0)
@@ -108,8 +99,7 @@ function teardown() {
10899
109100 # Check that if config.json has an inheritable capability set,
110101 # runc exec --cap adds ambient capabilities.
111- runc exec --cap CAP_SYSLOG test_some_caps cat /proc/self/status
112- [ " $status " -eq 0 ]
102+ runc -0 exec --cap CAP_SYSLOG test_some_caps cat /proc/self/status
113103 [[ " ${output} " == * " CapInh: 0000000400000001" * ]]
114104 [[ " ${output} " == * " CapPrm: 0000000400000021" * ]]
115105 [[ " ${output} " == * " CapEff: 0000000400000021" * ]]
@@ -120,8 +110,7 @@ function teardown() {
120110@test " runc run [ambient caps not set in inheritable result in a warning]" {
121111 update_config ' .process.capabilities.inheritable = ["CAP_KILL"]
122112 | .process.capabilities.ambient = ["CAP_KILL", "CAP_CHOWN"]'
123- runc run test_amb
124- [ " $status " -eq 0 ]
113+ runc -0 run test_amb
125114 # This should result in CAP_KILL set in ambient,
126115 # and a warning about inability to set CAP_CHOWN.
127116 #
0 commit comments