On Thu, Jul 16, 2020 at 11:02:53AM +0200, Peter Zijlstra wrote:
> On Wed, Jul 15, 2020 at 01:32:27AM +0300, Jarkko Sakkinen wrote:
> > +void *text_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;
> > +}
> > +
> > +void text_free(void *region)
> > +{
> > +   /*
> > +    * This memory may be RO, and freeing RO memory in an interrupt is not
> > +    * supported by vmalloc.
> > +    */
> > +   WARN_ON(in_interrupt());
> 
> I think that wants to be:
> 
>       lockdep_assert_irqs_enabled();
> 
> in_interrupt() isn't sufficient, interrupts must also not be disabled
> when issuesing TLB invalidations.

Shouldn't it be then also fixed in the module_memfree() fallback
implementation (kernel/module.c)?

/Jarkko

Reply via email to