Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1271394

Re: [PATCH] kasan: fix kmemleak false-positive in kasan_module_alloc()

From Catalin Marinas <catalin.marinas@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] kasan: fix kmemleak false-positive in kasan_module_alloc()
Date 2015-11-17 17:40 +0100
Message-ID <qvRst-7rX-1@gated-at.bofh.it> (permalink)
References <qvRiQ-7og-53@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] kasan: fix kmemleak false-positive in kasan_module_alloc() Andrey Ryabinin <aryabinin@virtuozzo.com> - 2015-11-17 17:30 +0100
  Re: [PATCH] kasan: fix kmemleak false-positive in kasan_module_alloc() Catalin Marinas <catalin.marinas@gmail.com> - 2015-11-17 17:40 +0100

csiph-web