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 X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1199CC48BE6 for ; Wed, 16 Jun 2021 18:27:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8D514613EF for ; Wed, 16 Jun 2021 18:27:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8D514613EF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1F3016B0036; Wed, 16 Jun 2021 14:27:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CAF26B006C; Wed, 16 Jun 2021 14:27:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01D6A6B0070; Wed, 16 Jun 2021 14:27:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0182.hostedemail.com [216.40.44.182]) by kanga.kvack.org (Postfix) with ESMTP id C2A486B0036 for ; Wed, 16 Jun 2021 14:27:32 -0400 (EDT) Received: from smtpin33.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 68EFC181AEF00 for ; Wed, 16 Jun 2021 18:27:32 +0000 (UTC) X-FDA: 78260419944.33.511EA1B Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by imf22.hostedemail.com (Postfix) with ESMTP id 1EA59C00CBE4 for ; Wed, 16 Jun 2021 18:27:20 +0000 (UTC) Received: by mail-pg1-f179.google.com with SMTP id n12so2660600pgs.13 for ; Wed, 16 Jun 2021 11:27:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=bRtaAEoX3Wl0MO3YfnMNq5KlU2cGESsyfs3QuKUrWMQ=; b=CAoFIeiN+kNL5A5BZHLElpwpf4fB4PXibrFkfkDg8jZjg15B195hYji4FYq8ABOz5h fhMq9LN8zMSFD0XsprRhS/FWD2vwOdmBVW9O2ZCM68g+Ry9OJBV3CkZ2kgolm0Cm37Kb vhSXd75tmELfkUSVvZoVFuDtYjaakHpmlrvaWQlQVeCEs8zURtwXiGWnX2M4qtVP0C1M +MhVTCxOIMV1MQC5MrO/dzWR3ZnmYQOWxig2p+zr01yYHgMSRsFljmm9x82tqhk67qGo Cnw8Y43FPg7HAUqhj5U1e+EaMFF81qaouNrfEi3sw1LBeTwn4BTHyxOitSwcdRcsQ6hz 2mrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=bRtaAEoX3Wl0MO3YfnMNq5KlU2cGESsyfs3QuKUrWMQ=; b=cfl0Dj3NnrLy5OLnBHjx2iqPfL88y/+hH2dNZU1hULS2Jg+bnBYaB+Ry+RSDoE4g/B sbOlTAso13pGjlM0kZqYQ7zwFk3pSQPVFSGzinv7E7JVpI0mDRZOpqHJMRciq1r7BmJ+ tfHjqT9X7emPRvmBA45GDMJh3Hv8YDDbei5X81E1aOzDic1gYetVjE2mKJ/cRvP4c9R+ 9MtiCtdbvkaIMbNcDmkhODuoqPhTbOEgRXZy+3pTOXW011dhodRgsOkjwkgOvIi/Hyuw eGRLtF3N8lSKzyYhtW9nbGFFHiCCvyOElENwNX8IpQXHjrapPPvkoF3IpExlw4YLxAWu 19vQ== X-Gm-Message-State: AOAM5328dXAxzeg61Rdei7usOuDjauKXmQ6bchxTf6gn/LCOEBkAt6km SQRyOwpArnDTFxIIM6/7d4I= X-Google-Smtp-Source: ABdhPJxPM7mvIl/8AHyY05ylR3UYZjbw17Y8+HETLuFbf204YUSvzO/B3HPbmXfo4skYWltbWWTqwg== X-Received: by 2002:a63:4e4d:: with SMTP id o13mr892766pgl.361.1623868051314; Wed, 16 Jun 2021 11:27:31 -0700 (PDT) Received: from nuc10 (104.36.148.139.aurocloud.com. [104.36.148.139]) by smtp.gmail.com with ESMTPSA id g8sm3145642pja.14.2021.06.16.11.27.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 11:27:31 -0700 (PDT) Date: Wed, 16 Jun 2021 11:27:26 -0700 From: Rustam Kovhaev To: David Hildenbrand Cc: Catalin Marinas , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, dvyukov@google.com, gregkh@linuxfoundation.org Subject: Re: kmemleak memory scanning Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 1EA59C00CBE4 X-Stat-Signature: 8idgkrt8ihqqocci7g8p1pd6dw1g3ne6 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=CAoFIeiN; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf22.hostedemail.com: domain of rkovhaev@gmail.com designates 209.85.215.179 as permitted sender) smtp.mailfrom=rkovhaev@gmail.com X-HE-Tag: 1623868040-409673 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000230, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Jun 15, 2021 at 10:12:06AM +0200, David Hildenbrand wrote: > On 14.06.21 22:31, Rustam Kovhaev wrote: > > hello Catalin, Andrew! > > > > while troubleshooting a false positive syzbot kmemleak report i have > > noticed an interesting behavior in kmemleak and i wonder whether it is > > behavior by design and should be documented, or maybe something to > > improve. > > Hi, > > See below regarding documentation. > > > apologies if some of the questions do not make sense, i am still going > > through kmemleak code.. > > > > a) kmemleak scans struct page (kmemleak.c:1462), but it does not scan > > the actual contents (page_address(page)) of the page. > > if we allocate an object with kmalloc(), then allocate page with > > alloc_page(), and if we put kmalloc pointer somewhere inside that page, > > kmemleak will report kmalloc pointer as a false positive. > > should we improve kmemleak and make it scan page contents? > > or will this bring too many false negatives? > > I looked into this a while ago to see which parts of the kernel end up > reading random physical page content and was happy to see that kmemleak does > *not* scan random physical memory :) > > We have to be very careful when reading random physical page content, > especially in virt environments this is really undesired, or when dealing > with memory holes, memory with problematic semantics like gart memory ... i see, makes sense, thank you for the info! > > The doc (Documentation/dev-tools/kmemleak.rst) states "Page allocations and > ioremap are not tracked.", which includes the alloc_page() example you gave > I think. i see it now, ty!