mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
merge #3790 into main
Kazuki Hasegawa (1): Fix undefined behavior. Do not accept setjmp return value as variable. LGTMs: AkihiroSuda cyphar Closes #3790
This commit is contained in:
@@ -980,8 +980,7 @@ void nsexec(void)
|
||||
* -- Aleksa "what has my life come to?" Sarai
|
||||
*/
|
||||
|
||||
current_stage = setjmp(env);
|
||||
switch (current_stage) {
|
||||
switch (setjmp(env)) {
|
||||
/*
|
||||
* Stage 0: We're in the parent. Our job is just to create a new child
|
||||
* (stage 1: STAGE_CHILD) process and write its uid_map and
|
||||
@@ -995,6 +994,7 @@ void nsexec(void)
|
||||
bool stage1_complete, stage2_complete;
|
||||
|
||||
/* For debugging. */
|
||||
current_stage = STAGE_PARENT;
|
||||
prctl(PR_SET_NAME, (unsigned long)"runc:[0:PARENT]", 0, 0, 0);
|
||||
write_log(DEBUG, "~> nsexec stage-0");
|
||||
|
||||
@@ -1152,6 +1152,9 @@ void nsexec(void)
|
||||
pid_t stage2_pid = -1;
|
||||
enum sync_t s;
|
||||
|
||||
/* For debugging. */
|
||||
current_stage = STAGE_CHILD;
|
||||
|
||||
/* We're in a child and thus need to tell the parent if we die. */
|
||||
syncfd = sync_child_pipe[0];
|
||||
if (close(sync_child_pipe[1]) < 0)
|
||||
@@ -1323,6 +1326,9 @@ void nsexec(void)
|
||||
*/
|
||||
enum sync_t s;
|
||||
|
||||
/* For debugging. */
|
||||
current_stage = STAGE_INIT;
|
||||
|
||||
/* We're in a child and thus need to tell the parent if we die. */
|
||||
syncfd = sync_grandchild_pipe[0];
|
||||
if (close(sync_grandchild_pipe[1]) < 0)
|
||||
@@ -1377,7 +1383,7 @@ void nsexec(void)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
bail("unknown stage '%d' for jump value", current_stage);
|
||||
bail("unexpected jump value");
|
||||
}
|
||||
|
||||
/* Should never be reached. */
|
||||
|
||||
Reference in New Issue
Block a user