From 575ef307ad5cedb13a514cd038a4880ab8c91242 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 7 May 2026 15:40:47 +0900 Subject: container: binfmt registration This arranges for binfmt entries to be registered for the container. Signed-off-by: Ophestra --- container/container.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'container/container.go') diff --git a/container/container.go b/container/container.go index 85e6596f..8af77315 100644 --- a/container/container.go +++ b/container/container.go @@ -100,6 +100,11 @@ type ( Gid int // Hostname value in UTS namespace. Hostname string + // Register binfmt_misc entries. + Binfmt []BinfmtEntry + // Alternative pathname to attach binfmt_misc filesystem. The zero value + // requires [FstypeProc] to be made available at [fhs.Proc]. + BinfmtPath *check.Absolute // Sequential container setup ops. *Ops @@ -219,6 +224,9 @@ func (p *Container) Start() error { if p.cmd.Process != nil { return errors.New("container: already started") } + if !p.InitAsRoot && len(p.Binfmt) > 0 { + return errors.New("container: init as root required, but not enabled") + } if err := ensureCloseOnExec(); err != nil { return err -- cgit v1.3.1