mm/vmalloc.c: allow vread() to read out vm_map_ram areas
authorBaoquan He <bhe@redhat.com>
Mon, 6 Feb 2023 08:40:16 +0000 (16:40 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 10 Feb 2023 00:51:42 +0000 (16:51 -0800)
commit06c8994626d1b7d8c26dfd06992d67703a274054
tree70659260d7b5ef9e4b37b076567e09a124d8bf65
parent869176a096068056b338b5cc1b0af93106007f5d
mm/vmalloc.c: allow vread() to read out vm_map_ram areas

Currently, vread can read out vmalloc areas which is associated with a
vm_struct.  While this doesn't work for areas created by vm_map_ram()
interface because it doesn't have an associated vm_struct.  Then in
vread(), these areas are all skipped.

Here, add a new function vmap_ram_vread() to read out vm_map_ram areas.
The area created with vmap_ram_vread() interface directly can be handled
like the other normal vmap areas with aligned_vread().  While areas which
will be further subdivided and managed with vmap_block need carefully read
out page-aligned small regions and zero fill holes.

Link: https://lkml.kernel.org/r/20230206084020.174506-4-bhe@redhat.com
Reported-by: Stephen Brennan <stephen.s.brennan@oracle.com>
Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Lorenzo Stoakes <lstoakes@gmail.com>
Tested-by: Stephen Brennan <stephen.s.brennan@oracle.com>
Cc: Dan Carpenter <error27@gmail.com>
Cc: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/vmalloc.c