From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F39A9C54EE9 for ; Tue, 13 Sep 2022 13:07:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 67C996B0071; Tue, 13 Sep 2022 09:07:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 62CB46B0072; Tue, 13 Sep 2022 09:07:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F4C46B0073; Tue, 13 Sep 2022 09:07:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 416216B0071 for ; Tue, 13 Sep 2022 09:07:25 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id ED83B160A26 for ; Tue, 13 Sep 2022 13:07:24 +0000 (UTC) X-FDA: 79907088408.20.F2551D6 Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by imf25.hostedemail.com (Postfix) with ESMTP id F2FB9A00C6 for ; Tue, 13 Sep 2022 13:07:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1663074444; x=1694610444; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=fjdWymekn3UIiOUWJEmNK3vReR/+Xpw8sXAn58G/p98=; b=fEHLP/B4nlv4hYVraw1oVzFGp9VaPeaku7+4QqwWJLZFc8WP5VNx3K/q FVLLddWROG9+2vJlsghpzKIBsisO1s1AIl+XIUsSugOJQm7sgDFiKbSu1 6l0ZLENG++fMq1RpTMftZ5h2CE8iJ5VlnaZryi3pTD0GaCJotCmg4jvLe tCesTnukHOUUe4OgxmLAtvwG6nt2zHlh0NISS7epi5np5Bap0xiAlNfRz 0ohKzFGIFSyxeZ3U/SW0JEsYKd/8y+8zVYRXsgK39YP6LgC2hsMRnjmOP uPSCojskj3nB+TJQb+ou9fOgElE9jMp9Xh0chOlffOWk2CnKl2Yxe4st4 A==; Date: Tue, 13 Sep 2022 15:07:20 +0200 From: Vincent Whitchurch To: Andrew Morton CC: kernel , "adobriyan@gmail.com" , "vbabka@suse.cz" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , Subject: Re: [PATCH] proc: Enable smaps_rollup without ptrace rights Message-ID: References: <20220908093919.843346-1-vincent.whitchurch@axis.com> <20220908145934.4565620db7cbc3b9ceb90e3b@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20220908145934.4565620db7cbc3b9ceb90e3b@linux-foundation.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663074444; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fjdWymekn3UIiOUWJEmNK3vReR/+Xpw8sXAn58G/p98=; b=26ir5nQfq3wp1/XYoPrGaCe7SRKcVA/SAbP5b0JH0LpvC0GedOwgD5NY09dHvKhvJi1REl Pmsl334STrJ0/PpF/2jro5lhe5R230uHmGWf+mZmfst76eQHiCCG+uIWjNSaVgeRGsjN6Q 7mCSGEXGTxgtHv/Db7RzsG+fMKdt14c= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=axis.com header.s=axis-central1 header.b="fEHLP/B4"; spf=pass (imf25.hostedemail.com: domain of Vincent.Whitchurch@axis.com designates 195.60.68.18 as permitted sender) smtp.mailfrom=Vincent.Whitchurch@axis.com; dmarc=pass (policy=none) header.from=axis.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663074444; a=rsa-sha256; cv=none; b=wUUg1rsrKeusnAW+HIB97j32DbXKZZ5UY7uz0S/pFkJwlDIN7Ih5aZa7pC52X2sv1W7hZz a4kHEJ6tSY+l8WyQ1NguZH0sfNEBdkTy+1J++L7pVruPI7+4lHsmI3TJ8ngfU32kjPBuwY ACYS/PGcL+f8xut/S3v5OAjeSOWUEB8= X-Stat-Signature: os5c8c576p875xqrghez5g3od91ke89d X-Rspamd-Queue-Id: F2FB9A00C6 Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=axis.com header.s=axis-central1 header.b="fEHLP/B4"; spf=pass (imf25.hostedemail.com: domain of Vincent.Whitchurch@axis.com designates 195.60.68.18 as permitted sender) smtp.mailfrom=Vincent.Whitchurch@axis.com; dmarc=pass (policy=none) header.from=axis.com X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1663074443-534494 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000336, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Sep 08, 2022 at 11:59:34PM +0200, Andrew Morton wrote: > On Thu, 8 Sep 2022 11:39:19 +0200 Vincent Whitchurch wrote: > > smaps_rollup is currently only allowed on processes which the user has > > ptrace permissions for, since it uses a common proc open function used > > by other files like mem and smaps. > > > > However, while smaps provides detailed, individual information about > > each memory map in the process (justifying its ptrace rights > > requirement), smaps_rollup only provides a summary of the memory usage, > > which is not unlike the information available from other places like the > > status and statm files, which do not need ptrace permissions. > > > > The first line of smaps_rollup could however be sensitive, since it > > exposes the randomized start and end of the process' address space. > > This information however does not seem essential to smap_rollup's > > purpose and could be replaced with placeholder values to preserve the > > format without leaking information. (I could not find any user space in > > Debian or Android which uses the information in the first line.) > > > > Replace the start with 0 and end with ~0 and allow smaps_rollup to be > > opened and read regardless of ptrace permissions. > > What is the motivation for this? Use case? End-user value and such? My use case is similar to Sergey's[0]: to be able to gather memory usage information from a daemon/script running without root permissions or ptrace rights. Values like Pss are only available from smaps_rollup, and not from the other files like status and statm which already provide memory usage information without requiring elevated privileges. [0] https://lore.kernel.org/lkml/20200929024018.GA529@jagdpanzerIV.localdomain/ smaps_rollup is however much more expensive than those other files, so I guess that could be an argument for treating it differently, even if the content itself does not need to be protected.