Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/runtime/host/sandbox: Verify sandbox binary when needed #6060

Merged
merged 3 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changelog/6060.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
go/runtime/host/sandbox: Verify sandbox binary when needed

Ensures validator nodes without configured runtimes and with the default
runtime provisioner set to sandbox do not fail to start if bubblewrap
is not installed.
1 change: 1 addition & 0 deletions go/oasis-test-runner/oasis/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func (val *Validator) AddArgs(args *argBuilder) error {
}

func (val *Validator) ModifyConfig() error {
val.Config.Mode = config.ModeValidator
val.Config.Consensus.Validator = true

val.Config.Consensus.ListenAddress = allInterfacesAddr + ":" + strconv.Itoa(int(val.consensusPort))
Expand Down
8 changes: 8 additions & 0 deletions go/runtime/host/sandbox/process/bwrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ func (b *fdPipeBuilder) close() {

// NewBubbleWrap creates a Bubblewrap-based sandbox.
func NewBubbleWrap(cfg Config) (Process, error) {
// Make sure the sandbox binary exists.
if _, err := os.Stat(cfg.SandboxBinaryPath); err != nil {
if os.IsNotExist(err) {
return nil, fmt.Errorf("sandbox binary not found")
}
return nil, fmt.Errorf("failed to stat sandbox binary: %w", err)
}

var fdPipes fdPipeBuilder
// Make sure the sandbox starts in the given time.
fdPipes.deadline = time.Now().Add(sandboxStartTimeout)
Expand Down
6 changes: 0 additions & 6 deletions go/runtime/registry/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"maps"
"os"
"path/filepath"
"slices"
"strings"
Expand Down Expand Up @@ -158,11 +157,6 @@ func createProvisioner(
fallthrough
case rtConfig.RuntimeProvisionerSandboxed:
// Sandboxed provisioner, can be used with no TEE or with Intel SGX.
if !insecureNoSandbox {
if _, err = os.Stat(sandboxBinary); err != nil {
return nil, fmt.Errorf("failed to stat sandbox binary: %w", err)
}
}

// Configure the non-TEE provisioner.
provisioners[component.TEEKindNone], err = hostSandbox.NewProvisioner(hostSandbox.Config{
Expand Down
10 changes: 5 additions & 5 deletions go/worker/keymanager/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ func (w *Worker) worker() {
case 1:
comp = comps[0]
default:
w.logger.Error("expected a single runtime component (got %d)", numComps)
w.logger.Error("expected one runtime component", "total", numComps)
return false
}

Expand All @@ -431,18 +431,18 @@ func (w *Worker) worker() {
return
}
if !comp.ID().IsRONL() {
w.logger.Error("expected a RONL key manager runtime component (got %d)", comp.ID())
w.logger.Error("expected RONL runtime component", "id", comp.ID())
return
}

// Provision the specified runtime component.
w.logger.Info("provisioning key manager runtime component",
w.logger.Info("provisioning runtime component",
"id", comp.ID(),
"version", comp.Version,
)

if err := w.ProvisionHostedRuntimeComponent(comp); err != nil {
w.logger.Error("failed to provision key manager runtime component",
w.logger.Error("failed to provision runtime component",
"err", err,
"id", comp.ID(),
"version", comp.Version,
Expand All @@ -468,7 +468,7 @@ func (w *Worker) worker() {

// Ensure that the runtime version is active.
if _, err := w.GetHostedRuntimeActiveVersion(); err != nil {
w.logger.Error("failed to activate key manager runtime component",
w.logger.Error("failed to activate runtime component",
"err", err,
"id", comp.ID(),
"version", comp.Version,
Expand Down
Loading