Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1828040imu; Tue, 6 Nov 2018 05:06:51 -0800 (PST) X-Google-Smtp-Source: AJdET5ejxLlfCBOD9UMesIlEazK2s07kbQzjlAtsRdJKw8Ngo/Em0ow+mfDNm1o87bwPzits61Yf X-Received: by 2002:a63:c24c:: with SMTP id l12mr23740415pgg.146.1541509611676; Tue, 06 Nov 2018 05:06:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541509611; cv=none; d=google.com; s=arc-20160816; b=eki4PxUf9PzYZasSEg4ktqZcRDZAbwTBnyVawEybMdZ62Nle4uOqqbhs89jBI0QcbI H+dfbGhoIcre4/jFmgv4Q4P8roQ+QU5YcaqzSJdaU+57YApFMnWkhnmY12rV4a728LNo AE7DZz0RoKlsPhYpv9idWR9lTnEt/aFKnVHrqmRv3oGkacvbS4W5wEbbrEV3KnwGUrWs HxqnGy1K1PAsmToeIhnXgsT9XIsjUY2e8Sn3ie0UFbOVhhpFjrcfONOReTMWsQRKRWjD ql4moVVmGH9wA0zIiHpDom0lstmxfh7mn88UaLzTJ0mSeZ3BMF+HFtmcxje+6TBMGqXm 5MoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=1IgmyH4PRX+ONbIwUezoAafuBbi8+uWfDFbP+pTPVxs=; b=MMP3rJk3NGMh4BZkGq+EpaFlWjQzAl0dYRoxZI/rGztgP5EiF796PEJQlauKdxf6Yw n+L/IV+yreSVBWhbfEo0vnc/cVMr2d+udjXjmvoieD3R+Xyx0GLnjfbCpe9g5A/lTSdT oOFFT1JRhg8VXt2/7HXvcnFfk/spPe9Zp1Vl+47/AcLgLXryZBwOfFLyBVUM63aje0XD lExl5732uOAoMBOx0Gv5kLktgicxcyaux+uHkvnApnrJbscJpcKZDhYQqnW0+SwY6/9C F2e1JTfwleTISUajRokRspqkf7X6tpowZ0Z7/HVYp0hpIRSkdXIQYUa/KyxMh+l5oth/ QB2Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 61-v6si48655062plf.345.2018.11.06.05.06.26; Tue, 06 Nov 2018 05:06:51 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730477AbeKFWae (ORCPT + 99 others); Tue, 6 Nov 2018 17:30:34 -0500 Received: from mx2.suse.de ([195.135.220.15]:52304 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729272AbeKFWae (ORCPT ); Tue, 6 Nov 2018 17:30:34 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 5D181ACC1; Tue, 6 Nov 2018 13:05:25 +0000 (UTC) Date: Tue, 6 Nov 2018 14:05:24 +0100 From: Michal Hocko To: Daniel Colascione Cc: linux-kernel@vger.kernel.org, rppt@linux.ibm.com, timmurray@google.com, joelaf@google.com, surenb@google.com, Jonathan Corbet , Andrew Morton , Roman Gushchin , Mike Rapoport , Vlastimil Babka , "Kirill A. Shutemov" , "Dennis Zhou (Facebook)" , Prashant Dhamdhere , "open list:DOCUMENTATION" Subject: Re: [PATCH v2] Document /proc/pid PID reuse behavior Message-ID: <20181106130524.GC2453@dhcp22.suse.cz> References: <20181031150625.147369-1-dancol@google.com> <20181105132205.138695-1-dancol@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181105132205.138695-1-dancol@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 otherwise anybody could simply DoS the system by consuming all available pids. But I do not see any strong reason against having that stated explicitly. > Signed-off-by: Daniel Colascione Acked-by: Michal Hocko > --- > 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 -- Michal Hocko SUSE Labs