On Fri, 03 Apr 2015 17:47:47 +0300 Andrey Ryabinin <a.ryabi...@samsung.com> wrote:
> Mempools keep allocated objects in reserved for situations > when ordinary allocation may not be possible to satisfy. > These objects shouldn't be accessed before they leave > the pool. > This patch poison elements when get into the pool > and unpoison when they leave it. This will let KASan > to detect use-after-free of mempool's elements. > > ... > > +static void kasan_poison_element(mempool_t *pool, void *element) > +{ > + if (pool->alloc == mempool_alloc_slab) > + kasan_slab_free(pool->pool_data, element); > + if (pool->alloc == mempool_kmalloc) > + kasan_kfree(element); > + if (pool->alloc == mempool_alloc_pages) > + kasan_free_pages(element, (unsigned long)pool->pool_data); > +} We recently discovered that mempool pages (from alloc_pages, not slab) can be in highmem. But kasan apepars to handle highmem pages (by baling out) so we should be OK with that. Can kasan be taught to use kmap_atomic() or is it more complicated than that? It probably isn't worthwhile - highmem pages don'[t get used by the kernel much and most bugs will be found using 64-bit testing anyway. ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Jfs-discussion mailing list Jfs-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jfs-discussion