linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rustam Kovhaev <rkovhaev@gmail.com>
To: David Hildenbrand <david@redhat.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	dvyukov@google.com, gregkh@linuxfoundation.org
Subject: Re: kmemleak memory scanning
Date: Wed, 16 Jun 2021 11:27:26 -0700	[thread overview]
Message-ID: <YMpCjmCrhPwpCiid@nuc10> (raw)
In-Reply-To: <f60e2a4f-2eb8-1097-60b5-eee998478068@redhat.com>

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!


  reply	other threads:[~2021-06-16 18:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14 20:31 kmemleak memory scanning Rustam Kovhaev
2021-06-15  5:15 ` Dmitry Vyukov
2021-06-16 18:25   ` Rustam Kovhaev
2021-06-24 17:36     ` Rustam Kovhaev
2021-06-25 15:01       ` Catalin Marinas
2021-06-25 15:27         ` Rustam Kovhaev
2021-06-25 15:36           ` Dmitry Vyukov
2021-06-15  8:12 ` David Hildenbrand
2021-06-16 18:27   ` Rustam Kovhaev [this message]
2021-06-15 10:15 ` Catalin Marinas
2021-06-16 18:36   ` Rustam Kovhaev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YMpCjmCrhPwpCiid@nuc10 \
    --to=rkovhaev@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=david@redhat.com \
    --cc=dvyukov@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).