Re: [PATCH v8 1/5] kasan: support backing vmalloc space with real shadow memory
From: Daniel Axtens <hidden>
Date: 2019-10-15 06:29:50
Also in:
linux-mm, lkml
quoted
quoted
@@ -2497,6 +2533,9 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align, if (!addr) return NULL; + if (kasan_populate_vmalloc(real_size, area)) + return NULL; +KASAN itself uses __vmalloc_node_range() to allocate and map shadow in memory online callback. So we should either skip non-vmalloc and non-module addresses here or teach kasan's memory online/offline callbacks to not use __vmalloc_node_range() (do something similar to kasan_populate_vmalloc() perhaps?).Ah, right you are. I haven't been testing that. I am a bit nervous about further restricting kasan_populate_vmalloc: I seem to remember having problems with code using the vmalloc family of functions to map memory that doesn't lie within vmalloc space but which still has instrumented accesses.
I was wrong or remembering early implementation bugs. If the memory we're allocating in __vmalloc_node_range falls outside of vmalloc and module space, it shouldn't be getting shadow mapped for it by kasan_populate_vmalloc. For v9, I've guarded the call with is_vmalloc_or_module. It seems to work fine when tested with hotplugged memory. Thanks again. Regards, Daniel
On the other hand, I'm not keen on rewriting any of the memory on/offline code if I can avoid it! I'll have a look and get back you as soon as I can. Thanks for catching this. Kind regards, Danielquoted
-- You received this message because you are subscribed to the Google Groups "kasan-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to kasan-dev+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/352cb4fa-2e57-7e3b-23af-898e113bbe22%40virtuozzo.com.