This fix is related to 36219
This fix updates runc to:
```
-RUNC_COMMIT=9f9c96235cc97674e935002fc3d78361b696a69e
+RUNC_COMMIT=6c55f98695e902427906eed2c799e566e3d3dfb5
-github.com/opencontainers/runc 9f9c96235cc97674e935002fc3d78361b696a69e
+github.com/opencontainers/runc 6c55f98695e902427906eed2c799e566e3d3dfb5
```
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
| ... | ... |
@@ -3,7 +3,7 @@ |
| 3 | 3 |
TOMLV_COMMIT=9baf8a8a9f2ed20a8e54160840c492f937eeaf9a |
| 4 | 4 |
|
| 5 | 5 |
# When updating RUNC_COMMIT, also update runc in vendor.conf accordingly |
| 6 |
-RUNC_COMMIT=9f9c96235cc97674e935002fc3d78361b696a69e |
|
| 6 |
+RUNC_COMMIT=6c55f98695e902427906eed2c799e566e3d3dfb5 |
|
| 7 | 7 |
|
| 8 | 8 |
# containerd is also pinned in vendor.conf. When updating the binary |
| 9 | 9 |
# version you may also need to update the vendor version to pick up bug |
| ... | ... |
@@ -66,7 +66,7 @@ github.com/pborman/uuid v1.0 |
| 66 | 66 |
google.golang.org/grpc v1.3.0 |
| 67 | 67 |
|
| 68 | 68 |
# When updating, also update RUNC_COMMIT in hack/dockerfile/binaries-commits accordingly |
| 69 |
-github.com/opencontainers/runc 9f9c96235cc97674e935002fc3d78361b696a69e |
|
| 69 |
+github.com/opencontainers/runc 6c55f98695e902427906eed2c799e566e3d3dfb5 |
|
| 70 | 70 |
github.com/opencontainers/runtime-spec v1.0.1 |
| 71 | 71 |
github.com/opencontainers/image-spec v1.0.1 |
| 72 | 72 |
github.com/seccomp/libseccomp-golang 32f571b70023028bd57d9288c20efbcb237f3ce0 |
| ... | ... |
@@ -22,7 +22,6 @@ |
| 22 | 22 |
#include <sys/types.h> |
| 23 | 23 |
#include <sys/wait.h> |
| 24 | 24 |
|
| 25 |
- |
|
| 26 | 25 |
#include <linux/limits.h> |
| 27 | 26 |
#include <linux/netlink.h> |
| 28 | 27 |
#include <linux/types.h> |
| ... | ... |
@@ -32,15 +31,15 @@ |
| 32 | 32 |
|
| 33 | 33 |
/* Synchronisation values. */ |
| 34 | 34 |
enum sync_t {
|
| 35 |
- SYNC_USERMAP_PLS = 0x40, /* Request parent to map our users. */ |
|
| 36 |
- SYNC_USERMAP_ACK = 0x41, /* Mapping finished by the parent. */ |
|
| 37 |
- SYNC_RECVPID_PLS = 0x42, /* Tell parent we're sending the PID. */ |
|
| 38 |
- SYNC_RECVPID_ACK = 0x43, /* PID was correctly received by parent. */ |
|
| 39 |
- SYNC_GRANDCHILD = 0x44, /* The grandchild is ready to run. */ |
|
| 40 |
- SYNC_CHILD_READY = 0x45, /* The child or grandchild is ready to return. */ |
|
| 35 |
+ SYNC_USERMAP_PLS = 0x40, /* Request parent to map our users. */ |
|
| 36 |
+ SYNC_USERMAP_ACK = 0x41, /* Mapping finished by the parent. */ |
|
| 37 |
+ SYNC_RECVPID_PLS = 0x42, /* Tell parent we're sending the PID. */ |
|
| 38 |
+ SYNC_RECVPID_ACK = 0x43, /* PID was correctly received by parent. */ |
|
| 39 |
+ SYNC_GRANDCHILD = 0x44, /* The grandchild is ready to run. */ |
|
| 40 |
+ SYNC_CHILD_READY = 0x45, /* The child or grandchild is ready to return. */ |
|
| 41 | 41 |
|
| 42 | 42 |
/* XXX: This doesn't help with segfaults and other such issues. */ |
| 43 |
- SYNC_ERR = 0xFF, /* Fatal error, no turning back. The error code follows. */ |
|
| 43 |
+ SYNC_ERR = 0xFF, /* Fatal error, no turning back. The error code follows. */ |
|
| 44 | 44 |
}; |
| 45 | 45 |
|
| 46 | 46 |
/* longjmp() arguments. */ |
| ... | ... |
@@ -73,7 +72,7 @@ struct nlconfig_t {
|
| 73 | 73 |
char *oom_score_adj; |
| 74 | 74 |
size_t oom_score_adj_len; |
| 75 | 75 |
|
| 76 |
- /* User namespace settings.*/ |
|
| 76 |
+ /* User namespace settings. */ |
|
| 77 | 77 |
char *uidmap; |
| 78 | 78 |
size_t uidmap_len; |
| 79 | 79 |
char *gidmap; |
| ... | ... |
@@ -82,7 +81,7 @@ struct nlconfig_t {
|
| 82 | 82 |
size_t namespaces_len; |
| 83 | 83 |
uint8_t is_setgroup; |
| 84 | 84 |
|
| 85 |
- /* Rootless container settings.*/ |
|
| 85 |
+ /* Rootless container settings. */ |
|
| 86 | 86 |
uint8_t is_rootless; |
| 87 | 87 |
char *uidmappath; |
| 88 | 88 |
size_t uidmappath_len; |
| ... | ... |
@@ -167,7 +166,7 @@ static int write_file(char *data, size_t data_len, char *pathfmt, ...) |
| 167 | 167 |
goto out; |
| 168 | 168 |
} |
| 169 | 169 |
|
| 170 |
-out: |
|
| 170 |
+ out: |
|
| 171 | 171 |
close(fd); |
| 172 | 172 |
return ret; |
| 173 | 173 |
} |
| ... | ... |
@@ -184,16 +183,16 @@ static void update_setgroups(int pid, enum policy_t setgroup) |
| 184 | 184 |
char *policy; |
| 185 | 185 |
|
| 186 | 186 |
switch (setgroup) {
|
| 187 |
- case SETGROUPS_ALLOW: |
|
| 188 |
- policy = "allow"; |
|
| 189 |
- break; |
|
| 190 |
- case SETGROUPS_DENY: |
|
| 191 |
- policy = "deny"; |
|
| 192 |
- break; |
|
| 193 |
- case SETGROUPS_DEFAULT: |
|
| 194 |
- default: |
|
| 195 |
- /* Nothing to do. */ |
|
| 196 |
- return; |
|
| 187 |
+ case SETGROUPS_ALLOW: |
|
| 188 |
+ policy = "allow"; |
|
| 189 |
+ break; |
|
| 190 |
+ case SETGROUPS_DENY: |
|
| 191 |
+ policy = "deny"; |
|
| 192 |
+ break; |
|
| 193 |
+ case SETGROUPS_DEFAULT: |
|
| 194 |
+ default: |
|
| 195 |
+ /* Nothing to do. */ |
|
| 196 |
+ return; |
|
| 197 | 197 |
} |
| 198 | 198 |
|
| 199 | 199 |
if (write_file(policy, strlen(policy), "/proc/%d/setgroups", pid) < 0) {
|
| ... | ... |
@@ -226,14 +225,14 @@ static int try_mapping_tool(const char *app, int pid, char *map, size_t map_len) |
| 226 | 226 |
if (!child) {
|
| 227 | 227 |
#define MAX_ARGV 20 |
| 228 | 228 |
char *argv[MAX_ARGV]; |
| 229 |
- char *envp[] = {NULL};
|
|
| 229 |
+ char *envp[] = { NULL };
|
|
| 230 | 230 |
char pid_fmt[16]; |
| 231 | 231 |
int argc = 0; |
| 232 | 232 |
char *next; |
| 233 | 233 |
|
| 234 | 234 |
snprintf(pid_fmt, 16, "%d", pid); |
| 235 | 235 |
|
| 236 |
- argv[argc++] = (char *) app; |
|
| 236 |
+ argv[argc++] = (char *)app; |
|
| 237 | 237 |
argv[argc++] = pid_fmt; |
| 238 | 238 |
/* |
| 239 | 239 |
* Convert the map string into a list of argument that |
| ... | ... |
@@ -319,7 +318,7 @@ static int clone_parent(jmp_buf *env, int jmpval) __attribute__ ((noinline)); |
| 319 | 319 |
static int clone_parent(jmp_buf *env, int jmpval) |
| 320 | 320 |
{
|
| 321 | 321 |
struct clone_t ca = {
|
| 322 |
- .env = env, |
|
| 322 |
+ .env = env, |
|
| 323 | 323 |
.jmpval = jmpval, |
| 324 | 324 |
}; |
| 325 | 325 |
|
| ... | ... |
@@ -533,7 +532,7 @@ void nsexec(void) |
| 533 | 533 |
int pipenum; |
| 534 | 534 |
jmp_buf env; |
| 535 | 535 |
int sync_child_pipe[2], sync_grandchild_pipe[2]; |
| 536 |
- struct nlconfig_t config = {0};
|
|
| 536 |
+ struct nlconfig_t config = { 0 };
|
|
| 537 | 537 |
|
| 538 | 538 |
/* |
| 539 | 539 |
* If we don't have an init pipe, just return to the go routine. |
| ... | ... |
@@ -630,21 +629,21 @@ void nsexec(void) |
| 630 | 630 |
*/ |
| 631 | 631 |
|
| 632 | 632 |
switch (setjmp(env)) {
|
| 633 |
- /* |
|
| 634 |
- * Stage 0: We're in the parent. Our job is just to create a new child |
|
| 635 |
- * (stage 1: JUMP_CHILD) process and write its uid_map and |
|
| 636 |
- * gid_map. That process will go on to create a new process, then |
|
| 637 |
- * it will send us its PID which we will send to the bootstrap |
|
| 638 |
- * process. |
|
| 639 |
- */ |
|
| 640 |
- case JUMP_PARENT: {
|
|
| 633 |
+ /* |
|
| 634 |
+ * Stage 0: We're in the parent. Our job is just to create a new child |
|
| 635 |
+ * (stage 1: JUMP_CHILD) process and write its uid_map and |
|
| 636 |
+ * gid_map. That process will go on to create a new process, then |
|
| 637 |
+ * it will send us its PID which we will send to the bootstrap |
|
| 638 |
+ * process. |
|
| 639 |
+ */ |
|
| 640 |
+ case JUMP_PARENT:{
|
|
| 641 | 641 |
int len; |
| 642 | 642 |
pid_t child, first_child = -1; |
| 643 | 643 |
char buf[JSON_MAX]; |
| 644 | 644 |
bool ready = false; |
| 645 | 645 |
|
| 646 | 646 |
/* For debugging. */ |
| 647 |
- prctl(PR_SET_NAME, (unsigned long) "runc:[0:PARENT]", 0, 0, 0); |
|
| 647 |
+ prctl(PR_SET_NAME, (unsigned long)"runc:[0:PARENT]", 0, 0, 0); |
|
| 648 | 648 |
|
| 649 | 649 |
/* Start the process of getting a container. */ |
| 650 | 650 |
child = clone_parent(&env, JUMP_CHILD); |
| ... | ... |
@@ -702,7 +701,7 @@ void nsexec(void) |
| 702 | 702 |
bail("failed to sync with child: write(SYNC_USERMAP_ACK)");
|
| 703 | 703 |
} |
| 704 | 704 |
break; |
| 705 |
- case SYNC_RECVPID_PLS: {
|
|
| 705 |
+ case SYNC_RECVPID_PLS:{
|
|
| 706 | 706 |
first_child = child; |
| 707 | 707 |
|
| 708 | 708 |
/* Get the init_func pid. */ |
| ... | ... |
@@ -781,16 +780,16 @@ void nsexec(void) |
| 781 | 781 |
exit(0); |
| 782 | 782 |
} |
| 783 | 783 |
|
| 784 |
- /* |
|
| 785 |
- * Stage 1: We're in the first child process. Our job is to join any |
|
| 786 |
- * provided namespaces in the netlink payload and unshare all |
|
| 787 |
- * of the requested namespaces. If we've been asked to |
|
| 788 |
- * CLONE_NEWUSER, we will ask our parent (stage 0) to set up |
|
| 789 |
- * our user mappings for us. Then, we create a new child |
|
| 790 |
- * (stage 2: JUMP_INIT) for PID namespace. We then send the |
|
| 791 |
- * child's PID to our parent (stage 0). |
|
| 792 |
- */ |
|
| 793 |
- case JUMP_CHILD: {
|
|
| 784 |
+ /* |
|
| 785 |
+ * Stage 1: We're in the first child process. Our job is to join any |
|
| 786 |
+ * provided namespaces in the netlink payload and unshare all |
|
| 787 |
+ * of the requested namespaces. If we've been asked to |
|
| 788 |
+ * CLONE_NEWUSER, we will ask our parent (stage 0) to set up |
|
| 789 |
+ * our user mappings for us. Then, we create a new child |
|
| 790 |
+ * (stage 2: JUMP_INIT) for PID namespace. We then send the |
|
| 791 |
+ * child's PID to our parent (stage 0). |
|
| 792 |
+ */ |
|
| 793 |
+ case JUMP_CHILD:{
|
|
| 794 | 794 |
pid_t child; |
| 795 | 795 |
enum sync_t s; |
| 796 | 796 |
|
| ... | ... |
@@ -799,7 +798,7 @@ void nsexec(void) |
| 799 | 799 |
close(sync_child_pipe[1]); |
| 800 | 800 |
|
| 801 | 801 |
/* For debugging. */ |
| 802 |
- prctl(PR_SET_NAME, (unsigned long) "runc:[1:CHILD]", 0, 0, 0); |
|
| 802 |
+ prctl(PR_SET_NAME, (unsigned long)"runc:[1:CHILD]", 0, 0, 0); |
|
| 803 | 803 |
|
| 804 | 804 |
/* |
| 805 | 805 |
* We need to setns first. We cannot do this earlier (in stage 0) |
| ... | ... |
@@ -901,13 +900,13 @@ void nsexec(void) |
| 901 | 901 |
exit(0); |
| 902 | 902 |
} |
| 903 | 903 |
|
| 904 |
- /* |
|
| 905 |
- * Stage 2: We're the final child process, and the only process that will |
|
| 906 |
- * actually return to the Go runtime. Our job is to just do the |
|
| 907 |
- * final cleanup steps and then return to the Go runtime to allow |
|
| 908 |
- * init_linux.go to run. |
|
| 909 |
- */ |
|
| 910 |
- case JUMP_INIT: {
|
|
| 904 |
+ /* |
|
| 905 |
+ * Stage 2: We're the final child process, and the only process that will |
|
| 906 |
+ * actually return to the Go runtime. Our job is to just do the |
|
| 907 |
+ * final cleanup steps and then return to the Go runtime to allow |
|
| 908 |
+ * init_linux.go to run. |
|
| 909 |
+ */ |
|
| 910 |
+ case JUMP_INIT:{
|
|
| 911 | 911 |
/* |
| 912 | 912 |
* We're inside the child now, having jumped from the |
| 913 | 913 |
* start_child() code after forking in the parent. |
| ... | ... |
@@ -921,7 +920,7 @@ void nsexec(void) |
| 921 | 921 |
close(sync_child_pipe[1]); |
| 922 | 922 |
|
| 923 | 923 |
/* For debugging. */ |
| 924 |
- prctl(PR_SET_NAME, (unsigned long) "runc:[2:INIT]", 0, 0, 0); |
|
| 924 |
+ prctl(PR_SET_NAME, (unsigned long)"runc:[2:INIT]", 0, 0, 0); |
|
| 925 | 925 |
|
| 926 | 926 |
if (read(syncfd, &s, sizeof(s)) != sizeof(s)) |
| 927 | 927 |
bail("failed to sync with parent: read(SYNC_GRANDCHILD)");
|