Skip to content

Commit 2fc0caf

Browse files
authored
Merge pull request #4509 from cyphar/overlay-exe-fixups
dmz: overlay: minor fixups
2 parents ef3999d + b9dfb22 commit 2fc0caf

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ The following build tags were used earlier, but are now obsoleted:
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

116-
[contrib-memfd-bind]: /contrib/cmd/memfd-bind/README.md
117-
118116
### Running the test suite
119117

120118
`runc` currently supports running its test suite via Docker.

contrib/cmd/memfd-bind/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
## memfd-bind ##
22

3-
`runc` normally has to make a binary copy of itself when constructing a
3+
> **NOTE**: Since runc 1.2.0, runc will now use a private overlayfs mount to
4+
> protect the runc binary. This protection is far more light-weight than
5+
> memfd-bind, and for most users this should obviate the need for `memfd-bind`
6+
> entirely. Rootless containers will still make a memfd copy (unless you are
7+
> using `runc` itself inside a user namespace -- a-la
8+
> [`rootlesskit`][rootlesskit]), but `memfd-bind` is not particularly useful
9+
> for rootless container users anyway (see [Caveats](#Caveats) for more
10+
> details).
11+
12+
`runc` sometimes has to make a binary copy of itself when constructing a
413
container process in order to defend against certain container runtime attacks
514
such as CVE-2019-5736.
615

@@ -38,6 +47,8 @@ much memory usage they can use:
3847
container process setup takes up about 10MB per process spawned inside the
3948
container by runc (both pid1 and `runc exec`).
4049

50+
[rootlesskit]: https://github.com/rootless-containers/rootlesskit
51+
4152
### Caveats ###
4253

4354
There are several downsides with using `memfd-bind` on the `runc` binary:

libcontainer/dmz/overlayfs_linux.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ func sealedOverlayfs(binPath, tmpDir string) (_ *os.File, Err error) {
8484
return nil, fmt.Errorf("fsconfig set overlayfs lowerdir=%s: %w", lowerDirStr, err)
8585
}
8686

87+
// We don't care about xino (Linux 4.17) but it will be auto-enabled on
88+
// some systems (if /run/runc and /usr/bin are on different filesystems)
89+
// and this produces spurious dmesg log entries. We can safely ignore
90+
// errors when disabling this because we don't actually care about the
91+
// setting and we're just opportunistically disabling it.
92+
_ = unix.FsconfigSetString(int(overlayCtx.Fd()), "xino", "off")
93+
8794
// Get an actual handle to the overlayfs.
8895
if err := unix.FsconfigCreate(int(overlayCtx.Fd())); err != nil {
8996
return nil, os.NewSyscallError("fsconfig create overlayfs", err)

0 commit comments

Comments
 (0)