linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@gmail.com>
To: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kasan: fix kmemleak false-positive in kasan_module_alloc()
Date: Tue, 17 Nov 2015 16:29:49 +0000	[thread overview]
Message-ID: <CAHkRjk7_2udHhf-MmsF4uvusYR+b17jLGoL=5OzOdDXQAiC_9w@mail.gmail.com> (raw)
In-Reply-To: <1447777222-13396-1-git-send-email-aryabinin@virtuozzo.com>

On 17 November 2015 at 16:20, Andrey Ryabinin <aryabinin@virtuozzo.com> wrote:
> kasan_module_alloc() allocates shadow memory for module and frees it on module
> unloading. It doesn't store the pointer to allocated shadow memory because
> it could be calculated from the shadowed address, i.e. kasan_mem_to_shadow(addr).
> Since kmemleak cannot find pointer to allocated shadow, it thinks that memory leaked.
> We should tell kmemleak that this is not a leak.
[...]
> @@ -444,6 +445,7 @@ int kasan_module_alloc(void *addr, size_t size)
>
>         if (ret) {
>                 find_vm_area(addr)->flags |= VM_KASAN;
> +               kmemleak_not_leak(ret);
>                 return 0;
>         }

If such memory does not contain any pointers to other objects, you
could use kmemleak_ignore() which would make kmemleak not scan it at
all (slight performance improvement).

-- 
Catalin

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2015-11-17 16:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17 16:20 Andrey Ryabinin
2015-11-17 16:29 ` Catalin Marinas [this message]

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='CAHkRjk7_2udHhf-MmsF4uvusYR+b17jLGoL=5OzOdDXQAiC_9w@mail.gmail.com' \
    --to=catalin.marinas@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=aryabinin@virtuozzo.com \
    --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