From b25a0feddde31460f7971ed8e5b3efb2344ea422 Mon Sep 17 00:00:00 2001 From: Ayush Ranjan Date: Wed, 27 Jul 2022 20:46:13 -0700 Subject: [PATCH] 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 --- pkg/urpc/urpc.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/urpc/urpc.go b/pkg/urpc/urpc.go index 44c974d0d..ec63d1aec 100644 --- a/pkg/urpc/urpc.go +++ b/pkg/urpc/urpc.go @@ -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")