[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKOZueu5aDtHDBzp6qKECTHEejjb=dyegQkuHh8NfwgNktzFow@mail.gmail.com>
Date: Wed, 7 Nov 2018 15:48:20 +0000
From: Daniel Colascione <dancol@...gle.com>
To: Michal Hocko <mhocko@...nel.org>
Cc: linux-kernel <linux-kernel@...r.kernel.org>, rppt@...ux.ibm.com,
Tim Murray <timmurray@...gle.com>,
Joel Fernandes <joelaf@...gle.com>,
Suren Baghdasaryan <surenb@...gle.com>,
Jonathan Corbet <corbet@....net>,
Andrew Morton <akpm@...ux-foundation.org>,
Roman Gushchin <guro@...com>,
Mike Rapoport <rppt@...ux.vnet.ibm.com>,
Vlastimil Babka <vbabka@...e.cz>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
"Dennis Zhou (Facebook)" <dennisszhou@...il.com>,
Prashant Dhamdhere <pdhamdhe@...hat.com>,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>
Subject: Re: [PATCH v2] Document /proc/pid PID reuse behavior
On Tue, Nov 6, 2018 at 1:05 PM, Michal Hocko <mhocko@...nel.org> wrote:
> On Mon 05-11-18 13:22:05, Daniel Colascione wrote:
>> State explicitly that holding a /proc/pid file descriptor open does
>> not reserve the PID. Also note that in the event of PID reuse, these
>> open file descriptors refer to the old, now-dead process, and not the
>> new one that happens to be named the same numeric PID.
>
> This sounds quite obvious
Many people *on* *LKML* were wrong about this behavior. If it's not
obvious to experienced kernel developers, it's certainly not obvious
to the public.
> otherwise anybody could simply DoS the system
> by consuming all available pids.
People can do that today using the instrument of terror widely known
as fork(2). The only thing standing between fork(2) and a full process
table is RLIMIT_NPROC. In a world where we really did reserve a
numeric PID through the lifetime of any struct pid to which it refers
(i.e., where "cd /proc/$PID" held $PID), we could charge these struct
pid reservations against RLIMIT_NPROC and achieve behavior as safe as
what we have today. The details would be subtle (you'd have to take
pains to avoid double-counting, for example), but it could be made to
work. Other people, on the various lkml threads about my process API
improvement proposals, have proposed fixing the longstanding PID race
problem by making struct pid behave the way people mistakenly believe
it behaves today. It's a serious idea worth actual consideration.
Powered by blists - more mailing lists