Re: [PATCH v2] kernel: add pid_max to pid_namespace
From: Christian Brauner
Date: Fri Nov 22 2024 - 06:31:51 EST
On Thu, Nov 21, 2024 at 07:33:54AM -0700, Tycho Andersen wrote:
> On Wed, Nov 20, 2024 at 10:06:27AM +0100, Christian Brauner wrote:
> > On Tue, Nov 05, 2024 at 11:10:24AM +0800, Yun Zhou wrote:
> > > It is necessary to have a different pid_max in different containers.
> > > For example, multiple containers are running on a host, one of which
> > > is Android, and its 32 bit bionic libc only accepts pid <= 65535. So
> > > it requires the global pid_max <= 65535. This will cause configuration
> > > conflicts with other containers and also limit the maximum number of
> > > tasks for the entire system.
> > >
> > > Signed-off-by: Yun Zhou <yun.zhou@xxxxxxxxxxxxx>
> > > ---
> >
> > Fwiw, I've done a patch like this years ago and then Alex revived it in
> > [1] including selftests! There's downsides to consider:
> >
> > [1]: https://lore.kernel.org/lkml/20240222160915.315255-1-aleksandr.mikhalitsyn@xxxxxxxxxxxxx
>
> Thanks, looks like this patch has the same oddity.
>
> For me it's enough to just walk up the tree when changing pid_max. It
> seems unlikely that applications will create a sub pidns and then lower
> the max in their own pid_max. Famous last words and all that.
I think we should revive Alex series. Not just because it has selftests
but afaict the implementation is a bit more robust.