Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp558677imu; Mon, 5 Nov 2018 05:25:16 -0800 (PST) X-Google-Smtp-Source: AJdET5cW2JEr/Zj0R/2kwKuJSfwfmgrQ7GFQOkpoRw6ZyondEVCZU9NQx8YI+5swfCtlL8O2si72 X-Received: by 2002:a17:902:8ec2:: with SMTP id x2-v6mr22240947plo.157.1541424316867; Mon, 05 Nov 2018 05:25:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541424316; cv=none; d=google.com; s=arc-20160816; b=s8A76FaIy/k0edMlTFbS36qQY3cM0DdLkZR5Mhr58CDG3Z3d+C02FKEoTC/CeOYa7a HbRqy777slaVQ36hE4yNl91w4Rvr6XFVaJOhmM8wiy42pK/35J/OLyeQIWApfed7D25y +kwBKa1rS8mvyefjExUIdxo6PHyxU57RYfylI07C0XXsVOuj0xwQx5f1ViXp8xhJghDo lJAztzG7R12T1JSD+y2PMaLCTzI/0lmlRTJlhbyfvEJuemlhmpwTzSN6q4P3N2laq9DM 1KOzSy0J7/wquk1sgTxQw5TO9Mc8q+BT5uiuibvYZN7x5hPGUAyyUmpvM0y6LGNJBzh4 lIZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=qyG6RYi1emRCFoDSrD4q/5RjzFPWwqnJtaEW3lGdNsE=; b=FUFp96GoFiywPEyvTGPDxAJAlqN8HcQuwahdrbhsPzxqoa3WrjoHto9335LEWxD6/e JL8MsTbuggcue9IhAvnRhk/kQv9DAxCZlPgp41bbqbGH8Y/Hv785Yb9kfhbXDrmpsWQz JyFoi1k80X8ghPMHp+FJ9agWKC8fkjH6kSpH3saXBJfF8fmmJ/9jB6XQXackuTYLwB4h ZC6KZAEruMKrLBEQUURI1dJXxZtbATXn4KDdoRPxnuKT45Pb4yJtOHGyWKADGfaiw5fG Rx8Vn1fodDrjk/frhoJGm6eEsiAwSL/yLR8PlREAPpPGn9O0Zu62fulTHRwWncL+B1hg z99w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=abyAlB6c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h69si28443149pge.121.2018.11.05.05.25.01; Mon, 05 Nov 2018 05:25:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=abyAlB6c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729957AbeKEWm0 (ORCPT + 99 others); Mon, 5 Nov 2018 17:42:26 -0500 Received: from mail-pg1-f201.google.com ([209.85.215.201]:49187 "EHLO mail-pg1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728094AbeKEWmZ (ORCPT ); Mon, 5 Nov 2018 17:42:25 -0500 Received: by mail-pg1-f201.google.com with SMTP id m21-v6so8434764pgl.16 for ; Mon, 05 Nov 2018 05:22:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=qyG6RYi1emRCFoDSrD4q/5RjzFPWwqnJtaEW3lGdNsE=; b=abyAlB6c4bpgQTwEdCaE9mURdL2mYzyZKfZw/4xccG5X3cTmgZo74XL7t3rUgC8H41 +Y2YZbjYConfAyVAOYCi3rG1hwNRAmQpCQ7xSCUKP3PAUv5dzuRIPOn37307UP2zZFxm iz2zCkemuSvMgIuy2hWQd7fKCFOAiJCUvzlHHqCwB3A/dszwgN+HFYtJ5nXV/pIObKKn gwGYZWFwLwuX8J2bPbZOyPURIA8m6e12PR2ZT0r1a2+peIvbs7Thx2iLUhMIHTrfenOZ wvh8e/5u2gW8uhSRKLzYoo+z2xU9GEWXbfb7FsmJkwJatS0shzQ7hOVgQHsLUp79sgAS uXzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=qyG6RYi1emRCFoDSrD4q/5RjzFPWwqnJtaEW3lGdNsE=; b=d4ifDzGpiPK0eW/wErYFP6YPVWv2q834YeYUkiGagiIzs9wjNYU+IDqijmqWB/hfkF NVorThIOdQ8kBbkJANCTgQ7gN0ckrGr/KfjJ7tqQ+ykIy65xpoZW/lImixBwSVhCvzo2 EeF0e6PnY9qjuequAt7gxPfn7pVHUBikff3NRqcTu1mB96niBQsJVt+yf5Rwi6o+3+iq I9WzCCv1KYjE1UqMfDVR1bdSEHDhppgxI4io2Pi/jiK1wg05p7O5j+cXVWU7sHaV6Mgp y1efUExy2O1VbdBtz1+6vErehScRpKvvr5u17ZeShRcOtJzJgnFIjDDeZ9b49q8Lueup aqMA== X-Gm-Message-State: AGRZ1gJfpseflA/KNRfZAusBDv/chokMr922KjibMdIcGLJBk/yuZarL YauSK9vfl+x6vzXFQOg2OFXvEILPKaximoY8fmvKyifMVxF+MwXu70dWGcOqz4JG2Yz46neu5jo juJfyb2QhdUxEvRyjwXcOZ+VT0HpwIUf3euiz9Ps/qs2uwKUNmp3/D7cSdLy/YKhKTxtLBQ== X-Received: by 2002:a17:902:7245:: with SMTP id c5-v6mr752690pll.4.1541424160960; Mon, 05 Nov 2018 05:22:40 -0800 (PST) Date: Mon, 5 Nov 2018 13:22:05 +0000 In-Reply-To: <20181031150625.147369-1-dancol@google.com> Message-Id: <20181105132205.138695-1-dancol@google.com> Mime-Version: 1.0 References: <20181031150625.147369-1-dancol@google.com> X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog Subject: [PATCH v2] Document /proc/pid PID reuse behavior From: Daniel Colascione To: linux-kernel@vger.kernel.org, rppt@linux.ibm.com Cc: timmurray@google.com, joelaf@google.com, surenb@google.com, Daniel Colascione , Jonathan Corbet , Andrew Morton , Roman Gushchin , Mike Rapoport , Vlastimil Babka , "Kirill A. Shutemov" , "Dennis Zhou (Facebook)" , Prashant Dhamdhere , "open list:DOCUMENTATION" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Daniel Colascione --- Documentation/filesystems/proc.txt | 7 +++++++ 1 file changed, 7 insertions(+) Moved paragraphed to start of /proc/pid section; added signed-off-by. 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 @@ -125,6 +125,13 @@ process running on the system, which is named after the process ID (PID). The link self points to the process reading the file system. Each process subdirectory has the entries listed in Table 1-1. +Note that an open a file descriptor to /proc/ or to any of its +contained files or subdirectories does not prevent being reused +for some other process in the event that exits. Operations on +open /proc/ file descriptors corresponding to dead processes +never act on any new process that the kernel may, through chance, have +also assigned the process ID . Instead, operations on these FDs +usually fail with ESRCH. Table 1-1: Process specific entries in /proc .............................................................................. -- 2.19.1.930.g4563a0d9d0-goog