Re: Calling vmalloc_to_page() on ioremap memory?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 25, 2018 at 04:59:23PM +0200, Alexander Potapenko wrote:
> Hi Ard, Mark, Andrew and others,
> 
> AFAIU, commit 029c54b09599573015a5c18dbe59cbdf42742237 ("mm/vmalloc.c:
> huge-vmap: fail gracefully on unexpected huge vmap mappings") was
> supposed to make vmalloc_to_page() return NULL for pointers not
> returned by vmalloc().

It's a little more subtle than that -- avoiding an edge case where we
unexpectedly hit huge mappings, rather than determining whether an
address same from vmalloc().

> For memory error detection purposes I'm trying to map the addresses
> from the vmalloc range to valid struct pages, or at least make sure
> there's no struct page for a given address.
> Looking up the vmap_area_root rbtree isn't an option, as this must be
> done from instrumented code, including interrupt handlers.

I'm not sure how you can do this without looking at VMAs.

In general, the vmalloc area can contain addresses which are not memory,
and this cannot be detremined from the address alone.

You *might* be able to get away with pfn_valid(vmalloc_to_pfn(x)), but
IIRC there's some disagreement on the precise meaning of pfn_valid(), so
that might just tell you that the address happens to fall close to some
valid memory.

Thanks,
Mark.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux