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 51C37D6C29A for ; Tue, 19 Nov 2024 20:57:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D43E26B008C; Tue, 19 Nov 2024 15:57:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CF3E06B0092; Tue, 19 Nov 2024 15:57:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BBCAB6B0093; Tue, 19 Nov 2024 15:57:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 9D0CD6B008C for ; Tue, 19 Nov 2024 15:57:39 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5724C16053E for ; Tue, 19 Nov 2024 20:57:39 +0000 (UTC) X-FDA: 82804054284.30.E011628 Received: from out-184.mta1.migadu.com (out-184.mta1.migadu.com [95.215.58.184]) by imf07.hostedemail.com (Postfix) with ESMTP id 6566240015 for ; Tue, 19 Nov 2024 20:56:26 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=qdEVRNRv; spf=pass (imf07.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.184 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732049676; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ikYo5Qt2GJ/06mlBFEkzK0zdCcALXlrhVesJOzP8WU4=; b=Bhqt3L+zvYt+o9vo1fNy4kIRVG+bPuXDu16FVDURuJ1nq29jyZdOAzLE7WTk7lTikDUV50 oq7LgcNcx6UsX0xfjGbquMKQDnwU/O6fjhSdjtNXroJFrzGOsiQXRRZnrJDJ/TZJBhsaVY HtT1a5bOADtRfAcGSL0QzaOON5H20QM= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=qdEVRNRv; spf=pass (imf07.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.184 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732049676; a=rsa-sha256; cv=none; b=j74Mco1GOMN5Am3r+yApenruwWfMxNDdx3EA9UznoQiZssQzcgj5S6TW9kY+8vASuoUNkO szRIsmWrouZ3TeFMfoEaqeJKq+ZG6mHvhI/WNthP2nDKbtguCufYC85H6xJc554Y+Vinzg jySFkJFluRIPpM8SJYAETIU0ddPE+N4= Date: Tue, 19 Nov 2024 20:57:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1732049854; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ikYo5Qt2GJ/06mlBFEkzK0zdCcALXlrhVesJOzP8WU4=; b=qdEVRNRv9idMTgDOAQ5Z/L2XYwEhLjKQGmW+uWLHP5ziZ0RiuL3Vqa4qe+OAFPmuaGFudb lZASQb0wSRq/4frvukWqXPhGaNXBkFVkCp0eIk33Sb9I3Q4h8zAwu6lTWoVdJN95op0crD n9atx3wtYFhsMc+4RIfipRwTUL/dJhY= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Yosry Ahmed Cc: Pasha Tatashin , Greg KH , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org, akpm@linux-foundation.org, corbet@lwn.net, derek.kiernan@amd.com, dragan.cvetic@amd.com, arnd@arndb.de, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, tj@kernel.org, hannes@cmpxchg.org, mhocko@kernel.org, shakeel.butt@linux.dev, muchun.song@linux.dev, Liam.Howlett@oracle.com, lorenzo.stoakes@oracle.com, vbabka@suse.cz, jannh@google.com, shuah@kernel.org, vegard.nossum@oracle.com, vattunuru@marvell.com, schalla@marvell.com, david@redhat.com, willy@infradead.org, osalvador@suse.de, usama.anjum@collabora.com, andrii@kernel.org, ryan.roberts@arm.com, peterx@redhat.com, oleg@redhat.com, tandersen@netflix.com, rientjes@google.com, gthelen@google.com Subject: Re: [RFCv1 0/6] Page Detective Message-ID: References: <20241116175922.3265872-1-pasha.tatashin@soleen.com> <2024111938-anointer-kooky-d4f9@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 6566240015 X-Stat-Signature: 7mzgmptwuo7bh8ackw19h6xemmcebeub X-Rspam-User: X-HE-Tag: 1732049786-335464 X-HE-Meta: U2FsdGVkX19gDKNum4+mruMHupJafx4Z0j0sEJSXBqxgSvanqjrVVVE0rtm0TqdH6oHlnSlyYAB26Vfbf8fUyTGZnJNNcFX6zJQSUdzrZoxR7aGVauXdFvMOFIL7LjCz+R/WFb3a/S52Za7/PA5uY5+jxz1tju/Tu+a6Gqhlpte/43tG8Nwrv7Ie+HSpzRtciO/dgzD2mfVjD/rKqHm0gsJH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wiYBqB8IAYP/EMkiMsxBZ93oEyE9bFBRHpSjQXOMYAcinydz1KwQVSENlkuqyIw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, Nov 19, 2024 at 11:35:47AM -0800, Yosry Ahmed wrote: > On Tue, Nov 19, 2024 at 11:30 AM Pasha Tatashin > wrote: > > > > On Tue, Nov 19, 2024 at 1:23 PM Roman Gushchin wrote: > > > > > > On Tue, Nov 19, 2024 at 10:08:36AM -0500, Pasha Tatashin wrote: > > > > On Mon, Nov 18, 2024 at 8:09 PM Greg KH wrote: > > > > > > > > > > On Mon, Nov 18, 2024 at 05:08:42PM -0500, Pasha Tatashin wrote: > > > > > > Additionally, using crash/drgn is not feasible for us at this time, it > > > > > > requires keeping external tools on our hosts, also it requires > > > > > > approval and a security review for each script before deployment in > > > > > > our fleet. > > > > > > > > > > So it's ok to add a totally insecure kernel feature to your fleet > > > > > instead? You might want to reconsider that policy decision :) > > > > > > > > Hi Greg, > > > > > > > > While some risk is inherent, we believe the potential for abuse here > > > > is limited, especially given the existing CAP_SYS_ADMIN requirement. > > > > But, even with root access compromised, this tool presents a smaller > > > > attack surface than alternatives like crash/drgn. It exposes less > > > > sensitive information, unlike crash/drgn, which could potentially > > > > allow reading all of kernel memory. > > > > > > The problem here is with using dmesg for output. No security-sensitive > > > information should go there. Even exposing raw kernel pointers is not > > > considered safe. > > > > I am OK in writing the output to a debugfs file in the next version, > > the only concern I have is that implies that dump_page() would need to > > be basically duplicated, as it now outputs everything via printk's. > > Perhaps you can refactor the code in dump_page() to use a seq_buf, > then have dump_page() printk that seq_buf using seq_buf_do_printk(), > and have page detective output that seq_buf to the debugfs file? > > We do something very similar with memory_stat_format(). We use the > same function to generate the memcg stats in a seq_buf, then we use > that seq_buf to output the stats to memory.stat as well as the OOM > log. +1 Thanks!