From 617ee21647ef86be67e37a3df2413d08c6658799 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Wed, 6 May 2026 00:55:45 +0900 Subject: container/init: mount intermediate before early This is usable as scratch space during early. Signed-off-by: Ophestra --- container/init.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'container/init.go') diff --git a/container/init.go b/container/init.go index f4796f1d..76a77828 100644 --- a/container/init.go +++ b/container/init.go @@ -223,6 +223,13 @@ func initEntrypoint(k syscallDispatcher, msg message.Msg) { state := &setupState{process: make(map[int]WaitStatus), Params: ¶m.Params, Msg: msg, Context: ctx} defer cancel() + if err := k.mount(SourceTmpfsRootfs, intermediateHostPath, FstypeTmpfs, MS_NODEV|MS_NOSUID, zeroString); err != nil { + k.fatalf(msg, "cannot mount intermediate root: %v", optionalErrorUnwrap(err)) + } + if err := k.chdir(intermediateHostPath); err != nil { + k.fatalf(msg, "cannot enter intermediate host path: %v", err) + } + /* early is called right before pivot_root into intermediate root; this step is mostly for gathering information that would otherwise be difficult to obtain via library functions after pivot_root, and @@ -242,13 +249,6 @@ func initEntrypoint(k syscallDispatcher, msg message.Msg) { } } - if err := k.mount(SourceTmpfsRootfs, intermediateHostPath, FstypeTmpfs, MS_NODEV|MS_NOSUID, zeroString); err != nil { - k.fatalf(msg, "cannot mount intermediate root: %v", optionalErrorUnwrap(err)) - } - if err := k.chdir(intermediateHostPath); err != nil { - k.fatalf(msg, "cannot enter intermediate host path: %v", err) - } - if err := k.mkdir(sysrootDir, 0755); err != nil { k.fatalf(msg, "%v", err) } -- cgit v1.3.1