Skip to content

vminitd: make the runc-backed launch path work, and add a default sec… - #926

Open
crosbymichael wants to merge 1 commit into
apple:mainfrom
crosbymichael:cz-runc-over-vmexec
Open

crosbymichael wants to merge 1 commit into
apple:mainfrom
crosbymichael:cz-runc-over-vmexec

Conversation

@crosbymichael

Copy link
Copy Markdown
Contributor

…comp profile

LinuxContainer.Configuration.ociRuntimePath has existed on main for some time and looks complete: the field is plumbed through the proto, and ManagedContainer already branched on it to build a RuncProcess. It has never worked. Nothing ever placed a runc binary inside the guest, and once one is there, runc create deadlocks on its own output capture before any container starts.

This makes it work, and then uses it for what it is for: runc implements seccomp and the advanced LSMs, so they do not have to be reimplemented in Swift. A pure-Swift seccomp compiler was evaluated and abandoned; delegating to runc is the alternative.

…comp profile

`LinuxContainer.Configuration.ociRuntimePath` has existed on main for some
time and looks complete: the field is plumbed through the proto, and
`ManagedContainer` already branched on it to build a `RuncProcess`. It has
never worked. Nothing ever placed a runc binary inside the guest, and once one
is there, `runc create` deadlocks on its own output capture before any
container starts.

This makes it work, and then uses it for what it is for: runc implements
seccomp and the advanced LSMs, so they do not have to be reimplemented in
Swift. A pure-Swift seccomp compiler was evaluated and abandoned; delegating to
runc is the alternative.

Signed-off-by: michael_crosby <michael_crosby@apple.com>
/// read `spec.linux.seccomp`, so such a container would run unfiltered
/// while every observable said it was sandboxed.
private static func requireOCIRuntimeForSeccomp(_ configuration: Configuration) throws {
guard configuration.ociRuntimePath != nil else {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if someone specified ociRuntimePath = /sbin/vmexec this would not throw but the seccomps would still not be supported right?

/// ``Configuration/ociRuntimePath`` is set. Runs at mount-assembly time, so
/// the order a configuration closure sets its properties in doesn't matter.
private func mountsForRuntime() -> [Mount] {
guard self.config.ociRuntimePath != nil else {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar as above? Should the check be if ! vmexec

///
/// Class-bound so owners can track a process by identity: `pid` is `nil` before
/// start and, for the runc implementations, `nil` again after exit.
protocol ContainerProcess: AnyObject, Sendable {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need AnyObject?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants