Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp1161990ybs; Mon, 25 May 2020 08:35:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhdehUT+RwalJGwBVXA6ndfPcXmszkbP93qaI2XqxyNE9vBTnv7OlD4DoY4Z5MMHdmCl6J X-Received: by 2002:a17:906:a856:: with SMTP id dx22mr18942767ejb.255.1590420940671; Mon, 25 May 2020 08:35:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590420940; cv=none; d=google.com; s=arc-20160816; b=gW6QY2XDavgx9StS0h2cfHjCbTgnIYCzRtWiK/C/uXy2d2ZyotGUgbMpsnAMsILPI2 58pjuKjRWJ0OyCKBdHxa3FiAdR4qeUPs8BT62abIMOQ9RKH/sPlh/oHmmqTgoXc0iBiA +TRUdic3e4UEQG+R+J6snanOB11eewTptMAAswPTOxBUSCifA9LG8ADOizYIdosudqrr 8VQpPPPXJ+HJ+lbS6Y68oUNDMzOC6i2iKzv9TY90S4O9ywn+t30SmC7tTVVvaBa5jjyB NCsPMIO1sH5svhQyd1T1YXJFOzj6W+3Wx/ZollZRvXh9w1vWA3mY/i+e81Nf1IbsRchu eLsg== 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 :dkim-signature; bh=KJaDHPPz3lTydc/Mf8t2Wq2qJfQbT/hZX56yF4I1VI0=; b=Yy8DHKBgQqgDU/NU94vr9+lLhKyKrawHMFPRXUZOPn3IJGb7wnrSczSvE5J1XJNBQg A3LIy5BaerhU74Sx1A0qB7QFY+i4y3WTzCyfkq13deFV8xpRZtHIjEOggos0ud+MG2UO Nhfiz7lVOfibTxVoABw3eow/DzB3i8QZMBaaxY6k9cysTGAZmWqOg8pdS9MqEiRHjRo7 yAWdmgexnydy0B1SqvkxWP4u9TMuVRZvArPUSR/UCltXWsWNTER4DAMox3Q8bWrJ5J6j 17FEaCslTROiK77n6ogmm8l0xbiUn5csXgY0+ZViynAt2qHMrj43OMrCyiyrt7/GTc5M B7yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="p4+E/Hse"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn20si14341572ejc.319.2020.05.25.08.35.17; Mon, 25 May 2020 08:35:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="p4+E/Hse"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404167AbgEYPdS (ORCPT + 99 others); Mon, 25 May 2020 11:33:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404092AbgEYPdS (ORCPT ); Mon, 25 May 2020 11:33:18 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34B72C061A0E for ; Mon, 25 May 2020 08:33:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=KJaDHPPz3lTydc/Mf8t2Wq2qJfQbT/hZX56yF4I1VI0=; b=p4+E/Hse0321y64/36UuJ2Qfs6 Gul+xxNp5aJduaZ1PfZNM7gTIZ0t0rr3gwpCZsfrh0ytNiwMA75G5TDk+cIJY9tNoNeXGQtJFFMup knIA8v1zC3tUEqafZQmNbpSMuACX2Sq6rw8krU5ByzLLwQGK+a+fH8dmZFGaVYRYKUscUAnJ3Kagl u7wXK0Lp6ZVPmsbOINIzof+ztfnlI7CcYNS3giFYq6YuRQUxaZGb2Y4vTbg7im8KArXPdi0yZWet7 VMBZ+G5jWafwo1yJ5UkkeK+3LCe5hknIglHaw8y2vW9zN+w6q2Hgz0+TXUL14LHt1dLkaoS4sUHXU C5Zt8M9g==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdF6J-0000se-SQ; Mon, 25 May 2020 15:33:15 +0000 Date: Mon, 25 May 2020 08:33:15 -0700 From: Matthew Wilcox To: Konstantin Khlebnikov Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Vlastimil Babka , "Kirill A. Shutemov" Subject: Re: [PATCH] mm: dump_page: add debugfs file for dumping page state by pfn Message-ID: <20200525153315.GC17206@bombadil.infradead.org> References: <159041635119.987025.7321864888027213705.stgit@buzz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <159041635119.987025.7321864888027213705.stgit@buzz> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 25, 2020 at 05:19:11PM +0300, Konstantin Khlebnikov wrote: > Tool 'page-types' could list pages mapped by process or file cache pages, > but it shows only limited amount of state exported via procfs. > > Let's employ existing helper dump_page() to reach remaining information: > writing pfn into /sys/kernel/debug/dump_page dumps state into kernel log. > > # echo 0x37c43c > /sys/kernel/debug/dump_page > # dmesg | tail -6 > page:ffffcb0b0df10f00 refcount:1 mapcount:0 mapping:000000007755d3d9 index:0x30 > 0xffffffffae4239e0 name:"libGeoIP.so.1.6.9" > flags: 0x200000000020014(uptodate|lru|mappedtodisk) > raw: 0200000000020014 ffffcb0b187fd288 ffffcb0b189e6248 ffff9528a04afe10 > raw: 0000000000000030 0000000000000000 00000001ffffffff 0000000000000000 > page dumped because: debugfs request This makes me deeply uncomfortable. We're using %px, and %lx (for the 'raw' lines) so we actually get to see kernel addresses. We've rationalised this in the past as being acceptable because you're already in an "assert triggered" kind of situation. Now you're adding a way for any process with CAP_SYS_ADMIN to get kernel addresses dumped into the syslog. I think we need a different function for this, or we need to re-audit dump_page() for exposing kernel pointers, and not expose the raw data in struct page.