Skip to content

Commit a0918a5

Browse files
authored
Merge pull request #4488 from lifubang/backport-4482
[1.2] drop runc-dmz solution according to overlay solution
2 parents 989d4e4 + f07d92d commit a0918a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+24
-5534
lines changed

.github/workflows/test.yml

-23
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ jobs:
2828
rootless: ["rootless", ""]
2929
race: ["-race", ""]
3030
criu: ["", "criu-dev"]
31-
dmz: ["", "runc_nodmz"]
3231
exclude:
3332
# Disable most of criu-dev jobs, as they are expensive
3433
# (need to compile criu) and don't add much value/coverage.
@@ -38,26 +37,12 @@ jobs:
3837
rootless: rootless
3938
- criu: criu-dev
4039
race: -race
41-
- criu: criu-dev
42-
dmz: runc_nodmz
43-
# Disable most of runc_nodmz jobs, as they don't add much value
44-
# (as dmz is disabled by default anyway).
45-
- dmz: runc_nodmz
46-
os: ubuntu-20.04
47-
- dmz: runc_nodmz
48-
go-version: 1.22.x
49-
- dmz: runc_nodmz
50-
rootless: rootless
51-
- dmz: runc_nodmz
52-
race: -race
5340
- go-version: 1.22.x
5441
os: actuated-arm64-6cpu-8gb
5542
- race: "-race"
5643
os: actuated-arm64-6cpu-8gb
5744
- criu: criu-dev
5845
os: actuated-arm64-6cpu-8gb
59-
- dmz: runc_nodmz
60-
os: actuated-arm64-6cpu-8gb
6146

6247
runs-on: ${{ matrix.os }}
6348

@@ -150,8 +135,6 @@ jobs:
150135
check-latest: true
151136

152137
- name: build
153-
env:
154-
EXTRA_BUILDTAGS: ${{ matrix.dmz }}
155138
run: sudo -E PATH="$PATH" make EXTRA_FLAGS="${{ matrix.race }}" all
156139

157140
- name: Setup Bats and bats libs
@@ -171,8 +154,6 @@ jobs:
171154
172155
- name: unit test
173156
if: matrix.rootless != 'rootless'
174-
env:
175-
EXTRA_BUILDTAGS: ${{ matrix.dmz }}
176157
run: sudo -E PATH="$PATH" -- make TESTFLAGS="${{ matrix.race }}" localunittest
177158

178159
- name: add rootless user
@@ -209,8 +190,6 @@ jobs:
209190
timeout-minutes: 15
210191
strategy:
211192
fail-fast: false
212-
matrix:
213-
dmz: ["", "runc_nodmz"]
214193
runs-on: ubuntu-22.04
215194

216195
steps:
@@ -234,8 +213,6 @@ jobs:
234213
check-latest: true
235214

236215
- name: unit test
237-
env:
238-
EXTRA_BUILDTAGS: ${{ matrix.dmz }}
239216
run: sudo -E PATH="$PATH" -- make GOARCH=386 localunittest
240217

241218
all-done:

.golangci-extra.yml

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
run:
88
build-tags:
99
- seccomp
10-
- runc_nodmz
1110

1211
linters:
1312
disable-all: true

.golangci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
run:
44
build-tags:
55
- seccomp
6-
- runc_nodmz
76

87
linters:
98
enable:

Makefile

+5-23
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ SHELL = /bin/bash
33
CONTAINER_ENGINE := docker
44
GO ?= go
55

6-
# Get CC values for cross-compilation.
7-
include cc_platform.mk
8-
96
PREFIX ?= /usr/local
107
BINDIR := $(PREFIX)/sbin
118
MANDIR := $(PREFIX)/share/man
@@ -73,10 +70,10 @@ endif
7370
.DEFAULT: runc
7471

7572
.PHONY: runc
76-
runc: runc-bin verify-dmz-arch
73+
runc: runc-bin
7774

7875
.PHONY: runc-bin
79-
runc-bin: runc-dmz
76+
runc-bin:
8077
$(GO_BUILD) -o runc .
8178

8279
.PHONY: all
@@ -92,7 +89,7 @@ recvtty sd-helper seccompagent fs-idmap pidfd-kill remap-rootfs:
9289

9390
.PHONY: clean
9491
clean:
95-
rm -f runc runc-* libcontainer/dmz/binary/runc-dmz
92+
rm -f runc runc-*
9693
rm -f contrib/cmd/memfd-bind/memfd-bind
9794
rm -f tests/cmd/recvtty/recvtty
9895
rm -f tests/cmd/sd-helper/sd-helper
@@ -104,17 +101,12 @@ clean:
104101
rm -rf man/man8
105102

106103
.PHONY: static
107-
static: static-bin verify-dmz-arch
104+
static: static-bin
108105

109106
.PHONY: static-bin
110-
static-bin: runc-dmz
107+
static-bin:
111108
$(GO_BUILD_STATIC) -o runc .
112109

113-
.PHONY: runc-dmz
114-
runc-dmz:
115-
rm -f libcontainer/dmz/binary/runc-dmz
116-
$(GO) generate -tags "$(BUILDTAGS)" ./libcontainer/dmz
117-
118110
.PHONY: releaseall
119111
releaseall: RELEASE_ARGS := "-a 386 -a amd64 -a arm64 -a armel -a armhf -a ppc64le -a riscv64 -a s390x"
120112
releaseall: release
@@ -253,16 +245,6 @@ verify-dependencies: vendor
253245
|| (echo -e "git status:\n $$(git status -- go.mod go.sum vendor/)\nerror: vendor/, go.mod and/or go.sum not up to date. Run \"make vendor\" to update"; exit 1) \
254246
&& echo "all vendor files are up to date."
255247

256-
.PHONY: verify-dmz-arch
257-
verify-dmz-arch:
258-
@if test -s libcontainer/dmz/binary/runc-dmz; then \
259-
set -Eeuo pipefail; \
260-
export LC_ALL=C; \
261-
diff -u \
262-
<(readelf -h runc | grep -E "(Machine|Flags):") \
263-
<(readelf -h libcontainer/dmz/binary/runc-dmz | grep -E "(Machine|Flags):"); \
264-
fi
265-
266248
.PHONY: validate-keyring
267249
validate-keyring:
268250
script/keyring_validate.sh

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,14 @@ make BUILDTAGS=""
106106
| Build Tag | Feature | Enabled by Default | Dependencies |
107107
|---------------|---------------------------------------|--------------------|---------------------|
108108
| `seccomp` | Syscall filtering using `libseccomp`. | yes | `libseccomp` |
109-
| `!runc_nodmz` | Reduce memory usage for CVE-2019-5736 protection by using a small C binary, [see `memfd-bind` for more details][contrib-memfd-bind]. `runc_nodmz` disables this **experimental feature** and causes runc to use a different protection mechanism which will further increases memory usage temporarily during container startup. To enable this feature you also need to set the `RUNC_DMZ=true` environment variable. | yes ||
110109

111110
The following build tags were used earlier, but are now obsoleted:
111+
- **runc_nodmz** (since runc v1.2.1 runc dmz binary is dropped)
112112
- **nokmem** (since runc v1.0.0-rc94 kernel memory settings are ignored)
113113
- **apparmor** (since runc v1.0.0-rc93 the feature is always enabled)
114114
- **selinux** (since runc v1.0.0-rc93 the feature is always enabled)
115115

116116
[contrib-memfd-bind]: /contrib/cmd/memfd-bind/README.md
117-
[dmz README]: /libcontainer/dmz/README.md
118117

119118
### Running the test suite
120119

cc_platform.mk

-61
This file was deleted.

contrib/cmd/memfd-bind/README.md

+3-12
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## memfd-bind ##
22

3-
`runc` normally has to make a binary copy of itself (or of a smaller helper
4-
binary called `runc-dmz`) when constructing a container process in order to
5-
defend against certain container runtime attacks such as CVE-2019-5736.
3+
`runc` normally has to make a binary copy of itself when constructing a
4+
container process in order to defend against certain container runtime attacks
5+
such as CVE-2019-5736.
66

77
This cloned binary only exists until the container process starts (this means
88
for `runc run` and `runc exec`, it only exists for a few hundred milliseconds
@@ -34,15 +34,6 @@ much memory usage they can use:
3434
* `memfd-bind` only creates a single in-memory copy of the `runc` binary (about
3535
10MB), regardless of how many containers are running.
3636

37-
* `runc-dmz` is (depending on which libc it was compiled with) between 10kB and
38-
1MB in size, and a copy is created once per process spawned inside a
39-
container by runc (both the pid1 and every `runc exec`). The `RUNC_DMZ=true`
40-
environment variable needs to be set to opt-in. There are circumstances where
41-
using `runc-dmz` will fail in ways that runc cannot predict ahead of time (such
42-
as restrictive LSMs applied to containers). `runc-dmz` also requires an
43-
additional `execve` over the other options, though since the binary is so small
44-
the cost is probably not even noticeable.
45-
4637
* The classic method of making a copy of the entire `runc` binary during
4738
container process setup takes up about 10MB per process spawned inside the
4839
container by runc (both pid1 and `runc exec`).

docs/experimental.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ Feature | Experimental release | Graduation rel
66
---------------------------------------- | -------------------- | ------------------
77
cgroup v2 | v1.0.0-rc91 | v1.0.0-rc93
88
The `runc features` command | v1.1.0 | v1.2.0
9+
runc-dmz | v1.2.0-rc1 | Dropped in v1.2.1

0 commit comments

Comments
 (0)