vminitd: Wait for execvpe to return to continue (#275)

Today, because we don't wait for execvpe to finish to continue onwards,
it's possible that if you did an exec quick enough after starting an
init process for a container, that you could join the init processes
namespaces before pivot_root has taken place which is quite fun. Let's
wait for exec to finish (or an error to occur) to prevent this.
This commit is contained in:
Danny Canter
2025-08-26 09:34:13 -07:00
committed by GitHub
parent 48e2f412b3
commit df2425ef7f
3 changed files with 17 additions and 12 deletions
-1
View File
@@ -101,7 +101,6 @@ struct ExecCommand: ParsableCommand {
let data = Data(bytes: &masterFD, count: MemoryLayout.size(ofValue: masterFD))
try syncPipe.write(contentsOf: data)
try syncPipe.close()
// Wait for the grandparent to tell us that they acked our console.
guard let data = try ackPipe.read(upToCount: App.ackConsole.count) else {