Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-20 Thread Matthew Wilcox
On Tue, Nov 20, 2018 at 09:48:27AM -0800, Daniel Colascione wrote: > On Tue, Nov 20, 2018 at 9:39 AM Matthew Wilcox wrote: > > We have a limit on the number of FDs a process can have open for a reason. > > Well, for many reasons. > > And the typical limit is too low. (I've seen people clamp it to

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-20 Thread Daniel Colascione
On Tue, Nov 20, 2018 at 9:39 AM Matthew Wilcox wrote: > > On Tue, Nov 20, 2018 at 10:18:29AM +0100, Pavel Machek wrote: > > > would ever rely on the pid being reused while having the descriptor > > > open. How would that make sense? > > > > I agree this is corner space, but users might be surprise

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-20 Thread Matthew Wilcox
On Tue, Nov 20, 2018 at 10:18:29AM +0100, Pavel Machek wrote: > > would ever rely on the pid being reused while having the descriptor > > open. How would that make sense? > > I agree this is corner space, but users might be surprised that > keeping FDs of /proc/pid/X would lead to PID space exhaus

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-20 Thread Pavel Machek
On Tue 2018-11-20 09:49:50, Jonathan Corbet wrote: > On Tue, 20 Nov 2018 10:05:21 +0100 > Vlastimil Babka wrote: > > > Why can't the documentation describe the current implementation, and > > change in the future if the implementation changes? I doubt somebody > > would ever rely on the pid being

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-20 Thread Jonathan Corbet
On Tue, 20 Nov 2018 10:05:21 +0100 Vlastimil Babka wrote: > Why can't the documentation describe the current implementation, and > change in the future if the implementation changes? I doubt somebody > would ever rely on the pid being reused while having the descriptor > open. How would that make

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-20 Thread Joel Fernandes
On Tue, Nov 20, 2018 at 1:05 AM Vlastimil Babka wrote: > > On 11/19/18 11:54 AM, Pavel Machek wrote: > > On Mon 2018-11-05 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,

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-20 Thread Pavel Machek
On Tue 2018-11-20 10:05:21, Vlastimil Babka wrote: > On 11/19/18 11:54 AM, Pavel Machek wrote: > > On Mon 2018-11-05 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

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-20 Thread Vlastimil Babka
On 11/19/18 11:54 AM, Pavel Machek wrote: > On Mon 2018-11-05 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

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-20 Thread Pavel Machek
On Mon 2018-11-19 08:24:02, Daniel Colascione wrote: > On Mon, Nov 19, 2018 at 2:54 AM, Pavel Machek wrote: > > On Mon 2018-11-05 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

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-19 Thread Daniel Colascione
On Mon, Nov 19, 2018 at 2:54 AM, Pavel Machek wrote: > On Mon 2018-11-05 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-

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-19 Thread Aleksa Sarai
On 2018-11-07, Daniel Colascione wrote: > On Wed, Nov 7, 2018 at 4:00 PM, Michal Hocko wrote: > > On Wed 07-11-18 15:48:20, Daniel Colascione wrote: > >> On Tue, Nov 6, 2018 at 1:05 PM, Michal Hocko wrote: > >> > otherwise anybody could simply DoS the system > >> > by consuming all available pid

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-19 Thread Pavel Machek
On Mon 2018-11-05 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 name

RE: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-08 Thread David Laight
From: Matthew Wilcox > Sent: 08 November 2018 14:07 ... > > You'd be looking for something like dynamic perfect hashing then? > I think that'd make a great project for someone to try out. I don't > have the time to look into it myself, and I'm not convinced there's > a real workload that would be

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-08 Thread Matthew Wilcox
On Thu, Nov 08, 2018 at 01:42:41PM +, David Laight wrote: > From: Matthew Wilcox > > On Thu, Nov 08, 2018 at 12:02:49PM +, David Laight wrote: > > > This can be mitigated by only allocating 'big' numbers on systems > > > that have a lot of pids. > > > You also really want an O(1) allocator.

RE: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-08 Thread David Laight
From: Matthew Wilcox > Sent: 08 November 2018 12:28 > > On Thu, Nov 08, 2018 at 12:02:49PM +, David Laight wrote: > > From: Martin Steigerwald > > > Sent: 07 November 2018 17:05 > > ... > > > Its not quite on-topic, but I am curious now: AFAIK PID limit is 16 > > > bits. Right? Could it be rais

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-08 Thread Michal Hocko
On Wed 07-11-18 18:04:59, Martin Steigerwald wrote: > Michal Hocko - 07.11.18, 17:00: > > > > 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 sta

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-08 Thread Matthew Wilcox
On Thu, Nov 08, 2018 at 12:02:49PM +, David Laight wrote: > From: Martin Steigerwald > > Sent: 07 November 2018 17:05 > ... > > Its not quite on-topic, but I am curious now: AFAIK PID limit is 16 > > bits. Right? Could it be raised to 32 bits? I bet it would be a major > > change throughout dif

RE: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-08 Thread David Laight
From: Martin Steigerwald > Sent: 07 November 2018 17:05 ... > Its not quite on-topic, but I am curious now: AFAIK PID limit is 16 > bits. Right? Could it be raised to 32 bits? I bet it would be a major > change throughout different parts of the kernel. It is probably 15 bits (since -ve pid numbers

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-07 Thread Daniel Colascione
On Wed, Nov 7, 2018 at 9:16 AM, Matthew Wilcox wrote: > On Tue, Nov 06, 2018 at 08:01:13AM +0200, Mike Rapoport wrote: >> > diff --git a/Documentation/filesystems/proc.txt >> > b/Documentation/filesystems/proc.txt >> > index 12a5e6e693b6..0b14460f721d 100644 >> > --- a/Documentation/filesystems/p

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-07 Thread Matthew Wilcox
On Tue, Nov 06, 2018 at 08:01:13AM +0200, Mike Rapoport wrote: > > diff --git a/Documentation/filesystems/proc.txt > > b/Documentation/filesystems/proc.txt > > index 12a5e6e693b6..0b14460f721d 100644 > > --- a/Documentation/filesystems/proc.txt > > +++ b/Documentation/filesystems/proc.txt > > @@ -

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-07 Thread Martin Steigerwald
Michal Hocko - 07.11.18, 17:00: > > > 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_NPR

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-07 Thread Michal Hocko
On Wed 07-11-18 16:10:01, Daniel Colascione wrote: > On Wed, Nov 7, 2018 at 4:00 PM, Michal Hocko wrote: [...] > > If you really do care about pid space depletion then you > > should use pid cgroup controller. > > Or that, sure. But since cgroups are optional, the problem with the > core model re

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-07 Thread Daniel Colascione
On Wed, Nov 7, 2018 at 4:00 PM, Michal Hocko wrote: > On Wed 07-11-18 15:48:20, Daniel Colascione wrote: >> On Tue, Nov 6, 2018 at 1:05 PM, Michal Hocko wrote: >> > otherwise anybody could simply DoS the system >> > by consuming all available pids. >> >> People can do that today using the instrum

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-07 Thread Michal Hocko
On Wed 07-11-18 15:48:20, Daniel Colascione wrote: > On Tue, Nov 6, 2018 at 1:05 PM, Michal Hocko 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 reus

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-07 Thread Daniel Colascione
On Tue, Nov 6, 2018 at 1:05 PM, Michal Hocko 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-dea

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-06 Thread Michal Hocko
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

Re: [PATCH v2] Document /proc/pid PID reuse behavior

2018-11-05 Thread Mike Rapoport
On Mon, Nov 05, 2018 at 01:22:05PM +, 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 happ