Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4048492imm; Mon, 14 May 2018 01:38:18 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrsckkrVUB3zih7VIavRZ5Aeio6MBsBHV7Eee/uyvg6S38vBs9DiIJqoPmdw6laDMVZYGxp X-Received: by 2002:a17:902:1004:: with SMTP id b4-v6mr7412620pla.82.1526287098144; Mon, 14 May 2018 01:38:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526287098; cv=none; d=google.com; s=arc-20160816; b=WL2wuT5Uxv3mlEgKoPyyqAgtmvBj9kHJ6Z3ai9FKzkpLnRKHdaGWxZwjlKGZWqcd+E ZkYAA8hdf0RYIZbcjM17cbAhakit6JSVzwBDyDMhDV1MXfdMPvyKdeWLJjGcEwc1ATG6 CotQ1Y/eX97YQtt3dan2K1Xr/FGVLgKbLrMutTNjJUdguaCwlLvFPdoHPtJFTfG7Ibjx ocQxk4KcKPMZUDNlETevS8Pn4lqwPW/SLEKIgJkqaw8UszLnBVZ52pP6cUYgb4u8yXpv RtqPCNRa68kiIbQAULSdk2kmEanmIRqcUCRHmJIEftB+qmme1drNhgWzfV2pNvvx2TQS pagA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=2jb06O9FfEt505PkFYLUO8GIukZYnlBLSx9PT4SmZMs=; b=uRfMMLMhXpAirwIwBs7LjVLxWM0y9R6z0C1HWsC1YOM1mF0SygTEeXRbvV92fi/TKI FMfxdaPjeTn3CBgVmwcwMsij2G/0QDrR2vLnBar6MxVq6ytt2wehAtc9/0Fkwwg+lgTR xjRDkfWbCVwMx7CQEePtOIOWIrTzztG2y0ii8ky5roQt04+KvlBjOlBOsHa6+ATyKwuU 3HIg15igLBqxslGwhlwIEHm8BdcyHeLrIFihmBaEMKJTqHgdjTremIeLS11rAsmaP8hh pDAIRIWOcuzINbiuF1MdqXqzcPQPIHp5ITadNyYyMZ3M4xuzcT3MVTsKFJBCurHrLqPF 1JWg== 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 4-v6si7227624pga.13.2018.05.14.01.38.03; Mon, 14 May 2018 01:38:18 -0700 (PDT) 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752534AbeENIhb (ORCPT + 99 others); Mon, 14 May 2018 04:37:31 -0400 Received: from monster.unsafe.ru ([5.9.28.80]:37448 "EHLO mail.unsafe.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752155AbeENIhZ (ORCPT ); Mon, 14 May 2018 04:37:25 -0400 Received: from comp-core-i7-2640m-0182e6 (nat-pool-brq-t.redhat.com [213.175.37.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.unsafe.ru (Postfix) with ESMTPSA id 10533C6180C; Mon, 14 May 2018 08:36:59 +0000 (UTC) Date: Mon, 14 May 2018 10:29:08 +0200 From: Alexey Gladkov 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. Bruce Fields" , Stephen Rothwell , Solar Designer , "Dmitry V. Levin" , Djalal Harouni Subject: Re: [PATCH v5 5/7] proc: instantiate only pids that we can ptrace on 'limit_pids=1' mount option 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 Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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