On Wed, Jul 15, 2020 at 05:27:32PM +0900, Masami Hiramatsu wrote: > > On Wed, 15 Jul 2020 01:32:27 +0300 > Jarkko Sakkinen <jarkko.sakki...@linux.intel.com> wrote: > > [...] > > -void *module_alloc(unsigned long size) > > -{ > > - void *p; > > - > > - if (PAGE_ALIGN(size) > MODULES_LEN) > > - return NULL; > > - > > - p = __vmalloc_node_range(size, MODULE_ALIGN, > > - MODULES_VADDR + get_module_load_offset(), > > - MODULES_END, GFP_KERNEL, > > - PAGE_KERNEL, 0, NUMA_NO_NODE, > > - __builtin_return_address(0)); > > - if (p && (kasan_module_alloc(p, size) < 0)) { > > - vfree(p); > > - return NULL; > > - } > > - > > - return p; > > -} > > Please don't touch this module_alloc() at all. Then we can > just call __vmalloc_node_range() in the text_alloc().
Hm? I thought the requirement was that trampolines needed to stay within a certain distance of kernel text and that the module_alloc() enforced that? -- Kees Cook