From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexey Gladkov Subject: Re: [PATCH v5 5/7] proc: instantiate only pids that we can ptrace on 'limit_pids=1' mount option Date: Mon, 14 May 2018 10:29:08 +0200 Message-ID: <20180514082908.GA28179@comp-core-i7-2640m-0182e6> References: <20180511093613.GA1330@comp-core-i7-2640m-0182e6> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Linus Torvalds Cc: Kees Cook , Andrew Lutomirski , Andrew Morton , linux-fsdevel , Linux Kernel Mailing List , Kernel Hardening , LSM List , Linux API , Greg Kroah-Hartman , Al Viro , Akinobu Mita , Oleg Nesterov , Jeff Layton , Ingo Molnar , Alexey Dobriyan , "Eric W. Biederman" , Daniel Micay , Jonathan Corbet , J. List-Id: linux-api@vger.kernel.org On Fri, May 11, 2018 at 09:45:33AM -0700, Linus Torvalds wrote: > On Fri, May 11, 2018 at 2:46 AM Alexey Gladkov > wrote: > > > + /* Limit procfs to only ptracable tasks */ > > + if (limit_pids == PROC_LIMIT_PIDS_PTRACE) { > > + cond_resched(); > > + if (!has_pid_permissions(fs_info, task, > HIDEPID_NO_ACCESS)) > > + goto out_put_task; > > + } > > Where did that "cond_resched()" come from? That doesn't seem to make a lot > of sense. This call came along with has_pid_permissions from proc_pid_readdir [1]. It seems to me that proc_pid_readdir and proc_pid_lookup should act in a similar way in this case. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3ba4bceef23206349d4130ddf140819b365de7c8 -- Rgrds, legion