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 5B997C433EF for ; Tue, 19 Jul 2022 23:22:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C8ADA6B0072; Tue, 19 Jul 2022 19:22:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C3ACD6B0073; Tue, 19 Jul 2022 19:22:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B03EB6B0074; Tue, 19 Jul 2022 19:22:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 9D18F6B0072 for ; Tue, 19 Jul 2022 19:22:16 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 662B58031B for ; Tue, 19 Jul 2022 23:22:16 +0000 (UTC) X-FDA: 79705425072.21.106EA8C Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by imf29.hostedemail.com (Postfix) with ESMTP id 6ABB612000A for ; Tue, 19 Jul 2022 23:22:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658272935; x=1689808935; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=DNYh3WvqLRfUXzaq47t9zdMeNxzavxqzs6FOlkMSOks=; b=dq4abrfzmzxJzDqKYK69TBJkx5F7hggD48+IBGox1B3Fv+PZvBCGwITR 5rObbNg/lTLezsdaXXBFAy8qmY9zO47y5Gahg2kNMDBhrUfKIycGxcK+q 4/U4JOJ0t/QKrMzJGnYW8tJPUaOJ2dQGcXyBe1fw/1Y/rIKd+vPxcQ+7E kpiqrsYgXfrXoLe4uw/AqV3YHTbk7z/75JX29aHrjW9vw98Hv7eXuZSML 5qs7oGjkGtT5SfnNgp0o0MDQaKMcri5WFUiYHqeI1exWRqgJneNCwBLdN Lrjd3XsUsbiREXkLyICclVRFQ9Etm1cQbDKDUFC+Ib5MxgQ9aPwUFaBLC w==; X-IronPort-AV: E=McAfee;i="6400,9594,10413"; a="269658521" X-IronPort-AV: E=Sophos;i="5.92,285,1650956400"; d="scan'208";a="269658521" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2022 16:22:13 -0700 X-IronPort-AV: E=Sophos;i="5.92,285,1650956400"; d="scan'208";a="687299824" Received: from twliston-mobl1.amr.corp.intel.com (HELO [10.212.132.190]) ([10.212.132.190]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2022 16:22:12 -0700 Message-ID: Date: Tue, 19 Jul 2022 16:22:12 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v2 1/1] mm: kfence: apply kmemleak_ignore_phys on early allocated pool Content-Language: en-US To: Andrew Morton , Marco Elver Cc: Geert Uytterhoeven , yee.lee@mediatek.com, Linux Kernel Mailing List , Catalin Marinas , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger , "open list:KFENCE" , "open list:MEMORY MANAGEMENT" , "moderated list:ARM/Mediatek SoC support" , "moderated list:ARM/Mediatek SoC support" , Dave Hansen References: <20220628113714.7792-1-yee.lee@mediatek.com> <20220628113714.7792-2-yee.lee@mediatek.com> <20220715163305.e70c8542d5e7d96c5fd87185@linux-foundation.org> <20220719161356.df8d7f6fc5414cc9cc7f8302@linux-foundation.org> From: Dave Hansen In-Reply-To: <20220719161356.df8d7f6fc5414cc9cc7f8302@linux-foundation.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658272936; a=rsa-sha256; cv=none; b=SyFyOESAdA0Td3Pv2yrL6tLMWMJtlQVQxlyBJjmqOkszujGq7I3u9hTUtHHx25qZtMuGbe oIFKjPqerE/UnD0RrDr6/ETG22lgzKySsfGjBnJHJAfvC3ioduVYn0pZHDNawqta9iu3v2 2Rr9rJW8nKrAC/rDMrDtJXVYXT5gKMw= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=dq4abrfz; spf=none (imf29.hostedemail.com: domain of dave.hansen@intel.com has no SPF policy when checking 134.134.136.126) smtp.mailfrom=dave.hansen@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658272936; 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=1eAIWeFmZQqOIaWa0qEnwmG7+gddq4/fVT/CRZt8reo=; b=fHomxE3ggJp1x6Bd/+TLEC5rdfEmoVx9aptJTTeD92Ft04PQtgbk+rm27vIcC3Iri7rxTn dBwgDPGexI6uhfD9ZFCg6cI9sACuV0mBdOTtZfcDu7M7eNTnF2ga+TLUaDh+SAciyAU9Vs rsfUExz7a33yC60uKHpVh9hVm/yU3Wk= X-Stat-Signature: jwruf8hnindnb11jexiyhxzie79mcu3d X-Rspamd-Queue-Id: 6ABB612000A Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=dq4abrfz; spf=none (imf29.hostedemail.com: domain of dave.hansen@intel.com has no SPF policy when checking 134.134.136.126) smtp.mailfrom=dave.hansen@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1658272935-316251 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 7/19/22 16:13, Andrew Morton wrote: > On Mon, 18 Jul 2022 16:26:25 +0200 Marco Elver wrote: > >> On Sat, 16 Jul 2022 at 20:43, Geert Uytterhoeven wrote: >> [...] >>>> - This patch has been accused of crashing the kernel: >>>> >>>> https://lkml.kernel.org/r/YsFeUHkrFTQ7T51Q@xsang-OptiPlex-9020 >>>> >>>> Do we think that report is bogus? >>> I think all of this is highly architecture-specific... >> The report can be reproduced on i386 with CONFIG_X86_PAE=y. But e.g. >> mm/memblock.c:memblock_free() is also guilty of using __pa() on >> previously memblock_alloc()'d addresses. Looking at the phys addr >> before memblock_alloc() does virt_to_phys(), the result of __pa() >> looks correct even on PAE, at least for the purpose of passing it on >> to kmemleak(). So I don't know what that BUG_ON(slow_virt_to_phys() != >> phys_addr) is supposed to tell us here. >> > It's only been nine years, so I'm sure Dave can remember why he added > it ;) > > BUG_ON(slow_virt_to_phys((void *)x) != phys_addr); > > in arch/x86/mm/physaddr.c:__phys_addr(). I think I intended it to double check that the linear map is *actually* a linear map for 'x'. Sure, we can use the "x - PAGE_OFFSET" shortcut, but did it turn out to be actually accurate for the address it was handed? I'd be curious what the page tables actually say for the address that's causing problems.