Re: [PATCH 4/6] mm: remove free_unmap_vmap_area_addr

From: Nicholas Piggin
Date: Thu Oct 20 2016 - 21:59:43 EST


On Thu, 20 Oct 2016 17:46:36 -0700
Joel Fernandes <joelaf@xxxxxxxxxx> wrote:

> > @@ -1100,10 +1091,14 @@ void vm_unmap_ram(const void *mem, unsigned int count)
> > debug_check_no_locks_freed(mem, size);
> > vmap_debug_free_range(addr, addr+size);
> >
> > - if (likely(count <= VMAP_MAX_ALLOC))
> > + if (likely(count <= VMAP_MAX_ALLOC)) {
> > vb_free(mem, size);
> > - else
> > - free_unmap_vmap_area_addr(addr);
> > + return;
> > + }
> > +
> > + va = find_vmap_area(addr);
> > + BUG_ON(!va);
>
> Considering recent objections to BUG_ON [1], lets make this a WARN_ON
> while we're moving the code?

If you lost track of your kernel memory mappings, you are in big trouble
and fail stop is really the best course of action for containing the
problem, which could have security and data corruption implications. This
is covered by Linus' last paragraph in that commit.

Thanks,
Nick