Skip to content

Commit 65a8b93

Browse files
milantracygvisor-bot
authored andcommitted
Make the bwrap alias a wrapper around the sandboxexec Go bindings.
bwrap previously built its own specs.Spec, wrote an OCI bundle and drove runsc/container directly. It now only parses the bubblewrap command line and translates it into sandbox.Options; //sandboxexec/sandbox owns the bundle, the runsc invocation and the container lifecycle. To support this, the bindings gain: - Run, an attached counterpart to New that runs a command to completion over `runsc run`, preserving its stdio and exit code, and relaying signals into the container via `runsc kill`. - Options for the process, rootfs, namespaces, ID mappings and mount options bwrap needs, plus opt-outs for the bindings' default mounts, host binary mounts and base environment. Every zero value reproduces the previous bundle layout. - Config, which resolves options into a BundleConfig for testing. - runsc stderr in the failure message from New, instead of a bare exit status. Signal relaying skips SIGURG, SIGPIPE and SIGCHLD as pkg/sighandling does; relaying SIGCHLD would be self-sustaining, since each forwarded signal spawns a runsc process whose exit raises another. Behavior deltas: bwrap now forks a runsc process, passes --ignore-cgroups when not root, and roots a container with no `--bind / /` at the bundle's rootfs directory rather than a separate temporary directory. FUTURE_COPYBARA_INTEGRATE_REVIEW=#14022 from milantracy:bwrap 24a225e PiperOrigin-RevId: 960524302
1 parent 8f03842 commit 65a8b93

6 files changed

Lines changed: 918 additions & 470 deletions

File tree

runsc/cmd/alias/bwrap/BUILD

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ go_library(
1515
"//:__subpackages__",
1616
],
1717
deps = [
18-
"//pkg/log",
1918
"//runsc/cmd/util",
2019
"//runsc/config",
21-
"//runsc/container",
2220
"//runsc/flag",
2321
"//runsc/specutils",
22+
"//sandboxexec/sandbox",
2423
"@com_github_google_subcommands//:go_default_library",
2524
"@com_github_opencontainers_runtime_spec//specs-go:go_default_library",
2625
"@org_golang_x_sys//unix:go_default_library",
@@ -32,6 +31,8 @@ go_test(
3231
srcs = ["bwrap_test.go"],
3332
library = ":bwrap",
3433
deps = [
34+
"//runsc/config",
35+
"//sandboxexec/sandbox",
3536
"@com_github_google_go_cmp//cmp:go_default_library",
3637
"@com_github_google_go_cmp//cmp/cmpopts:go_default_library",
3738
"@com_github_opencontainers_runtime_spec//specs-go:go_default_library",

0 commit comments

Comments
 (0)