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 895CBC3DA7D for ; Tue, 3 Jan 2023 23:07:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC7308E0003; Tue, 3 Jan 2023 18:07:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D779B8E0001; Tue, 3 Jan 2023 18:07:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C3F2B8E0003; Tue, 3 Jan 2023 18:07:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id B5D448E0001 for ; Tue, 3 Jan 2023 18:07:16 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 91CF5140B73 for ; Tue, 3 Jan 2023 23:07:16 +0000 (UTC) X-FDA: 80315025672.12.4011D8B Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) by imf24.hostedemail.com (Postfix) with ESMTP id EBA5E180002 for ; Tue, 3 Jan 2023 23:07:14 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=ht5r4zvt; spf=pass (imf24.hostedemail.com: domain of rientjes@google.com designates 209.85.215.170 as permitted sender) smtp.mailfrom=rientjes@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1672787235; 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=Mo2bAklBVnxxMEbtvi+fTc+Cr0V9B4d6HxkhJ7AFP6c=; b=MWTU/jYOPZ7CHvaTkKA/M88mrHKErZmRiSRps42g22vYbUzqu8IdHriA3eog4X2Yzo6hpM Nddyacu5jlKvNKRWha3CQeihiJ966DX/mS8WJlHEHDxPreKwvgDhCeX3Rny++G2aup1Er4 2baAWQWgVkGEp/m6Yt3yEm96gMKkFkQ= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=ht5r4zvt; spf=pass (imf24.hostedemail.com: domain of rientjes@google.com designates 209.85.215.170 as permitted sender) smtp.mailfrom=rientjes@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672787235; a=rsa-sha256; cv=none; b=0nTcbp/5oGvL1kPccTurOwy58WOuH4pdkcMqoQA7tBkezz2ISkVYn0NvmXfMwevDE5C+jb 9dhU2IBYEyMci5ZX/R7B2yJGOqaDMt90qsklvvRQq0M9nJmTjzykPm7KuV/jRydvlTlvse bBZXndoTi3s7KLXniMM99b8og4dFq8U= Received: by mail-pg1-f170.google.com with SMTP id v3so21121942pgh.4 for ; Tue, 03 Jan 2023 15:07:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=Mo2bAklBVnxxMEbtvi+fTc+Cr0V9B4d6HxkhJ7AFP6c=; b=ht5r4zvtTo9RyXz5PRQmGCmisPXyFKqd+VHQN76nZsB2enR1ynk+f54Q051TEI1SC0 Hj5+4OLAyw+9SNow/KBRODFH+bSz8KBl4GGO1a6EtDNThDCAsSTG0to3pHajQ6jdcQT5 vNz3N7/NGk50fnjTeGlSl1U59W8Z68QUEgXhg9tzdKAO8oYMK+axXQ/TRRKDknaJUxiu +qKBCv3vH33ONzXzm3k6uskeCQ/tJ9092qUJVi6jpty0AcHmKFhSH1w3GSy1p+tV6pfW 43i+OIrNaThizYdMShNWY7CrCU/B6UVLbH/3Ob7cN+UBtPjRmKU2xSbYdxuYvJYFa483 tyBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Mo2bAklBVnxxMEbtvi+fTc+Cr0V9B4d6HxkhJ7AFP6c=; b=QPsz+vsO2fz8i4nqkxC6NEBhyzmpZeAQPiCFq54nuBd2tJfoUjZy3fHfD8rTmQxlh9 C7zFBPSUBkfsNN1QG3XvNHYAYMLwj/T3R88aZgGjCwEDhS8XmuzGcquoEyG902d3Ysmg ERr2NdCqnfmDc9YnNu0CnQYmXv14SPlc2h1HYOzZDZOXZBnClZZ1WCS0j6arcKdEbVKv je5UeziP2nsCh53lLAKoz9wcHaJKWjJcgHNc2tiTULb0Lo5DJMswbRLDMdWAlqxaC0cp mXKdVfoJK76JHLURV91zVLT4uVPy6tHYg6zNl9mWqf/NJWgQ9N3GLx0CY84o+o5B8gGh IVHQ== X-Gm-Message-State: AFqh2krhDx5chhRtGL+Xel+P32nphMDe7hVWiJk0c6P4X4U51L9mfWXo 4cr5YKstN+APV/hLsAAfN0U9Xg== X-Google-Smtp-Source: AMrXdXu/Qu2kVslkUyV/UgP0CyqT+iBW5uRGE1fQNTy6+lDLIUmXebapVA5L6EMfjziK+lmTFEcSbA== X-Received: by 2002:aa7:85c3:0:b0:582:13b5:d735 with SMTP id z3-20020aa785c3000000b0058213b5d735mr1068335pfn.0.1672787233686; Tue, 03 Jan 2023 15:07:13 -0800 (PST) Received: from [2620:15c:29:203:3ac1:84a4:2f59:c43f] ([2620:15c:29:203:3ac1:84a4:2f59:c43f]) by smtp.gmail.com with ESMTPSA id b20-20020aa79514000000b00581c4b4c15bsm10729867pfp.142.2023.01.03.15.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 15:07:13 -0800 (PST) Date: Tue, 3 Jan 2023 15:07:12 -0800 (PST) From: David Rientjes To: Matthew Wilcox cc: Vlastimil Babka , kernel test robot , Hyeonggon Yoo <42.hyeyoo@gmail.com>, oe-lkp@lists.linux.dev, lkp@intel.com, Mike Rapoport , Christoph Lameter , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: A better dump_page() In-Reply-To: Message-ID: References: <202212312021.bc1efe86-oliver.sang@intel.com> <41276905-b8a5-76ae-8a17-a8ec6558e988@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: EBA5E180002 X-Stat-Signature: g6teshxm1fopss1f6a8oume946jpor19 X-HE-Tag: 1672787234-545676 X-HE-Meta: U2FsdGVkX18jQV3/uBAxP++baVEKAKaVy76w43JNlcUTBQNJAsfWeAiOsNZ7IYfuyHm9juzOBONF/ZaefRf//Tl4e21SuMLndIxU/dqzuCPkf1ibc/bv4pryz6cAZkPHctREn3tQjAISPHYHSTottM0HWAnQVKkogRl973jnzpjqgcs/a0BAgUUwjZct7FZ7pMfWkSpdJrG7DeQRkS+kECeJ3gxkn2OTYgCZHll6HgsCNklGKJWjAMy3RPow5lw8XCje2fkMty6EjpHCOifwvAtPMoyqIqPdTZeablsqj4c5TBymeC2kfxe552y+PmHZchO/8f4n4fVjNcm9sie50U4oaU2NiuWJSnH7tLf3ojAwpKwZu4OCRQX4C7YwMwFawf8rKXc+klP9BI4eQdDTP3GSgZayjZo1HhEMIC44S6fHR37lmvfPeJsLYquT1so+qsxieun8TOi4AdZ04JyIJG7Hbc0cHEuKnx24AZO5P/kQanHiMnktitenugPlaNJzH1IQ2ql9CRrzd/7CnpMUmxxzyp9PHLD3cmQ+6Lj2jiY5ytlMqTRxa7R3mVPY3RqXJBDzYrMlO4awMsmURlp8ZzBu3asNBujSJLh6hV5WdBxYKh+yOAmyXXAa/unC/90j2RDCPwEKyyl1zRO6lb+AZMemcDs9Vy1di5TSAi4MWV/TLwpsdETJn/dViJKBNVM6JWj/w/mYPNzim/tLa5MPi/dwPk/DpxbL/JqFJBmesPMZDHe82Z96u4UO0ouq5Z+rks8JrU3L9uTUVyJfs4oOXog+/XMRTJ0qkDwz/pW7SSIlUXtxXyj/NrCXp8RBUC7wK1Dr3kPOzMxmJVULqPEJpdwO5wGEF4F0dHPdefnhAzuW44k2yW2vtBElC1QztvhshKPhGa6Js9pUefiT2MwwtjMEw05rBZUTvuwqUMcN61cGDhu3stw+G5iK6mNfFdShPu4k2tVU9brGwDDNi3D W1mqn6W9 85rslU7mMbacWKM1SMT2/tgBv9hrVJQsUnjlZo4ioWtHtK5LSO6j1USdBppJFZliSpvwkmWEaA8XTe125M0GM0mOQYryRMeDxuO0XEUlqxO7/U4FgYY1veBbOISWzrI2wInNUSidr5Vyia58Gr3ZebZp24CCtZqUqkw3cV+E1FFH0COKwDgTZK8uMiuIkS8y5deswKL56RzMkCEDnRWEnm1byrg== 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: On Tue, 3 Jan 2023, Matthew Wilcox wrote: > On Tue, Jan 03, 2023 at 11:42:11AM +0100, Vlastimil Babka wrote: > > Separately we should also make the __dump_page() more resilient. > > Right. It's not ideal when one of our best debugging tools obfuscates > the problem we're trying to debug. I've seen probems like this before, > and the problem is that somebody calls dump_page() on a page that they > don't own a refcount on. That lets the page mutate under us in some > fairly awkward ways (as you've seen here, it seems to be part of several > different compound allocations at various points during the dump > process). > > One possibility I thought about was taking our own refcount on the > page at the start of dump_page(). That would kill off the possibility > of ever passing in a const struct page, and it would confuse people. > Also, what if somebody passes in a pointer to something that's not a > struct page? Then we've (tried to) modify memory that's not a refcount. > > I think the best we can do is to snapshot the struct page and the folio > it appears to belong to at the start of dump_page(). It'll take a > little care (for example, folio_pfn() must be passed the original > folio, and not the snapshot), but I think it's doable. > By snapshot do you mean memcpy() of the metadata to the stack? I assume this still leaves the opportunity for the underlying mutation of the page but makes the window more narrow.