Bump maxFiles limit in urpc package to 128.

Earlier the limit was 32. If a user has >28 bind mounts, somehow,
then Sandbox.StartSubContainer() fails because it needs to donate
3 stdio FDs, 1 root gofer mount FD and 29+ bind mount FDs. And
runsc fails fatally when donating more than maxFiles FDs in 1 URPC.

Some users were hitting this limit. 128 ought to be enough for
everyone. If not, we can revisit later and maybe make this
configurable and handle unlimited bind mounts by making multiple
sendmsg(2) calls in Sandbox.StartSubContainer(). For now, let's
avoid that complexity.

Fixes #7725

PiperOrigin-RevId: 463744396
This commit is contained in:
Ayush Ranjan
2022-07-27 20:48:36 -07:00
committed by gVisor bot
parent 502cc29f87
commit b25a0feddd
+3 -2
View File
@@ -35,8 +35,9 @@ import (
"gvisor.dev/gvisor/pkg/unet"
)
// maxFiles determines the maximum file payload.
const maxFiles = 32
// maxFiles determines the maximum file payload. This limit is arbitrary. Linux
// allows SCM_MAX_FD = 253 FDs to be donated in one sendmsg(2) call.
const maxFiles = 128
// ErrTooManyFiles is returned when too many file descriptors are mapped.
var ErrTooManyFiles = errors.New("too many files")