[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181031150625.147369-1-dancol@google.com>
Date: Wed, 31 Oct 2018 15:06:22 +0000
From: Daniel Colascione <dancol@...gle.com>
To: linux-kernel@...r.kernel.org
Cc: timmurray@...gle.com, joelaf@...gle.com, surenb@...gle.com,
Daniel Colascione <dancol@...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>,
"Dennis Zhou (Facebook)" <dennisszhou@...il.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Prashant Dhamdhere <pdhamdhe@...hat.com>,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>
Subject: [PATCH] Document /proc/pid PID reuse behavior
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.
---
Documentation/filesystems/proc.txt | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index 12a5e6e693b6..567f66a8a23c 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -214,6 +214,14 @@ asynchronous manner and the value may not be very precise. To see a precise
snapshot of a moment, you can see /proc/<pid>/smaps file and scan page table.
It's slow but very precise.
+Note that an open a file descriptor to /proc/<pid> or to any of its
+contained files or subdirectories does not prevent <pid> being reused
+for some other process in the event that <pid> exits. Operations on
+open /proc/<pid> file descriptors corresponding to dead processes
+never act on any new process that the kernel may, through chance, have
+also assigned the process ID <pid>. Instead, operations on these FDs
+usually fail with ESRCH.
+
Table 1-2: Contents of the status files (as of 4.8)
..............................................................................
Field Content
--
2.19.1.568.g152ad8e336-goog
Powered by blists - more mailing lists